Code Monkey home page Code Monkey logo

Comments (13)

cho-m avatar cho-m commented on May 18, 2024

Can you post what the uninstall_preflight section says in the following file:
/usr/local/Caskroom/asix-ax88179/.metadata/2.19.0,1109/20210428133711.072/Casks/asix-ax88179.rb

And the name of the uninstaller in following directory:
/usr/local/Caskroom/asix-ax88179/2.19.0,1109/


The failure is due to not finding the uninstaller PKG.

One possibility is the uninstaller being renamed by upstream after we updated Cask.

Another possibility, is a (potential) situation if you updated to Big Sur after installing a version of Cask with #2231, i.e.

  1. On Catalina, install asix-ax88179 within last 12 days
  2. Upgrade to Big Sur
  3. If the MacOS version wasn't saved during installation, then the uninstaller may incorrectly try to run the Big Sur uninstaller when you need the Catalina (and older) uninstaller.

from homebrew-cask-drivers.

xkszltl avatar xkszltl commented on May 18, 2024

Can you post ...

% cat /usr/local/Caskroom/asix-ax88179/.metadata/2.19.0,1109/20210428133711.072/Casks/asix-ax88179.rb
cask "asix-ax88179" do
  version "2.19.0,1109"
  sha256 :no_check

  url "https://www.asix.com.tw/en/support/download/file/#{version.after_comma}"
  name "AX88179"
  desc "USB 3.0 to gigabit ethernet drivers for ASIX Electronics devices"
  homepage "https://www.asix.com.tw/en/support/download"

  livecheck do
    url "https://www.asix.com.tw/en/support/download/step2/11/2/3"
    strategy :page_match do |page|
      page.split(/class=['"]?list__item['"]?/).map do |list_item|
        match = list_item.match(
          %r{data-href=.*?/download/file/(\d+).*?macOS.*?Vision\s*?(?:<br>)?\s*?(\d+(?:\.\d+)*)<}mi,
        )
        "#{match[2]},#{match[1]}" if match
      end.compact
    end
  end

  container nested: "AX88179_178A_macOS_10.9_to_10.15_Driver_Installer_v#{version.before_comma}/AX88179_178A_v#{version.before_comma}.dmg"

  installer manual: "AX88179_178A_v#{version.before_comma}.app"

  uninstall_preflight do
    staged_path.glob("AX88179_178A_Uninstall_v*.pkg").first.rename(staged_path/"AX88179_178A_Uninstall.pkg")

    system_command "/usr/sbin/installer",
                   args: [
                     "-pkg", staged_path/"AX88179_178A_Uninstall.pkg",
                     "-target", "/"
                   ],
                   sudo: true
  end

  uninstall pkgutil: "com.asix.ax88179.uninstall"

  caveats do
    reboot
  end
end

And the name ...

% ls /usr/local/Caskroom/asix-ax88179/2.19.0,1109/
AX88179_178A_Uninstall.pkg	AX88179_178A_v2.19.0.app	readme.txt

One possibility is the uninstaller being renamed by upstream after we updated Cask.

Yes that's possible, I remember seeing that happened before.

Another possibility, is a (potential) situation if you updated to Big Sur after installing a version of Cask with ...

Yes I upgraded to Big Sur a few weeks ago (not exactly sure when but recently), asix-ax88179 was installed long ago on Catalina (but could be later updated if that counts)

from homebrew-cask-drivers.

xkszltl avatar xkszltl commented on May 18, 2024

BTW besides the issue itself, probably the ruby script should also have more checks to show clear error msg.

from homebrew-cask-drivers.

cho-m avatar cho-m commented on May 18, 2024

In this case, the filename: AX88179_178A_Uninstall.pkg
doesn't match the glob: AX88179_178A_Uninstall_v*.pkg
which could be due to the first scenario.

@Homebrew/cask To get someone more familiar with uninstaller logic to comment if it is safe to just manually edit the metadata file so it can find the uninstaller (or rename the PKG to match the glob).


In terms of the error message, it may be better to handle the exception in Homebrew/brew code rather than adding extra Ruby code into the Casks.

It would be more readable for non-programmers to mainly use Cask DSL and only lightly use Ruby code when necessary.

Though, the error may end up looking like
Error: asix-ax88179: Uninstall preflight failed due to [...reason...]
where the reason may just be undefined method 'rename' for nil:NilClass since it isn't easy to get further details without extra logic.

from homebrew-cask-drivers.

vitorgalvao avatar vitorgalvao commented on May 18, 2024

@Homebrew/cask To get someone more familiar with uninstaller logic to comment if it is safe to just manually edit the metadata file so it can find the uninstaller (or rename the PKG to match the glob).

It should be, I think.

from homebrew-cask-drivers.

xkszltl avatar xkszltl commented on May 18, 2024

So what's the expectation here?
Is it fixed?
Should I manually edit the uninstaller path and have a try?
Or will there be a patch to correct old installation automatically?

from homebrew-cask-drivers.

cho-m avatar cho-m commented on May 18, 2024

@xkszltl You will need to do some manual edits.

The uninstaller logic is saved when you originally installed the Cask, so even if we change Cask in repo, it won't impact how uninstall is handled.


Since you already have a file named AX88179_178A_Uninstall.pkg, the rename logic is unnecessary and can be deleted/commented out from
/usr/local/Caskroom/asix-ax88179/.metadata/2.19.0,1109/20210428133711.072/Casks/asix-ax88179.rb

Specifically, you can try removing the line

staged_path.glob("AX88179_178A_Uninstall_v*.pkg").first.rename(staged_path/"AX88179_178A_Uninstall.pkg")

Since the PKG file already matches the expected name.

from homebrew-cask-drivers.

xkszltl avatar xkszltl commented on May 18, 2024

This is what I end up with after commenting it out:

==> Casks with 'auto_updates' or 'version :latest' will not be upgraded; pass `--greedy` to upgrade them.
==> Upgrading 1 outdated package:
asix-ax88179 2.19.0,1109 -> 1.2.0,1126
==> Upgrading asix-ax88179
==> Caveats
You must reboot for the installation of asix-ax88179 to take effect.

==> Downloading https://www.asix.com.tw/en/support/download/file/1126
Already downloaded: /Users/xkszltl/Library/Caches/Homebrew/downloads/baee1215d87b32ee61d8d3d487df0cf3567435e679fc7ff8dabbc5d26457af7e--en
Warning: No checksum defined for cask 'asix-ax88179', skipping verification.
==> Uninstalling packages; your password may be necessary:
com.asix.ax88179.uninstall
==> Purging files for version 1.2.0,1126 of Cask asix-ax88179
==> Purging files for version 1.2.0,1126 of Cask asix-ax88179
Warning: Reverting upgrade for Cask asix-ax88179
To complete the installation of Cask asix-ax88179, you must also
run the installer at:
  /usr/local/Caskroom/asix-ax88179/2.19.0,1109/AX88179_178A_v2.19.0.app
Error: asix-ax88179: No such file or directory @ rb_sysopen - /private/tmp/d20210611-18965-1sz4stz/ASIX_USB_Device_Installer_macOS_11.0_above_Driver_v1.2.0/ASIX_USB_Device_Installer_v1.2.0.dmg

Tried uninstall + delete cache + reinstall, uninstall does work since it can now get the correct file name, but installation is broken:

==> Caveats
You must reboot for the installation of asix-ax88179 to take effect.

==> Downloading https://www.asix.com.tw/en/support/download/file/1126
==> Downloading from https://www.asix.com.tw/en
 -=#=-#  #    #                                                               
Warning: No checksum defined for cask 'asix-ax88179', skipping verification.
==> Installing Cask asix-ax88179
==> Purging files for version 1.2.0,1126 of Cask asix-ax88179
Error: No such file or directory @ rb_sysopen - /private/tmp/d20210611-20856-s3j5su/ASIX_USB_Device_Installer_macOS_11.0_above_Driver_v1.2.0/ASIX_USB_Device_Installer_v1.2.0.dmg

from homebrew-cask-drivers.

xkszltl avatar xkszltl commented on May 18, 2024

This is what I got from https://www.asix.com.tw/en/support/download/step2/11/2/3:

  • ASIX_USB_Device_Installer_macOS_11.3_above_Driver_v1.2.0_20210521

So probably they changed the name.
Maybe we can change this line?

container nested: "ASIX_USB_Device_Installer_macOS_11.0_above_Driver_v#{version.before_comma}/ASIX_USB_Device_Installer_v#{version.before_comma}.dmg"

But for pre 11.3, I'm not sure what to do at this point...

from homebrew-cask-drivers.

cho-m avatar cho-m commented on May 18, 2024

We had some issues trying to update the Cask in #2250

Still need to figure out why the installer PKG was still running after install was done.

from homebrew-cask-drivers.

xkszltl avatar xkszltl commented on May 18, 2024

And they probably upgrade to 1132 recently:

version "1.2.0,1126"

1126 URL now points to their homepage.

from homebrew-cask-drivers.

xkszltl avatar xkszltl commented on May 18, 2024

Ah good to know someone is already working on that upgrade.

from homebrew-cask-drivers.

cho-m avatar cho-m commented on May 18, 2024

@xkszltl There is no-one currently working on it since it has been stale-closed.

There will need to be another PR.
It may also require unpacking the PKG to find out why the processes are still running
(e.g. is there an interactive prompt or something)

from homebrew-cask-drivers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.