feat: improve post uninstall script for macos to properly remove application and its components (#1521)
This commit is contained in:
parent
6977a8ecbc
commit
f3a4a1b1be
1 changed files with 27 additions and 7 deletions
|
@ -2,13 +2,33 @@
|
||||||
|
|
||||||
APP_NAME=AmneziaVPN
|
APP_NAME=AmneziaVPN
|
||||||
PLIST_NAME=$APP_NAME.plist
|
PLIST_NAME=$APP_NAME.plist
|
||||||
LAUNCH_DAEMONS_PLIST_NAME=/Library/LaunchDaemons/$PLIST_NAME
|
LAUNCH_DAEMONS_PLIST_NAME="/Library/LaunchDaemons/$PLIST_NAME"
|
||||||
|
APP_PATH="/Applications/$APP_NAME.app"
|
||||||
|
USER_APP_SUPPORT="$HOME/Library/Application Support/$APP_NAME"
|
||||||
|
SYSTEM_APP_SUPPORT="/Library/Application Support/$APP_NAME"
|
||||||
|
LOG_FOLDER="/var/log/$APP_NAME"
|
||||||
|
CACHES_FOLDER="$HOME/Library/Caches/$APP_NAME"
|
||||||
|
|
||||||
if launchctl list "$APP_NAME-service" &> /dev/null; then
|
# Stop the running service if it exists
|
||||||
launchctl unload $LAUNCH_DAEMONS_PLIST_NAME
|
if pgrep -x "${APP_NAME}-service" > /dev/null; then
|
||||||
rm -f $LAUNCH_DAEMONS_PLIST_NAME
|
sudo killall -9 "${APP_NAME}-service"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "$HOME/Library/Application Support/$APP_NAME"
|
# Unload the service if loaded and remove its plist file regardless
|
||||||
rm -rf /var/log/$APP_NAME
|
if launchctl list "${APP_NAME}-service" &> /dev/null; then
|
||||||
rm -rf /Applications/$APP_NAME.app/Contents
|
sudo launchctl unload "$LAUNCH_DAEMONS_PLIST_NAME"
|
||||||
|
fi
|
||||||
|
sudo rm -f "$LAUNCH_DAEMONS_PLIST_NAME"
|
||||||
|
|
||||||
|
# Remove the entire application bundle
|
||||||
|
sudo rm -rf "$APP_PATH"
|
||||||
|
|
||||||
|
# Remove Application Support folders (user and system, if they exist)
|
||||||
|
rm -rf "$USER_APP_SUPPORT"
|
||||||
|
sudo rm -rf "$SYSTEM_APP_SUPPORT"
|
||||||
|
|
||||||
|
# Remove the log folder
|
||||||
|
sudo rm -rf "$LOG_FOLDER"
|
||||||
|
|
||||||
|
# Remove any caches left behind
|
||||||
|
rm -rf "$CACHES_FOLDER"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue