-
Notifications
You must be signed in to change notification settings - Fork 1
/
uninstall.sh
executable file
·54 lines (34 loc) · 1.24 KB
/
uninstall.sh
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
#!/bin/zsh -f
NAME="$0:t:r"
PLIST='/Library/LaunchDaemons/com.tjluoma.setrestartpowerfailure.on.plist'
if [[ ! -e "$PLIST" ]]
then
echo "$NAME: $PLIST does not exist."
exit 0
fi
function die
{
echo "$NAME: $@"
exit 1
}
sudo -v -p "
Your administrator password is required to continue.
This is the password that you use to log in to your '%u' account on this computer.
Password: "
####################################################################################
LABEL=`defaults read "$PLIST" Label`
sudo launchctl stop "$LABEL" \
|| die "launchctl stop: failed"
echo "$NAME: launchctl stop $LABEL was successful"
####################################################################################
sudo launchctl unload "$PLIST" \
|| die "launchctl unload failed"
echo "$NAME: launchctl unload $LABEL was successful"
####################################################################################
sudo rm -f "$PLIST" \
|| die "Failed to remove $PLIST"
echo "$NAME: rm (remove) $PLIST was successful"
####################################################################################
echo "$NAME: Exiting after all steps were successful."
####################################################################################
exit 0