-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabconfig-apps-cleanup
135 lines (121 loc) · 3.32 KB
/
labconfig-apps-cleanup
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
######
#
# Date: Mon 6 Aug 2018 10:21:31 BST
# Version: 0.2
# Author: dsavage
#
######
Clean_Apps="App Store.app
Automator.app
Calculator.app
Calendar.app
Chess.app
Contacts.app
DVD Player.app
Dashboard.app
Dictionary.app
FaceTime.app
Font Book.app
Home.app
Image Capture.app
Install macOS High Sierra.app
Launchpad.app
Mail.app
Maps.app
Messages.app
Mission Control.app
News.app
Notes.app
Photo Booth.app
Photos.app
Preview.app
QuickTime Player.app
Reminders.app
Safari.app
Siri.app
Stickies.app
Stocks.app
System Preferences.app
TextEdit.app
Time Machine.app
Utilities
VoiceMemos.app
iBooks.app
iTunes.app
Self Service.app"
echo "$Clean_Apps" > /tmp/clean_apps.txt
# Clear out the apps
# Change the delimeter to a new line
oIFS="$IFS"
IFS=$'\n'
Apps_Installed=($(ls -1 /Applications))
echo "$Apps_Installed"
for application in "${Apps_Installed[@]}"; do
echo "$application"
if grep -q "$application" /tmp/clean_apps.txt; then
echo Application is an OS default, skipping.
else
#Have cases for apps that need special removal, for everything else just delete
case "$application" in
"Sophos Anti-Virus.app")
# Run Sophos' uninstall process to allow a clean version to be applied.
SophosInstaller=`find "/Library/Application Support/Sophos" -type d -name "InstallationDeployer"`
"${SophosInstaller}" --remove
# Scrub the autoupdate cache and lockfile
rm -f /Library/Caches/com.sophos.sau/CID/cidsync.upd
rm -f /Library/Caches/com.sophos.sau/sophosautoupdate.plist
rm -f /Library/Preferences/com.sophos.sau.plist.lockfile
sleep 1
rm -dfR /Library/Caches/com.sophos.sau
;;
Adobe*)
if [ "${application}" == "Adobe Acrobat Reader DC.app" ]; then
rm -dfR "/Applications/${application}"
rm -dfR "/Library/Internet Plug-Ins/AdobePDFViewer.plugin"
fi
if [ "${application}" == "Adobe Reader.app" ]; then
rm -dfR "/Applications/${application}"
rm -dfR "/Library/Internet Plug-Ins/AdobePDFViewer.plugin"
fi
# Possibly need https://helpx.adobe.com/uk/creative-cloud/kb/cc-cleaner-tool-installation-problems.html for CC apps
;;
Microsoft*)
if [ "${application}" == "Microsoft Silverlight" ]; then
rm -dfR "/Applications/${application}"
rm -dfR "/Library/Internet Plug-Ins/Silverlight.plugin"
fi
if [ "${application}" == "Microsoft Lync.app" ]; then
rm -dfR "/Applications/${application}"
fi
# Office can be upgraded in-place
;;
"Pro Tools.app")
# Do nothing for now.
;;
Sibelius*)
# Do nothing for now.
;;
Avid*)
# Do nothing for now.
;;
*)
rm -Rdf "/Applications/${application}"
;;
esac
fi
done
IFS="$oIFS"
# Delete Java
rm -fR "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin"
rm -fR "/Library/PreferencePanes/JavaControlPanel.prefPane"
# Delete any existing launchagents
rm -f /Library/LaunchAgents/*
# Delete any legacy startupitems
rm -dfR /Library/StartupItems/*
# uninstall haskell osx
rm -fR /Library/Frameworks/GHC.framework
rm -fR /Library/Frameworks/HaskellPlatform.framework
rm -fR /Library/Haskell
# Delete Internet plug-ins?
exit 0;