From 10a2714ead7f802af07646acc95e6ed13483cf5d Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Mon, 27 Mar 2023 14:12:57 -0700 Subject: [PATCH] orbstack: Add hooks and more complete uninstall/zap (#143807) * orbstack: Add hooks and more complete uninstall/zap - Add postflight hook to complete update as discussed in #143806. Does nothing on first install. - Add uninstall and zap hooks for VM cleanup (does nothing in v0.5.0 and v0.5.1, but already implemented for future versions) - Clean up GUI app state in ~/Library on zap. (`macvirt` is the project's codename) * orbstack: Remove ~/OrbStack mount if empty When OrbStack is running, Docker volumes and Linux files are mounted at ~/OrbStack. If it's not empty, users may have accidentally stored data there while it wasn't mounted, so leave it alone * orbstack: Remove zap script Doesn't work because it runs after uninstall. The uninstall script is enough. --- Casks/orbstack.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Casks/orbstack.rb b/Casks/orbstack.rb index 1c6f938cc4..595615c5b4 100644 --- a/Casks/orbstack.rb +++ b/Casks/orbstack.rb @@ -21,5 +21,29 @@ cask "orbstack" do app "OrbStack.app" - zap trash: "~/.orbstack" + postflight do + system_command "#{appdir}/OrbStack.app/Contents/MacOS/bin/orbctl", + args: ["_internal", "brew-postflight"] + end + + uninstall script: { + executable: "#{appdir}/OrbStack.app/Contents/MacOS/bin/orbctl", + args: ["_internal", "brew-uninstall"], + } + + zap trash: [ + "~/.orbstack", + "~/Library/Caches/dev.kdrag0n.MacVirt", + "~/Library/HTTPStorages/dev.kdrag0n.MacVirt", + "~/Library/Preferences/dev.krag0n.MacVirt.plist", + "~/Library/WebKit/dev.kdrag0n.MacVirt", + "~/Library/Saved Application State/dev.kdrag0n.MacVirt.savedState", + ], + rmdir: [ + "~/OrbStack", + ] + + caveats <<~EOS + Open the OrbStack app to finish setup. + EOS end