-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·67 lines (60 loc) · 2.3 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·67 lines (60 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#
# Removes Voicy: the background agent, its launch agent and the app bundle.
# Dictation history, settings and the downloaded speech model are left
# alone — pass --purge to remove those too.
set -euo pipefail
APP_PATH="/Applications/Voicy.app"
AGENT_LABEL="com.helpsolution.voicy.agent"
AGENT_PLIST="$HOME/Library/LaunchAgents/$AGENT_LABEL.plist"
SUPPORT_DIR="$HOME/Library/Application Support/Voicy"
PREFS="$HOME/Library/Preferences/com.helpsolution.voicy.plist"
# The launchd redirect is a byte-for-byte twin of the app's own log, so a
# purge that left it behind would leave the diagnostics it just deleted.
LOG="$HOME/Library/Logs/Voicy.log"
AGENT_LOG="$HOME/Library/Logs/Voicy-agent.launchd.log"
PURGE=0
ASSUME_YES=0
for argument in "$@"; do
case "$argument" in
--purge) PURGE=1 ;;
--yes|-y) ASSUME_YES=1 ;;
*)
printf 'usage: %s [--purge] [--yes]\n' "$(basename "$0")" >&2
exit 2
;;
esac
done
printf 'This will remove %s and its background agent.\n' "$APP_PATH"
if (( PURGE )); then
printf 'It will ALSO delete your dictation history, saved transcripts, settings and logs:\n %s\n %s\n %s\n %s\n' \
"$SUPPORT_DIR" "$PREFS" "$LOG" "$AGENT_LOG"
fi
if (( ! ASSUME_YES )); then
# Deleting someone's app without asking is rude; deleting their history
# without asking is worse.
read -r -p 'Continue? [y/N] ' reply
case "$reply" in
y|Y|yes|YES) ;;
*) printf 'Cancelled.\n'; exit 0 ;;
esac
fi
# Absolute paths throughout: this script may be run with an inherited PATH,
# and `rm` is not something to take from a stranger's environment.
/bin/launchctl bootout "gui/$UID/$AGENT_LABEL" >/dev/null 2>&1 || true
/usr/bin/pkill -x Voicy >/dev/null 2>&1 || true
/bin/rm -f "$AGENT_PLIST"
if [[ -w /Applications ]]; then
/bin/rm -rf "$APP_PATH"
else
/usr/bin/sudo /bin/rm -rf "$APP_PATH"
fi
if (( PURGE )); then
/bin/rm -rf "$SUPPORT_DIR"
/bin/rm -f "$PREFS" "$LOG" "$AGENT_LOG"
/usr/bin/defaults delete com.helpsolution.voicy >/dev/null 2>&1 || true
printf 'Voicy and its data are gone. The speech model in FluidAudio is shared and was left in place.\n'
else
printf 'Voicy removed. History, settings and the downloaded model were kept.\n'
printf 'Run with --purge to delete those too.\n'
fi