-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·62 lines (48 loc) · 1.72 KB
/
uninstall.sh
File metadata and controls
executable file
·62 lines (48 loc) · 1.72 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
#!/bin/sh
# uninstall.sh
# removes Setup Manager app and all related files
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Note:
# Setup Manager creates flag and data files at
#
# /private/var/db/.JamfSetupStarted
# /private/var/db/.JamfSetupEnrollmentDone
# /private/var/db/SetupManagerUserData.txt
#
# This uninstall script does NOT (yet) remove these files.
#
# When you re-install Setup Manager after running this script,
# the `.JamfSetupEnrollmentDone` flag file's existence will
# suppress the launch of Setup Manager.
#
# Depending on your workflow needs, you may want to preserve
# or remove these files during un-installation. Uncomment the
# respective `rm` lines at the end of this script.
appName="Setup Manager"
bundleID="com.jamf.setupmanager"
appPath="/Applications/Utilities/${appName}.app"
if [ "$(whoami)" != "root" ]; then
echo "needs to run as root!"
exit 1
fi
if launchctl list | grep -q "$bundleID.finished" ; then
echo "unloading launch daemon"
launchctl unload /Library/LaunchDaemons/"$bundleID".finished.plist
fi
if launchctl list | grep -q "$bundleID" ; then
echo "unloading launch daemon"
launchctl unload /Library/LaunchDaemons/"$bundleID".plist
fi
echo "removing files"
rm -rfv "$appPath"
rm -v /Library/LaunchDaemons/"$bundleID".plist
rm -v /Library/LaunchAgents/"$bundleID".loginwindow.plist
rm -v /Library/LaunchAgents/"$bundleID".finished.plist
echo "forgetting $bundleID pkg receipt"
pkgutil --forget "$bundleID"
# uncomment depending on which files you need to remove or preserve
# rm -v /private/var/db/.JamfSetupStarted
# rm -v /private/var/db/.JamfSetupEnrollmentDone
# rm -v /private/var/db/SetupManagerUserData.txt
# always exit success regardless of exit code of above commands
exit 0