-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpostinstall
More file actions
135 lines (119 loc) · 3.85 KB
/
postinstall
File metadata and controls
135 lines (119 loc) · 3.85 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
# Version 0.1 - initial test deployment
# Version 0.2 - terrible first version omg it was bad.
CURUSER=`/usr/bin/who | grep console | cut -d ' ' -f1`
# Erase old file
if [ -f /Library/LaunchAgents/com.copiousit.mackeeperkiller.plist ]; then
rm /Library/LaunchAgents/com.copiousit.mackeeperkiller.plist
fi
# Check for the CURUSER level launchdaemon
if [ ! -f /Library/LaunchAgents/com.copiousit.mackeeperkiller.plist ]; then
#lets dump the launchd file into location
cat > /Library/LaunchAgents/com.copiousit.mackeeperkiller.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.copiousit.mackeeperkiller</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/mackeeperKiller</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>3600</integer>
</dict>
</plist>
EOF
fi
if [ ! -d /usr/local/bin ]; then
mkdir -p /usr/local/bin
fi
# now lets dump the script into location
cat > /usr/local/bin/mackeeperKiller << EOF
#!/bin/bash
# This program will check for an uninstall MacKeeper and JustCloud
CURUSER=`/usr/bin/who | grep console | cut -d ' ' -f1`
#################
### Variables ###
#################
# Items at the system level to be removed
declare -a systemItems=(
/Applications/MacKeeper.app
/Applications/JustCloud.app
/Library/Preferences/.3FAD0F65-FC6E-4889-B975-B96CBF807B78
/private/var/folders/mh/yprf0vxs3mx_n2lg3tjgqddm0000gn/T/MacKeeper*
/private/tmp/MacKeeper*
/Library/LaunchDaemons/com.mackeeper.Cerberus.plist
/Library/LaunchDaemons/com.mackeeper.MacKeeper.MacKeeperPrivilegedHelper.plist
/Users/\$CURUSER/Library/Application\ Support/MacKeeper*
/Users/\$CURUSER/Library/LaunchAgents/com.zeobit.MacKeeper.Helper.plist
/Users/\$CURUSER/Library/LaunchAgents/com.jdibackup.JustCloud.autostart.plist
/Users/\$CURUSER/Library/LaunchAgents/com.jdibackup.JustCloud.notify.plist
/Users/\$CURUSER/Library/LaunchAgents/com.mackeeper.MacKeeper.Helper.plist
/Users/\$CURUSER/Library/Logs/JustCloud
/Users/\$CURUSER/Library/Logs/MacKeeper.log
/Users/\$CURUSER/Library/Logs/MacKeeper.log.signed
/Users/\$CURUSER/Library/Logs/SparkleUpdateLog.log
/Users/\$CURUSER/Library/Preferences/.3246584E-0CF8-4153-835D-C7D952862F9D
/Users/\$CURUSER/Library/Preferences/com.zeobit.MacKeeper.Helper.plist
/Users/\$CURUSER/Library/Preferences/com.zeobit.MacKeeper.plist
/Users/\$CURUSER/Library/Preferences/com.mackeeper.MacKeeper.Helper.plist
/Users/\$CURUSER/Library/Preferences/com.mackeeper.MacKeeper.plist
/Users/\$CURUSER/Library/Saved\ Application\ State/com.zeobit.MacKeeper.savedState
/Users/\$CURUSER/Downloads/MacKeeper*
/Users/\$CURUSER/Documents/MacKeeper*
)
#################
### Functions ###
#################
function deleteItems()
{
for item in "\${systemItems[@]}"
do
if [[ ! -z "\${2}" ]]
then
item=("\${2}""\${item}")
fi
if [ -e "\${item}" ]
then
echo "Removing \$item" | logger -t MacKeeperKiller
rm -rf "\${item}"
fi
var=0
done
exit 0
}
function unloadMacKeeper()
{
launchctl unload /Library/LaunchDaemons/com.mackeeper.Cerberus.plist
sleep 1
launchctl unload /Library/LaunchDaemons/com.mackeeper.MacKeeper.MacKeeperPrivilegedHelper.plist
sleep 1
sudo -u \$CURUSER launchctl unload ~/Library/LaunchAgents/com.mackeeper.MacKeeper.Helper.plist
sleep 1
}
####################
### Main Program ###
####################
for item in "\${systemItems[@]}"
do
if [[ ! -z "\${2}" ]]
then
item=("\${2}""\${item}")
fi
if [ -e \$item ]; then
unloadMacKeeper
deleteItems
else
var=1
echo MacKeeper not found | logger -t MacKeeperKiller
exit 0
fi
done
EOF
chmod +x /usr/local/bin/mackeeperKiller
sudo launchctl load -w /Library/LaunchDaemons/com.copiousit.mackeeperkiller.plist
exit 0