Skip to content

Commit

Permalink
Clean up all old registries in postinstall and uninstall
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Li <[email protected]>
  • Loading branch information
KevinLiAWS committed Nov 7, 2023
1 parent 98c8ee4 commit 521fb7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion installer-builder/darwin/Resources/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ if [ "$$(readlink "/usr/local/bin/finch")" = "/Applications/Finch/bin/finch" ];
echo "[1/3] [DONE] Successfully deleted shortcut links"

#forget from pkgutil
pkgutil --forget "org.Finch.__VERSION__" > /dev/null 2>&1
echo "Remove historical pkgutil packages..."
pkgutil --pkgs | grep '^org\.Finch\.' | while read -r pkg; do
echo "Forgetting package $pkg"
sudo pkgutil --forget "$pkg"
done

if [ $? -eq 0 ]
then
echo "[2/3] [DONE] Successfully deleted application informations"
Expand Down
7 changes: 7 additions & 0 deletions installer-builder/darwin/scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ sudo rm -rf "/opt/finch/"
sudo rm -rf "/private/var/run/finch-lima"
sudo rm -rf "/private/etc/sudoers.d/finch-lima"

# Forget previous pkgutil packages starting with org.Finch except for the current version
echo "Remove historical pkgutil packages..."
pkgutil --pkgs | grep '^org\.Finch\.' | grep -v '^org\.Finch\.__VERSION__' | while read -r pkg; do
echo "Forgetting package $pkg"
sudo pkgutil --forget "$pkg"
done

echo "Post installation process finished."

0 comments on commit 521fb7b

Please sign in to comment.