Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix to delete ~/.finch when uninstalling finch #703

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions installer-builder/darwin/Resources/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sudo pkill '^limactl'

if [ "$(readlink '/usr/local/bin/finch')" = "/Applications/Finch/bin/finch" ]; then sudo rm /usr/local/bin/finch; fi

echo "[1/3] [DONE] Successfully deleted shortcut links"
echo "[1/4] [DONE] Successfully deleted shortcut links"

#forget from pkgutil
echo "Remove historical pkgutil packages..."
Expand All @@ -32,19 +32,41 @@ done

if [ $? -eq 0 ]
then
echo "[2/3] [DONE] Successfully deleted application informations"
echo "[2/4] [DONE] Successfully deleted application informations"
else
echo "[2/3] [ERROR] Could not delete application informations" >&2
echo "[2/4] [ERROR] Could not delete application informations" >&2
fi

#remove application source distribution
[ -e "/Applications/Finch" ] && rm -rf /Applications/Finch && rm -rf /opt/finch && rm -rf /private/var/run/finch-lima && rm -rf /private/etc/sudoers.d/finch-lima
if [ $? -eq 0 ]
then
echo "[3/3] [DONE] Successfully deleted application"
echo "[3/4] [DONE] Successfully deleted application"
else
echo "[3/3] [ERROR] Could not delete application" >&2
echo "[3/4] [ERROR] Could not delete application" >&2
fi

#clean up ~/.finch directory
while true; do
read -r -p "Delete ~/.finch containing persistent user data [Y/n]? " answer
if [[ $answer == "y" || $answer == "Y" || $answer == "" ]]
then
[ -d ~/.finch ] && rm -rf ~/.finch
if [ $? -eq 0 ]
then
echo "[4/4] [DONE] Successfully deleted ~/.finch"
else
echo "[4/4] [ERROR] Could not delete ~/.finch" >&2
fi
break
elif [[ $answer == "n" || $answer == "N" ]]
then
echo "[4/4] Deletion of ~/.finch was aborted."
break
else
echo "Please answer with 'y' or 'n'"
fi
done

echo "Application uninstall process finished"
exit 0
Loading