diff --git a/installer-builder/darwin/Resources/uninstall.sh b/installer-builder/darwin/Resources/uninstall.sh index 4e86369ea..5026cd3b7 100755 --- a/installer-builder/darwin/Resources/uninstall.sh +++ b/installer-builder/darwin/Resources/uninstall.sh @@ -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" diff --git a/installer-builder/darwin/scripts/postinstall b/installer-builder/darwin/scripts/postinstall index a0ce9e26b..a9dc98e74 100755 --- a/installer-builder/darwin/scripts/postinstall +++ b/installer-builder/darwin/scripts/postinstall @@ -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."