· 7 years ago · Jan 30, 2019, 06:24 PM
1#!/bin/sh
2# File Name: RemoveSymantecMacFiles.command
3 Version=7.0.61
4# Author: Corey Swertfager, Symantec Corporation
5# Created: 10/04/2001
6# Modified: 06/16/2017
7#
8# WARNING: This script will remove all files and folders created by
9# Symantec OS X products (except Symantec Adminstration Console
10# for Macintosh files) and any files within those folders.
11# Therefore, you will lose ALL files that reside in those folders,
12# including any that you have created.
13#
14# Usage: RemoveSymantecMacFiles.command [options] [volume ...]
15#
16# Summary: See ShowHelp() function.
17#
18# History: 5.00 - Ported code from version 4.27.
19# Now removes crontab entries from any OS X boot volume.
20# Now removes Symantec items from loginwindow.plist files.
21# Now removes receipts from any volume.
22# Now checks for Symantec kexts/processes in memory when
23# determining when a restart is necessary.
24# Added -f option to suppress output of removed files.
25# Now shows names of files as they are removed, unless the
26# -f option is specified.
27# 5.01 - Now removes:
28# /Library/Contextual Menu Items/SAVCMPlugIn.plugin
29# 5.02 - Adjusted output when a folder/file cannot be removed.
30# Removed warning when /Library/StartupItems remains.
31# Now removes:
32# /Library/Application Support/Symantec/Daemon/SymDaemon.bundle
33# /Library/Application Support/Symantec/Daemon
34# /Library/Application Support/Symantec/SymUIAgent
35# /Library/Application Support/Symantec/WebFraud
36# /Library/Contextual Menu Items/SymFileSecurityCM.plugin
37# /Library/PrivateFrameworks/SymAppKitAdditions.framework
38# /Library/PrivateFrameworks/SymBase.framework
39# /Library/PrivateFrameworks/SymConfidential.framework
40# /Library/PrivateFrameworks/SymSharedSettings.framework
41# /Library/Receipts/SymConfidential.pkg
42# /Library/Receipts/SymFileSecurity.pkg
43# /Library/Receipts/SymSharedFrameworks.pkg
44# /Library/Receipts/SymSharedSettings.pkg
45# /private/etc/mach_init.d/SymSharedSettings.plist
46# 5.03 - Now removes:
47# /Applications/Norton Confidential.app
48# /Library/Application Support/Symantec/IntrusionPrevention
49# /Library/LaunchDaemons/com.symantec.symdaemon.plist
50# /Library/LaunchDaemons/com.symantec.uiagent.bundle
51# /Library/PrivateFrameworks/SymDaemon.framework
52# /Library/PrivateFrameworks/SymInternetSecurity.framework
53# /Library/PrivateFrameworks/SymUIAgent.framework
54# /Library/PrivateFrameworks/SymUIAgentUI.framework
55# /Library/Receipts/SymConfidentialData.pkg
56# /Library/Receipts/SymDaemon.pkg
57# /Library/Receipts/SymFileSecurity.pkg
58# /Library/Receipts/SymInternetSecurity.pkg
59# /Library/Receipts/SymIntrusionPrevention.pkg
60# /Library/Receipts/SymNCOApplication.pkg
61# /Library/Receipts/SymUIAgent.pkg
62# /Library/Receipts/SymWebFraud.pkg
63# /Library/Receipts/WCIDEngine.pkg
64# /System/Library/Extensions/SymInternetSecurity.kext
65# /System/Library/Extensions/SymIPS.kext
66# /System/Library/SymInternetSecurity.kext
67# 5.04 - Now removes:
68# /Applications/Firefox.app/Contents/MacOS/extensions/{0e10f3d7-07f6-4f12-97b9-9b27e07139a5}
69# /Library/Application Support/Symantec/Assistants/Norton Confidential
70# /Library/Application Support/Symantec/Assistants/Symantec Setup Assistant.app
71# /Library/Application Support/Symantec/Assistants/Symantec Setup Assistant.bundle
72# /Library/Application Support/Symantec/Assistants
73# /Library/Receipts/SymSetupAssistant.pkg
74# 5.05 - Now removes:
75# /Library/Preferences/com.symantec.sharedsettings
76# 5.06 - Now removes:
77# /Library/Application Support/Symantec/Settings
78# 5.07 - Now removes:
79# /Library/LaunchDaemons/com.symantec.uiagent.plist
80# 5.08 - Now removes:
81# */Library/Preferences/com.symantec.uninstaller.plist
82# 5.09 - Now only removes when empty:
83# /Library/Application Support/Symantec/Assistants
84# /Library/Application Support/Symantec/Daemon
85# 5.10 - Now removes:
86# /Library/Application Support/Symantec/Daemon/error.log
87# Added volume name to paths in progress.
88# 5.11 - Now removes:
89# /Applications/Firefox.app/Contents/MacOS/extensions/{29dd9c80-9ea1-4aaf-9305-a0314aba24e3}
90# 5.12 - Now removes:
91# /private/var/tmp/com.symantec.liveupdate.*
92# 5.13 - OSXvnc StartupItems are now filtered out during Symantec
93# process checking.
94# 5.14 - Modified for OS 10.5 compatibility.
95# No longer removes empty /Library/StartupItems.
96# Now removes:
97# /Library/InputManagers/Norton Confidential for Safari
98# Now removes files installed by NAV 11 build 1.
99# 5.15 - Now removes:
100# /.symSchedScanLockxz
101# RemoveInvisibleFilesFromVolume functions now removes:
102# /.SymAVQSFile
103# Added DeleteLaunchdPlists function to remove Symantec
104# Scheduler launchd plists.
105# Added messaging when there are no Symantec crontab
106# entries to delete.
107# Renamed Remove function to RemoveItem.
108# RemoveItem function can now match several files.
109# Now removes additional files installed by NAV 11.
110# A list of files deleted by this program is now appended
111# to ReadMe.txt.
112# All com.symantec.* preferences are now shown when using
113# the -L option to show all files that would be deleted.
114# 5.16 - Now removes:
115# */Library/Preferences/com.symantec.nortonantivirus.*
116# */Library/Preferences/com.symantec.nortonconfidential.*
117# */Library/Preferences/com.symantec.schedScanResults*
118# */Library/Preferences/com.symantec.symsched*
119# 5.17 - Adjusted grep filters in SymantecIsInMemory function.
120# Now removes:
121# /Applications/Norton AntiVirus.app
122# 5.18 - Changed how ShowVersion is called for OS 10.5 compatibility.
123# 5.19 - Now removes:
124# /Library/Internet Plug-Ins/Norton Confidential for Safari.plugin
125# 5.20 - Now removes:
126# /Library/Receipts/SymantecAVDefs*
127# /private/tmp/com.symantec.liveupdate.restart
128# 5.21 - Added output to DeleteSymantecLoginItems function.
129# Revised output of -l and -L options.
130# Now removes:
131# /Library/Receipts/SymStuffit.pkg
132# 5.22 - Now removes:
133# /Library/Application Support/Symantec/Protector
134# /Library/Receipts/SymProtector.pkg
135# /Library/StartupItems/SymProtector
136# 5.23 - Now removes:
137# /Library/Receipts/SavLog.pkg
138# 5.24 - Changed the assignment order of CRONDIR to account for
139# cases where OS 10.5 was installed over OS 10.4.
140# 5.25 - Now removes:
141# */Library/Preferences/com.Symantec.SAVX.*
142# 5.26 - Now removes:
143# /Library/Application Support/Symantec/Assistants/Client Firewall
144# /Library/Application Support/Symantec/Assistants/SCF Assistant Startup.app
145# /Library/Application Support/Symantec/DeepSight
146# /Library/Application Support/Symantec/Firewall
147# /Library/LaunchDaemons/com.symantec.deepsight-extractor.plist
148# /Library/LaunchDaemons/com.symantec.npfbootstrap.plist
149# /Library/PrivateFrameworks/SymFirewall.framework
150# /Library/PrivateFrameworks/SymPersonalFirewall.framework
151# /System/Library/Extensions/SymPersonalFirewall.kext
152# /usr/bin/scfx
153# 5.27 - Now removes:
154# /Library/Application Support/Symantec/Daemon/debug.log
155# /Library/Receipts/SymantecClientFirewall.pkg
156# /Library/Receipts/SymFirewall.pkg
157# /Library/Receipts/SymPersonalFirewallCore.pkg
158# 5.28 - Now removes:
159# /Library/Application Support/Symantec/Assistants/Norton Firewall
160# /Library/Application Support/Symantec/Assistants/NPF Assistant Startup.app
161# /Library/Receipts/NortonFirewall.pkg
162# /Library/Receipts/SymPersonalFirewallUI.pkg
163# /usr/bin/npfx
164# 5.29 - Added ReceiptsTable variable and RunPredeleteScripts
165# function to incorporate the running of predelete scripts.
166# Added -e option to show predelete errors.
167# 5.30 - Now removes:
168# /Library/Application Support/Symantec/Assistants/NIS Assistant Startup.app
169# /Library/Application Support/Symantec/Assistants/Norton Internet Security
170# /Library/Receipts/NortonInternetSecurity.pkg
171# 5.31 - Now removes temporary files used by this program.
172# Added running of pre_delete scripts to RunPredeleteScripts functions.
173# 5.32 - Adjusted DeleteSymantecLoginItems diff filtering.
174# 5.33 - Now removes:
175# /private/tmp/symask
176# 5.34 - Now removes:
177# /Library/LaunchDaemons/com.symantec*
178# /Library/Preferences/com.symantec*
179# [except com.symantec.sacm* and com.symantec.smac*]
180# {each user's home directory}/Library/Preferences/com.symantec*
181# [except com.symantec.sacm* and com.symantec.smac*]
182# {each user's home directory}/Library/Preferences/Network/com.symantec*
183# /Library/Preferences/Network/com.symantec*
184# Added -x option to RemoveItem function.
185# RemoveItem function now ignores letter case when a
186# pattern or an exclusion is passed.
187# Links in /Volumes are now ignored.
188# 5.35 - Removed return statement that caused premature script end.
189# 5.36 - Now removes items installed by NFS 100.001:
190# /Library/Application Support/Symantec/Norton Family Safety
191# /Library/Internet Plug-Ins/Norton Family Safety.plugin
192# /Library/PreferencePanes/Norton Family Safety.prefPane
193# /Library/Receipts/NFSCore.pkg
194# 5.37 - Revised pattern to find Symantec processes.
195# Now removes all Dev.pkg receipts.
196# 5.38 - Now removes items installed by NSM 100.008:
197# /Library/Application Support/Symantec/Norton Safety Minder
198# /Library/Internet Plug-Ins/Norton Safety Minder.plugin
199# /Library/PreferencePanes/Norton Safety Minder.prefPane
200# /Library/PreferencePanes/Ribbon.Norton.prefPane
201# /Library/Receipts/NSMCore.pkg
202# 5.39 - Now removes:
203# /Library/Caches/com.symantec*
204# /Library/Caches/Norton*
205# /Library/Caches/Symantec*
206# /Library/Logs/Norton*
207# /Library/Logs/Symantec*
208# /Library/Logs/SymDeepsight*
209# /Library/Logs/SymFWLog.log
210# /Library/Logs/SymFWRules.log*
211# /Library/Preferences/wcid
212# /private/var/tmp/com.symantec*
213# {each user's home directory}/Library/Caches/com.symantec*
214# {each user's home directory}/Library/Caches/Norton*
215# {each user's home directory}/Library/Caches/Symantec*
216# {each user's home directory}/Library/Preferences/wcid
217# 5.40 - Fixed an erroneous "invalid password" error message.
218# Non-removal of /opt is no longer considered an error
219# (some third party programs install files into there).
220# 5.41 - Updated Usage(s) comments.
221# 5.42 - Now removes:
222# /Library/PrivateFrameworks/SymWebKitUtils.framework
223# 5.43 - Now removes:
224# /Library/InputManagers/Norton Safety Minder
225# 5.44 - Now removes:
226# /var/db/receipts/com.symantec*
227# 5.45 - Now removes if empty folder:
228# /Library/Preferences/Network
229# Now removes:
230# /Applications/Firefox.app/Contents/MacOS/extensions/nortonsafetyminder@symantec.com
231# 5.46 - Added -d option.
232# Updated help.
233# 5.47 - Added running of predelete scripts stored in new Symantec
234# Uninstaller's Receipt folder.
235# Now removes:
236# /Library/Application Support/Symantec/Uninstaller
237# Added -Q and -QQ options.
238# Added KillTerminal function.
239# 5.48 - Restart prompt is now shown any time boot volume is checked
240# and there are Symantec processes and/or kexts in memory,
241# except when -l or -L is passed.
242# Now removes:
243# /Library/Application Support/Symantec/Registry
244# /Library/Application Support/Symantec/Submissions
245# /Library/Application Support/Symantec/SymWebKitUtils
246# /Library/PrivateFrameworks/SymSubmission.framework
247# /Library/Receipts/SymSubmission.pkg
248# /Library/Receipts/SymWebKitUtils.pkg
249# Now removes /Library/PrivateFrameworks/SymWebKitUtils.framework
250# only if the framework does not contain SymWKULoader.dylib; its
251# receipt is removed if SymWKULoader.dylib does not exist or if
252# /Library/StartupItems/CleanUpSymWebKitUtils exists.
253# 5.49 - Excluded /LiveUpdateAdminUtility/ from processes to find in
254# SymantecIsInMemory function.
255# 5.50 - Fixed RunPredeleteScripts function so that it runs more than
256# just the first predelete script in Symantec Uninstaller's
257# Receipts folder and allows for multiple predelete scripts in
258# /Library/Receipts receipts.
259# Now removes:
260# /Library/InputManagers/SymWebKitUtils
261# /Library/StartupItems/SymQuickMenuOSFix
262# /Library/StartupItems/SymWebKitUtilsOSFix
263# Restart prompt is now shown if CleanUpSymWebKitUtils exists in
264# /Library/StartupItems.
265# Running ofLiveUpdate.pkg predelete script is no longer skipped.
266# 5.51 - Now removes:
267# /Library/Application Support/Symantec/SEP
268# /Library/Application Support/Symantec/SMC
269# /Library/Application Support/Symantec/SNAC
270# /Library/LaunchAgents/com.symantec*
271# /Library/Receipts/SMC.pkg
272# /Library/Receipts/SNAC.pkg
273# /Library/Receipts/Symantec Endpoint Protection.pkg
274# /Library/Receipts/SymantecSAQuickMenu.pkg
275# /Library/Services/ScanService.service
276# /Library/Services [deleted if empty]
277# /Library/StartupItems/SMC
278# /usr/lib/libsymsea.1.0.0.dylib
279# /usr/lib/libsymsea.dylib
280# Adjusted RunPredeleteScripts function to limit predelete script
281# names to those ending with predelete or pre_delete; doing so
282# prevents a bus error by no longer running "predeletetool".
283# 5.52 - Added -m option to use more program when -l, -L, or -R
284# options are used.
285# Removed -r option, which deleted only receipts.
286# Added -R option to include folder contents when showing
287# installed files.
288# Progress shown when using the -l, -L, or -R options is
289# now sent to standard error to facilitate piping the
290# generated report to a file without piping progress.
291# 5.53 - Now removes:
292# /Library/ScriptingAdditions/SymWebKitUtils.osax
293# /Library/ScriptingAdditions/SymWebKitUtilsSL.osax
294# /usr/local/lib/libgecko3parsers.dylib
295# /usr/local/lib [deleted if empty]
296# /usr/local [deleted if empty]
297# 5.54 - Now removes:
298# /private/var/db/receipts/com.symantec*
299# 5.55 - Now removes:
300# /Library/Receipts/LiveUpdate*
301# /Library/Application Support/Symantec/AntiVirus.kextcache
302# RunPredeleteScripts function now also runs predelete scripts for
303# receipts in ReceiptsTable that pass option -a.
304# 5.56 - Now removes:
305# /private/tmp/jlulogtemp
306# /private/tmp/LiveUpdate.*
307# /private/tmp/liveupdate
308# /private/tmp/lulogtemp
309# /private/tmp/SymSharedFrameworks*
310# /private/var/db/receipts/$(SYM_SKU_REVDOMAIN).install.bom
311# /private/var/db/receipts/$(SYM_SKU_REVDOMAIN).install.plist
312# /private/var/tmp/com.Symantec*
313# 5.57 - Now removes:
314# /Library/Application Support/nis_postuninstall.rb
315# /Library/Application Support/nis_postuninstall.sh
316# 5.58 - Now removes:
317# /Library/Receipts/NSMCore.Universal.pkg
318# 5.59 - Now removes:
319# /Applications/Norton DNS Beta.app
320# /Applications/Norton DNS.app
321# /Library/Application Support/Symantec/Norton DNS
322# /Library/LaunchDaemons/com.norton
323# /private/var/log/nortondns.log
324# {each user's home directory}/Library/Caches/com.norton
325# {each user's home directory}/Library/Preferences/com.norton
326# 5.60 - Now removes:
327# /Library/Preferences/com.norton*
328# {each user's home directory}/Library/Preferences/com.norton*
329# The following removals were added in version 5.59, but the version
330# history erroneously left off the trailing *:
331# /Library/LaunchDaemons/com.norton*
332# {each user's home directory}/Library/Caches/com.norton*
333# The following removal were added in version 5.59, but the version
334# history erroneously omitted its addition:
335# /Library/Caches/com.norton*
336# 5.61 - Removed CurrentUserTempFile/ProcessArgumentsCalled.
337# 5.62 - Modified for case-sensitive volume compatibility.
338# Now removes (based on NIS 5.0 builds 8-12 boms):
339# /Library/Application Support/Symantec/ErrorReporting
340# /Library/PrivateFrameworks/SymLicensing.framework
341# /Library/Receipts/NAV_App*
342# /Library/Receipts/NAV_AutoProtect*
343# /Library/Receipts/NortonFirewall*
344# /Library/Receipts/NortonInternetSecurity*
345# /Library/Receipts/NortonQuickMenu*
346# /Library/Receipts/SymantecSharedComponents*
347# /Library/Receipts/SymantecUninstaller*
348# /Library/Receipts/SymConfidential*
349# /Library/Receipts/SymDaemon*
350# /Library/Receipts/SymErrorReporting.pkg
351# /Library/Receipts/SymFileSecurity*
352# /Library/Receipts/SymFirewall*
353# /Library/Receipts/SymIntrusionPrevention*
354# /Library/Receipts/SymNCOApplication*
355# /Library/Receipts/SymPersonalFirewallCore*
356# /Library/Receipts/SymPersonalFirewallUI*
357# /Library/Receipts/SymPseudoLicensing*
358# /Library/Receipts/SymSetupAssistant*
359# /Library/Receipts/SymSharedFrameworks*
360# /Library/Receipts/SymSharedSettings*
361# /Library/Receipts/SymUIAgent*
362# /Library/Receipts/SymWebFraud*
363# /Library/Services/SymSafeWeb.service
364# /usr/bin/MigrateQTF
365# 5.63 - Now removes:
366# /usr/local/lib/libecomlodr.dylib
367# 5.64 - Updated DeleteCrontabEntries to delete entries from both
368# OS 10.4 and OS 10.5 crontab directories.
369# 5.65 - Updated for NAV 12/NIS 5.
370# 5.66 - Added check for launch location to suppress screen clearing, prompts,
371# and quit message ("NOTE: If you double-clicked this script, quit Terminal
372# application now.") when running from within app bundle or in support folder.
373# Now removes:
374# /Library/Receipts/SymLicensing*
375# 5.67 - Fixed "[: too many arguments" error.
376# 5.68 - Now removes in all versions:
377# /Library/Application Support/Symantec/Daemon/timer
378# /Library/Application Support/Symantec/Licensing
379# 5.69 - Now removes:
380# /Preferences/ByHost/com.symantec*
381# {each user's home directory}/Preferences/ByHost/com.symantec*
382# 5.70 - Now removes:
383# /Library/Application Support/Symantec/Daemon/timer.log
384# 6.0.0 - 09/01/2011:
385# Now designates when Symantec Uninstaller.app should not
386# remove an item when using the -l or -R options.
387# The -l and -R options are now equivalent.
388# 6.0.1 - 09/11/2011:
389# Updated file list.
390# 6.0.2 - 09/16/2011:
391# Updated file list.
392# 6.0.3 - 10/07/2011:
393# Now removes:
394# /Library/Application Support/nav_postuninstall.rb
395# /Library/Application Support/nsm_postuninstall.rb
396# /Library/Application Support/o2spy.log
397# /Library/Application Support/Symantec/NortonM
398# /Library/PrivateFrameworks/PlausibleDatabase.framework
399# /Library/PrivateFrameworks/SymOxygen.framework
400# 6.0.4 - 11/08/2011:
401# Now removes:
402# /Library/Application Support/nav_uninstalldashboard*
403# /Library/Application Support/symantec_uninstalldashboard*
404# 6.0.5 - 11/17/2011:
405# Now removes:
406# /Library/Application Support/Symantec/SymSAQuickMenu
407# 6.0.6 - 12/06/2011:
408# Now removes:
409# /Library/PrivilegedHelperTools/NATRemoteLock.app
410# /Library/Receipts/NATRemoteLock.pkg
411# /Library/Receipts/NATSDPlugin.pkg
412# /Library/Receipts/nortonantitheftPostflight.pkg
413# /Library/Receipts/PredeleteTool.pkg
414# /Library/Receipts/SymOxygen.pkg
415# /usr/lib/libwpsapi.dylib
416# 6.0.7 - 12/14/2011:
417# Now removes:
418# /Library/Receipts/nortonanti-theftPostflight.pkg
419# /private/var/db/NATSqlDatabase.db
420# 6.0.8 - 02/28/2012:
421# Now removes:
422# /private/tmp/com.symantec.liveupdate.reboot
423# 6.0.9 - 03/30/2012:
424# Now removes:
425# /private/var/db/receipts/com.Symantec*
426# 6.0.10 - 06/19/2012 - Corey Swertfager:
427# Now removes:
428# /Applications/Norton Zone*
429# /Library/Application Support/nav_uninstalldashboard*
430# /Library/Application Support/symantec_uninstalldashboard*
431# /Library/Caches/com.apple.Safari/Extensions/Norton*
432# /Library/Caches/com.apple.Safari/Extensions/Symantec*
433# /Library/Internet Plug-Ins/NortonSafetyMinderBF.plugin
434# /Library/Preferences/Norton Zone
435# /Library/Receipts/ZoneStandalone.pkg
436# {each user's home directory}/Library/Caches/com.apple.Safari/Extensions/Norton*
437# {each user's home directory}/Library/Caches/com.apple.Safari/Extensions/Symantec*
438# {each user's home directory}/Library/Preferences/Norton Zone
439# Now actually removes (added missing quotes to RemoveItem calls):
440# /Library/Application Support/nav_uninstalldashboard*
441# /Library/Application Support/symantec_uninstalldashboard*
442# 6.0.11 - 06/19/2012 - Corey Swertfager:
443# Now removes:
444# /Library/Application Support/NortonZone
445# {each user's home directory}/Library/Application Support/NortonZone
446# 6.0.12 - 07/06/2012 - Corey Swertfager:
447# * Modified grep calls with regular expressions that contain pattern "$\|"
448# to instead use extended regular expression "$|" for OS 10.8 compatibility,
449# fixing the problem of predelete scripts not being run on OS 10.8.
450# * Now removes:
451# /usr/local/bin/KeyGenerator
452# 6.0.13 - 08/03/2012 - Corey Swertfager:
453# * Now removes:
454# /Library/Application Support/Symantec/Mexico
455# /Library/Frameworks/mach_inject_bundle.framework
456# 6.0.14 - 08/27/2012 - Corey Swertfager:
457# * Now removes Norton Zone saved sessions.
458# 6.0.15 - 08/31/2012 - Corey Swertfager:
459# * Removed logic that attempted to remove:
460# {each user's home directory}/Library/Norton Zone
461# 6.0.16 - 10/08/2012 - Corey Swertfager:
462# * Now removes:
463# {each user's home directory}/Library/Application Support/Symantec
464# /Library/Internet Plug-Ins/NortonInternetSecurityBF.plugin
465# * Now makes a second attempt to remove:
466# /Library/Application Support/Symantec/ErrorReporting
467# /Library/Application Support/Symantec [deleted if empty]
468# 6.0.17 - 10/11/2012 - Corey Swertfager:
469# Now removes:
470# /Library/Application Support/Symantec/NisLaunch
471# 6.0.18 - 10/19/2012 - Corey Swertfager:
472# Now removes:
473# {each user's home directory}/Library/Safari/Extensions/NortonSafetyMinderBF*
474# 6.0.19 - 03/12/2013 - Corey Swertfager:
475# * Now removes:
476# /Library/Application Support/Symantec/Daemon [deleted whether empty or not]
477# /Library/PrivilegedHelperTools/com.symantec*
478# * Added KillNortonZone function.
479# * Added watermark ID.
480# 6.0.20 - 03/15/2013 - Corey Swertfager:
481# * Now removes Norton Zone from loginwindow.plist files.
482# * Revamped DeleteSymantecLoginItems function to account
483# for varying key values.
484# * KillNortonZone function now only runs killall Finder
485# if Norton Zone process was killed.
486# 6.0.21 - 04/26/2013 - Corey Swertfager:
487# * Now removes:
488# /Library/Application Support/Symantec/Silo
489# /usr/local/bin/MigrateQTF
490# /usr/local/bin [deleted if empty]
491# 6.0.22 - 05/10/2013 - Corey Swertfager:
492# * Now removes:
493# /var/log/luxtool.log*
494# 6.0.23 - 05/14/2013 - Corey Swertfager:
495# * Now removes:
496# /var/log/mexd.log
497# 6.0.24 - 05/28/2013 - Corey Swertfager:
498# * Now removes:
499# /Library/Application Support/nat_*
500# /Library/Application Support/nav_*
501# /Library/Application Support/nis_*
502# /Library/Application Support/nsm_*
503# /Library/Application Support/norton_*
504# /Library/Application Support/Symantec/Norton Anti-Theft
505# /usr/local/bin/CoreLocationProviderTest
506# /usr/local/bin/LocationProviderInterfaceTest
507# /usr/local/bin/LocationProviderTest
508# /usr/local/bin/SkyhookProviderTest
509# 6.0.25 - 05/28/2013 - Corey Swertfager:
510# * Now removes:
511# /Applications/Norton *
512# /predelete (installed by Norton Anti-Theft)
513# {each user's home directory}/Application Support/Symantec
514# {each user's home directory}/Application Support [deleted if empty]
515# 6.1.0 - 06/28/2013 - Corey Swertfager:
516# * ProcessArguments 1.0.1 is now used to process arguments to allow
517# options to be combined in one argument that begins with a single
518# hyphen (e.g., passing -ab to script would be equivalent to passing
519# -a and -b separately; --ab would be treated as a single option).
520# The -QQ and -re remain separate arguments for backwards compatibility.
521# * Added -r option to restart automatically (equivalent to deprecated
522# -re option).
523# * Now removes, even when not empty:
524# /Library/Application Support/Symantec
525# * Now removes:
526# /Applications/GatherSymantecInfo
527# /Library/Application Support/Norton*
528# /private/var/tmp/symantec_error_report*
529# /usr/local/lib/libcx_lib.so
530# /usr/local/lib/liblux.so.1
531# /usr/local/lib/libnlucallback.dylib
532# {each user's home directory}/Library/Application Support/Norton*
533# {each user's home directory}/Library/Saved Application State/com.symantec*
534# * Now removes Symantec Administration Console for Macintosh files.
535# * Updated help: changed "Administration Console for Macintosh" to
536# "Endpoint Protection".
537# 6.1.1 - 07/10/2013 - Corey Swertfager:
538# * Now removes:
539# {each user's home directory}/Library/Logs/Symantec*
540# 6.1.2 - 07/11/2013 - Corey Swertfager:
541# * Now removes:
542# /usr/local/lib/liblux.so.*
543# 6.1.3 - 07/14/2013 - Corey Swertfager:
544# * Updated ReadMe.txt.
545# * Now removes:
546# {each user's home directory}/Library/Safari/Extensions/Norton*
547# 7.0.0 - 07/19/2013 - Corey Swertfager:
548# * Now removes:
549# /private/etc/symantec
550# /var/log/lux.log*
551# * Updated version to make sure tools updater finds this program.
552# 7.0.1 - 08/19/2013 - Corey Swertfager:
553# * Now removes:
554# /var/log/du.log*
555# /var/log/dulux.log*
556# /var/log/lut.log*
557# /var/log/mexd.log*
558# /var/log/microdef.log*
559# * Now removes logs listed in:
560# /Library/Application Support/Symantec/Silo/NFM/LiveUpdate/Conf
561# /private/etc/symantec/defutils.conf
562# /private/etc/symantec/dulux.logging.conf
563# /private/etc/symantec/lux.logging.conf
564# /private/etc/symantec/microdef.logging.conf
565# 7.0.2 - 09/05/2013 - Corey Swertfager:
566# * Now removes:
567# /Library/Extensions/FileSecurity.kext
568# /Library/Extensions/SymAPComm.kext
569# /Library/Extensions/SymFirewall.kext
570# /Library/Extensions/SymInternetSecurity.kext
571# /Library/Extensions/SymIPS.kext
572# /Library/Extensions/SymPersonalFirewall.kext
573# 7.0.3 - 09/05/2013 - Corey Swertfager:
574# * Updated for NIS 6.
575# 7.0.4 - 10/15/2013 - Corey Swertfager:
576# * Now removes for all versions:
577# /Library/Extensions/ndcengine.kext
578# /Library/Extensions/NortonForMac.kext
579# /Library/PrivateFrameworks/SymSEP.framework
580# /System/Library/Extensions/ndcengine.kext
581# /System/Library/Extensions/NortonForMac.kext
582# /usr/bin/nortonscanner
583# /usr/bin/nortonsettings
584# /usr/lib/libsymsea.*dylib
585# /usr/local/bin/nortonsettings
586# /var/root/Applications/Norton Internet Security.app
587# 7.0.5 - 10/28/2013 - Corey Swertfager:
588# * Updated read me.
589# 7.0.6 - 11/05/2013 - Corey Swertfager:
590# * Updated read me.
591# 7.0.7 - 12/03/2013 - Corey Swertfager:
592# * Now removes:
593# /Library/Logs/o2spy.log
594# 7.0.8 - 12/10/2013 - Corey Swertfager:
595# * Now removes com.norton.NFM.auth from login keychains.
596# * Renamed RemoveNortonZoneSavedSessions function to
597# RemoveLoginKeychainPasswords.
598# 7.0.9 - 12/31/2013 - Corey Swertfager:
599# * Added -F option to show only regular files installed.
600# * Now removes:
601# /Library/Internet Plug-Ins/NortonFamilyBF.plugin
602# 7.0.10 - 01/15/2014 - Corey Swertfager:
603# * Now removes:
604# /Library/Application Support/regid.1992-12.com.symantec*
605# 7.0.11 - 02/22/2014 - Corey Swertfager:
606# * Now removes:
607# /Library/Logs/SymDebugLeaks.log
608# /Library/Logs/SymFWDeepSightTrie.txt
609# /Library/Logs/SymHTTPSubmissions.txt
610# /Library/Logs/SymInstall.log
611# /Library/Logs/SymSharedSettingsd.log
612# /Library/Logs/SymUninstall.log
613# {each user's home directory}/Library/Logs/SymDebugLeaks.log
614# {each user's home directory}/Library/Logs/SymFWDeepSightTrie.txt
615# {each user's home directory}/Library/Logs/SymHTTPSubmissions.txt
616# {each user's home directory}/Library/Logs/SymInstall.log
617# {each user's home directory}/Library/Logs/SymSharedSettingsd.log
618# {each user's home directory}/Library/Logs/SymUninstall.log
619# * Now flags paths that contain "/com.symantec.errorreporting." or
620# "/private/etc/liveupdate.conf" as items that are not removed by
621# NIS 6 uninstaller.
622# 7.0.12 - 05/02/2014 - Corey Swertfager:
623# * Updated for NIS 6.1.
624# 7.0.13 - 05/02/2014 - Corey Swertfager:
625# * Updated for NIS 6.1.
626# 7.0.14 - 05/16/2014 - Corey Swertfager:
627# * Now removes:
628# /private/tmp/O2Spy.log
629# 7.0.15 - 06/03/2014 - Corey Swertfager:
630# * Now removes:
631# /Library/Logs/LUTool.txt
632# /Library/Logs/SymOxygen*
633# * Updated the way items in /etc, /tmp, and /var are removed to
634# address Etrack incident 3524977.
635# 7.0.16 - 06/19/2014 - Corey Swertfager:
636# * Now verifies that all programs that this program uses are installed
637# before attempting to run (Etrack 3539262). See RequiredPrograms below.
638# * Now verifies results of sed commands are not null before using them.
639# * DeleteSymantecLoginItems function now skips attempt to remove items
640# from loginwindow.plist files if plutil is not installed when running
641# Mac OS 10.4 or later.
642# * Now flags the following as not removed by Symantec Uninstaller (Etrack 3449908):
643# {each user's home directory}/Library/Saved Application State/com.symantec*
644# 7.0.17 - 06/20/2014 - Corey Swertfager:
645# * Updated for NIS 6.1.
646# 7.0.18 - 07/02/2014 - Corey Swertfager:
647# * Now removes:
648# /Library/Services/Norton for Mac.service
649# * Now exits with 0 instead of 2 when there is a file or folder that
650# could not be removed.
651# 7.0.19 - 07/24/2014 - Corey Swertfager:
652# * Added KillSymantecProcesses function version 1.0.1.
653# * To address Etrack 3442959, KillSymantecProcesses is called after predelete
654# scripts are run before removing files from the boot volume; it is also called
655# before the attempt to remove "/Library/Application Support/Symantec" again
656# after all other files have been removed.
657# * Updated SymantecIsInMemory function.
658# 7.0.20 - 08/12/2014 - Corey Swertfager:
659# * Added GetComputerUsers function to obtain home directories.
660# * Added RemoveCrashReporterLogs function to remove logs located in:
661# /Library/Logs/CrashReporter
662# /Library/Logs/DiagnosticReports
663# {each user's home directory}/Library/Logs/CrashReporter
664# {each user's home directory}/Library/Logs/DiagnosticReports
665# 7.0.21 - 08/25/2014 - Corey Swertfager:
666# * Updated list of removed files in read me.
667# 7.0.22 - 08/27/2014 - Corey Swertfager:
668# * Replaced KillSymantecProcesses function with version 1.0.2.
669# * Added -k option to bypass killing of Symantec processes.
670# * Killing of Symantec processes is now bypassed if the name of this
671# program is listed in ListOfProgramsThatShouldNotKillProcesses variable.
672# 7.0.23 - 08/27/2014 - Corey Swertfager:
673# * Removal of items in {each user's home directory}/Library/Logs and
674# in /Library/Logs is now bypassed if the name of this program is listed
675# in ListOfProgramsThatShouldNotRemoveLogs variable or if -g is passed.
676# * Added -g option to bypass removal of items in /Library/Logs and in
677# {each user's home directory}/Library/Logs.
678# 7.0.24 - 08/28/2014 - Corey Swertfager:
679# * Removal of all non-CrashReporter logs in /Library/Logs and in
680# {each user's home directory}/Library/Logs is now handled by
681# RemoveFilesFromLibraryAndUserDirectories function.
682# 7.0.25 - 09/08/2014 - Corey Swertfager:
683# * Now removes ".fsd" folders within:
684# {each user's home directory}/Downloads
685# 7.0.26 - 12/03/2014 - Corey Swertfager:
686# * Now removes (Etrack 3676902):
687# {each user's home directory}/Library/LaunchAgents/com.symantec*
688# 7.0.27 - 12/08/2014 - Corey Swertfager:
689# * Added unloading of SymUIAgent to KillSymantecProcesses function.
690# 7.0.28 - 12/19/2014 - Corey Swertfager:
691# * Now removes (Etrack 3689824), based on SCS 7.0 build 14:
692# /Applications/Symantec Cloud Security.app
693# /Library/Services/Symantec Cloud Security.service
694# 7.0.29 - 01/12/2015 - Corey Swertfager:
695# * Now removes, based on SCS 7.0 build 25:
696# /usr/local/lib/libAPFeature.a
697# 7.0.30 - 01/13/2015 - Corey Swertfager:
698# * Updated help.
699# 7.0.31 - 02/09/2015 - Corey Swertfager:
700# * Updated help.
701# 7.0.32 - 03/23/2015 - Corey Swertfager:
702# * Updated DeleteSymantecLoginItems function to remove the
703# following login items (Etrack 3750842):
704# /Applications/Norton Internet Security.app
705# /Applications/Norton Security.app
706# /Applications/Symantec Cloud Security.app
707# * Now removes Symantec items from com.apple.loginitems.plist files.
708# * Now removes (Etrack 3738009):
709# {each user's home directory}/Library/Application Support/Firefox/Profiles/*/extensions/*@symantec.com.xpi
710# {each user's home directory}/Library/Safari/Extensions/Symantec*
711# * Now creates /private/tmp/com.symantec.cleanup.restart
712# (defined by variable SymantecCleanupRestartFile) whenever
713# login items have been removed or when some Symantec process
714# or kext remains in memory so that subsequent runs of this
715# program will show prompt to restart until computer is restarted.
716# * Now flags as should not be uninstalled (Etrack 3740028):
717# {each user's home directory}/Library/LaunchAgents/com.symantec.SCSInstaller.plist
718# 7.0.33 - 03/30/2015 - Corey Swertfager:
719# * Updated for SCS 7.
720# 7.0.34 - 04/24/2015 - Corey Swertfager:
721# * Now removes system profile com.symc.enroll (Etrack 3762326).
722# 7.0.35 - 05/07/2015 - Corey Swertfager:
723# * Added -u option to only output files that are installed that
724# should have been removed by the UI uninstaller (Etrack 3782491).
725# 7.0.36 - 07/01/2015 - Corey Swertfager:
726# * Now removes:
727# /usr/local/lib/libsymsea.*dylib
728# /usr/local/bin/nortonscanner
729# 7.0.37 - 07/07/2015 - Corey Swertfager:
730# * No longer removes when empty (Etrack 3817133):
731# /usr/local
732# 7.0.38 - 07/08/2015 - Corey Swertfager:
733# * Now removes:
734# /Applications/Symantec Unified Endpoint Protection.app
735# * Updated DeleteSymantecLoginItems function to remove the
736# following login item:
737# /Applications/Symantec Unified Endpoint Protection.app
738# 7.0.39 - 07/21/2015 - Corey Swertfager:
739# * Now removes (Etrack 3823367):
740# /Library/Application Support/Symantec_IPUA
741# * Updated RemoveCrashReporterLogs() function to remove
742# NFM* and .NFM* files (Etrack 3823960).
743# * Updated RemoveFilesFromLibraryAndUserDirectories() function
744# to remove SymBfw_NFM.log.
745# 7.0.40 - 08/05/2015 - Corey Swertfager:
746# * Now removes:
747# /Library/Services/Symantec*
748# 7.0.41 - 08/19/2015 - Corey Swertfager:
749# * Now removes:
750# /usr/local/bin/navx
751# 7.0.42 - 08/26/2015 - Corey Swertfager:
752# * Now removes (Etrack 3845478):
753# /Applications/Symantec Endpoint Protection.app
754# * No longer removes (Etrack 3845289):
755# /Library/LaunchDaemons/com.symantec.saturn.plist
756# * Updated RemoveItem() function: pattern passed to -x
757# is now treated as an extended regular expression.
758# 7.0.43 - 08/26/2015 - Corey Swertfager:
759# * Now excludes removal of the following (Etrack 3846279)
760# if the name of this program is listed in the variable
761# ListOfProgramsThatShouldNotRemoveInstallerLaunchAgents:
762# {each user's home directory}/Library/LaunchAgents/com.symantec.*Installer.plist
763# 7.0.44 - 10/14/2015 - Corey Swertfager:
764# * Now excludes removal of the following (Etrack 3858305):
765# /etc/symantec/saturn
766# * Now excludes removal of the following (Etrack 3864657)
767# if the name of this program is listed in the variable
768# ListOfProgramsThatShouldNotRemoveSymantecIPUA:
769# /Library/Application Support/Symantec_IPUA
770# * Now removes logs in:
771# /Library/Application Support/CrashReporter
772# /Library/Application Support/DiagnosticReports
773# {each user's home directory}/Library/Application Support/CrashReporter
774# {each user's home directory}/Library/Application Support/DiagnosticReports
775# * Now removes LUTool crash logs.
776# * Updated RemoveItem() function: added -d option.
777# 7.0.45 - 10/29/2015 - Corey Swertfager:
778# * Now removes:
779# /Library/Logs/SymInstall*
780# /Library/Logs/SymUninstall*
781# {each user's home directory}/Library/Logs/SymInstall*
782# {each user's home directory}/Library/Logs/SymUninstall*
783# 7.0.46 - 12/30/2015 - Corey Swertfager:
784# * Now flags the following as not removed by Symantec Uninstaller (Etrack 3882672):
785# */Library/Preferences/com.symantec.antivirus.special.plist
786# * No longer removes when this script is named SymantecRemovalTool (Etrack 3891031):
787# /Library/LaunchAgents/com.symantec.ipua.plist
788# /Library/Preferences/com.symantec.ipua.plist
789# {each user's home directory}/Library/LaunchAgents/com.symantec.ipua.plist
790# {each user's home directory}/Library/Preferences/com.symantec.ipua.plist
791# 7.0.47 - 01/25/2016 - Corey Swertfager:
792# * Now removes:
793# /usr/local/bin/npfx
794# * Changed "-depth 1" to "-mindepth 1 -maxdepth 1" in some
795# find calls.
796# * Removed duplicate lookups when only generating a list of
797# installed files of the following:
798# /Library/Application Support/Symantec
799# /Library/Application Support/Symantec/ErrorReporting
800# 7.0.48 - 03/23/2016 - Corey Swertfager:
801# * To avoid potential hangs, kextstat is no longer run (Etrack 3925328).
802# * Added FilesThatDoNotRequireRebootPattern variable to help determine
803# when a reboot is required in lieu of using kextstat (Etrack 3925328).
804# * Backs up some logs to /private/var/tmp/SymantecDiagnosticLogs prior
805# to deleting them if this program's name is not in listed in variable
806# ListOfProgramsThatShouldNotBackUpLogs (Etrack 3912399).
807# * Now removes:
808# /tmp/com.symantec.NFM.liveupdate.reboot
809# 7.0.49 - 05/02/2016 - Corey Swertfager:
810# * Now removes:
811# /Library/Logs/SymQual*
812# /Library/Logs/UIAgent*
813# {each user's home directory}/Library/Logs/SymQual*
814# {each user's home directory}/Library/Logs/UIAgent*
815# 7.0.50 - 08/02/2016 - Corey Swertfager:
816# * Now excludes removal of /var/db/receipts/com.symantec-it.*
817# (Etrack 3980221).
818# 7.0.51 - 09/06/2016 - Corey Swertfager:
819# * Now removes (Etrack 3968791):
820# /Library/Logs/SymCommP*
821# {each user's home directory}/Library/Logs/SymCommP*
822# 7.0.52 - 09/12/2016 - Corey Swertfager:
823# * Now removes (Etrack 3995440):
824# /Applications/Symantec Endpoint Protection Cloud.app
825# 7.0.53 - 10/20/2016 - Corey Swertfager:
826# * Updated help for -e option.
827# 7.0.54 - 02/01/2017 - Corey Swertfager:
828# * Removed Watermark for ftp zip posting.
829# 7.0.55 - 02/07/2017 - Corey Swertfager:
830# * Now removes (Etrack 4060698):
831# /Library/Extensions/SymXIPS.kext
832# /System/Library/Extensions/SymXIPS.kext
833# * Now removes Norton WiFi Privacy (NWP) files based on
834# clean_norton.sh.
835# 7.0.56 - 03/28/2017 - Corey Swertfager:
836# * Now removes IPUA logs (Etrack 4074658):
837# /Library/Logs/.ipuaint
838# /Library/Logs/.ipualog
839# /Library/Logs/SymaIpua*
840# /Library/Logs/SymIpua*
841# {each user's home directory}/Library/Logs/.ipuaint
842# {each user's home directory}/Library/Logs/.ipualog
843# {each user's home directory}/Library/Logs/SymaIpua*
844# {each user's home directory}/Library/Logs/SymIpua*
845# 7.0.57 - 03/30/2017 - Corey Swertfager:
846# * Updated DeleteSymantecLoginItems() function to remove the
847# following login items:
848# Norton AntiVirus
849# Norton WiFi Privacy
850# 7.0.58 - 04/12/2017 - Corey Swertfager:
851# * Adjusted pattern matching for -u option to fix an issue
852# where pattern with [ was treated as bracket expression.
853# 7.0.59 - 04/12/2017 - Corey Swertfager:
854# * Updated DeleteSymantecLoginItems() function to remove the
855# following login item:
856# Norton WiFi Privacy.app
857# * Updated DeleteSymantecLoginItems() function to address an
858# error on OS 10.7 where regular expression was too large.
859# 7.0.60 - 06/07/2017 - Corey Swertfager:
860# * Now removes:
861# /Library/Preferences/group.symantec*
862# {each user's home directory}/Library/Preferences/group.symantec*
863# 7.0.61 - 06/16/2017 - Corey Swertfager:
864# * Now removes (Etrack 4100691):
865# /Library/Preferences/group.com.symantec*
866# {each user's home directory}/Library/Preferences/group.com.symantec*
867
868# *** Variable Initializations ***
869
870PATH=/bin:/sbin:/usr/bin:/usr/sbin
871SymantecCleanupRestartFile="/private/tmp/com.symantec.cleanup.restart"
872AbbreviatedScriptName=`basename "$0" .command 2>/dev/null`
873AutoRunScript=false
874BackupLogLocationRootDirName="SymantecDiagnosticLogs"
875BackupLogLocationRootDir="/private/var/tmp/$BackupLogLocationRootDirName"
876CurrentVolumeBeingUsed="/"
877ExitCodeWhenSomeFileWasNotRemoved=0
878ExitCodeWhenFilesRemain=7
879# FilesThatDoNotRequireRebootPattern: paths that match this pattern will not trigger a reboot
880FilesThatDoNotRequireRebootPattern='\.log|\.txt|\.rtf|Caches/com.apple.helpd|/log/|/Logs/|/tmp/'
881FilesRemovedList="/private/tmp/${AbbreviatedScriptName}RemovesThese.txt"
882FilesRemovedFilesOnlyList="/private/tmp/${AbbreviatedScriptName}RemovesThese-FilesOnly.txt"
883FilesRemovedListOfOld="/Users/Shared/${AbbreviatedScriptName}RemovesThese.txt"
884FilesWereSaved=false
885FinishedExitCode=0
886FullScriptName=`basename "$0" 2>/dev/null`
887LANG=""
888LaunchLocationGrepPattern='/Library/Application Support/Symantec/Uninstaller\|\.app/Contents/Resources'
889# ----- ListOfProgramsThatShouldNotBackUpLogs BEGIN ------------------------------------------------
890ListOfProgramsThatShouldNotBackUpLogs="RemoveSymantecMacFiles.command
891SymantecRemovalTool
892SymantecRemovalTool.command"
893# ----- ListOfProgramsThatShouldNotBackUpLogs END --------------------------------------------------
894ListOfProgramsThatShouldNotKillProcesses="SymantecRemovalTool"
895ListOfProgramsThatShouldNotRemoveFSDFolders="SymantecRemovalTool"
896ListOfProgramsThatShouldNotRemoveInstallerLaunchAgents="SymantecRemovalTool"
897ListOfProgramsThatShouldNotRemoveLogs="SymantecRemovalTool"
898ListOfProgramsThatShouldNotRemoveSymantecIPUA="SymantecRemovalTool"
899LogFile="/private/tmp/${AbbreviatedScriptName}Log.txt"
900LogFileOfOld="/Users/Shared/${AbbreviatedScriptName}Log.txt"
901# ----- LoginKeychainPasswordsToDelete BEGIN ------------------------------------------------
902# (2 fields, tab delimited):
903# Item to delete / help text to show
904LoginKeychainPasswordsToDelete="com.norton.NFM.auth Norton Internet Security account info
905com.norton.mexico.auth Norton Zone saved sessions"
906# ----- LoginKeychainPasswordsToDelete END --------------------------------------------------
907LogsToBackUpPattern="/Logs/"
908LogsToNotBackUpPattern="SymantecTestPatchers\.log"
909# ----- NotRemovedByNIS6Uninstaller BEGIN ------------------------------------------------
910# A list of paths or partial paths that aren't removed by NIS 6 uninstaller.
911# Add only items that cannot be isolated by the -u option.
912NotRemovedByNIS6Uninstaller='/com.symantec.errorreporting.
913/etc/liveupdate.conf'
914# ----- NotRemovedByNIS6Uninstaller END --------------------------------------------------
915NotRemovedByNIS6UninstallerText=" [should not be removed by NIS 6 uninstaller]"
916# ----- NotRemovedBySymantecUninstaller BEGIN ------------------------------------------------
917# A list of paths or partial paths that aren't removed by Symantec Uninstaller.app.
918# Add only items that cannot be isolated by the -u option.
919NotRemovedBySymantecUninstaller='/Library/LaunchAgents/com.symantec.SCSInstaller.plist
920/Library/LaunchDaemons/com.symantec.nis.uninstall.plist
921/Library/LaunchDaemons/com.symantec.NWPService.plist
922/Library/Logs/SymantecTestPatchers.log
923/Library/Preferences/com.norton.WiFiPrivacy.plist
924/Library/Preferences/com.symantec.antivirus.special.plist'
925# ----- NotRemovedBySymantecUninstaller END --------------------------------------------------
926NotRemovedBySymantecUninstallerText=" [should not be removed by Symantec Uninstaller.app]"
927PrivateLinksPattern='^/etc/|^/tmp/|^/var/'
928PrivateDirectoriesPattern='^/private/etc/|^/private/tmp/|^/private/var/'
929PublicVersion=true
930# ----- ReceiptsTable BEGIN ------------------------------------------------
931# (2 fields, tab delimited):
932# Receipt name / Receipt option (-a = delete receipt*, -s = skip run of predelete script)
933ReceiptsTable='
934# Check to make sure there are no vague receipts that may be used by
935# third party software before releasing to the public.
936# This line may need to be removed to avoid deleting third party files:
937CompatibilityCheck.pkg
938# This line may need to be removed to avoid deleting third party files:
939Decomposer.pkg
940# This line may need to be removed to avoid deleting third party files:
941DeletionTracking.pkg
942FileSaver.pkg
943LiveUpdate -a
944NATRemoteLock.pkg
945NATSDPlugin.pkg
946NAVContextualMenu.pkg
947NAVcorporate.pkg
948NAVDefs.pkg
949NAVEngine.pkg
950NAVWidget.pkg
951navx.pkg
952NAV_App -a
953NAV_AutoProtect -a
954NFSCore.pkg
955NISLaunch.pkg
956Norton AntiVirus Application.pkg
957Norton AntiVirus Product Log.rtf
958Norton AntiVirus.pkg
959Norton AutoProtect.pkg
960Norton Disk Editor X.pkg
961Norton Internet Security Log.rtf
962Norton Personal Firewall 3.0 Log.rtf
963Norton Scheduled Scans.pkg
964Norton Scheduler.pkg
965Norton SystemWorks 3.0 Log.rtf
966Norton Utilities 8.0 Log.rtf
967nortonanti-theftPostflight.pkg
968nortonantitheftPostflight.pkg
969NortonAutoProtect.pkg
970# Remove all NortonAVDefs receipts
971NortonAVDefs -a
972NortonDefragger.pkg
973NortonDiskDoctor.pkg
974NortonFirewall -a
975NortonInternetSecurity -a
976NortonLauncher.pkg
977NortonParentalControl.pkg
978NortonPersonalFirewall.pkg
979NortonPersonalFirewallMenu.pkg
980NortonPrivacyControl.pkg
981NortonQuickMenu -a
982NPC Installer Log
983NPC.pkg
984NSMCore.pkg
985NSMCore.Universal.pkg
986NSWLaunch.pkg
987NUMCompatibilityCheck.pkg
988NumDocs.pkg
989NUMLaunch.pkg
990PredeleteTool.pkg
991SavLog.pkg
992# This line may need to be removed to avoid deleting third party files:
993Scheduled Scans.pkg
994# This line may need to be removed to avoid deleting third party files:
995Scheduler.pkg
996SDProfileEditor.pkg
997SMC.pkg
998SNAC.pkg
999SpeedDisk.pkg
1000# NAV 9 installs the StuffIt engine if it needs to and creates the
1001# StuffIt.pkg receipt for it. The following line may need to be removed
1002# (but should not need to be) to avoid deleting third party files:
1003StuffIt.pkg
1004Symantec Alerts.pkg
1005Symantec AntiVirus.pkg
1006Symantec AutoProtect Prefs.pkg
1007Symantec AutoProtect.pkg
1008Symantec Decomposer.pkg
1009Symantec Endpoint Protection.pkg
1010Symantec Scheduled Scans.pkg
1011Symantec Scheduler.pkg
1012# Remove all SymantecAVDefs receipts
1013SymantecAVDefs -a
1014SymantecClientFirewall.pkg
1015SymantecDecomposer.pkg
1016SymantecDeepSightExtractor.pkg
1017SymantecParentalControl.pkg
1018SymantecQuickMenu.pkg
1019SymantecSAQuickMenu.pkg
1020SymantecSharedComponents -a
1021SymantecUninstaller -a
1022SymantecURLs.pkg
1023SymAV10StuffItInstall.pkg
1024SymAVScanServer.pkg
1025SymConfidential -a
1026SymConfidentialData.pkg
1027SymDaemon -a
1028SymDC.pkg
1029SymDiskMountNotify.pkg
1030SymErrorReporting.pkg
1031SymEvent.pkg
1032SymFileSecurity -a
1033SymFirewall -a
1034SymFS.pkg
1035SymHelper.pkg
1036SymHelpScripts.pkg
1037SymInstallExtras.pkg
1038SymInternetSecurity.pkg
1039SymIntrusionPrevention -a
1040SymIPS.pkg
1041SymLicensing -a
1042SymNCOApplication -a
1043SymOxygen.pkg
1044SymOSXKernelUtilities.pkg
1045SymPersonalFirewallCore -a
1046SymPersonalFirewallUI -a
1047SymProtector.pkg
1048SymPseudoLicensing -a
1049SymSetupAssistant -a
1050SymSharedFrameworks -a
1051SymSharedSettings -a
1052SymStuffit.pkg
1053SymSubmission.pkg
1054SymUIAgent -a
1055SymWebFraud -a
1056SymWebKitUtils.pkg
1057Unerase.pkg
1058# This line may need to be removed to avoid deleting third party files:
1059URL.pkg
1060VolumeAssist.pkg
1061VolumeRecover.pkg
1062WCIDEngine.pkg
1063Wipe Info.pkg
1064ZoneStandalone.pkg
1065'
1066# ----- ReceiptsTable END --------------------------------------------------
1067# ----- RequiredPrograms BEGIN ------------------------------------------------
1068RequiredPrograms='
1069awk
1070basename
1071cat
1072cd
1073chmod
1074cp
1075crontab
1076date
1077defaults
1078dirname
1079echo
1080egrep
1081expr
1082find
1083grep
1084head
1085kill
1086ls
1087mkdir
1088more
1089printf
1090ps
1091pwd
1092read
1093rm
1094sed
1095sort
1096sudo
1097tail
1098tr
1099uniq
1100'
1101# ----- RequiredPrograms END --------------------------------------------------
1102SavedFilesDir="/private/tmp/${AbbreviatedScriptName}SavedFiles"
1103
1104# *** Function Declarations ***
1105
1106AssignVolume()
1107{
1108 # Usage: AssignVolume $1
1109 # Argument: $1 = Volume name. The name can begin with "/Volumes/"
1110 # unless it is "/" (boot volume).
1111 # Summary: Assigns the name of the volume passed as $1 to VolumesToUse.
1112 # If volume is assigned, 0 is returned; else, 1 is returned.
1113 #
1114 # If nothing passed, skip assignment
1115 [ -z "$1" ] && return 1
1116 VolumeToAssign=`CheckIfValidVolume "$1"`
1117 if [ -z "$VolumeToAssign" ] ; then
1118 VolumeToAssign=`CheckIfValidVolume "/Volumes/$1"`
1119 [ -z "$VolumeToAssign" ] && return 1
1120 fi
1121 [ "$VolumeToAssign" = "/" ] && BootVolumeWillBeSearched=true
1122 VolumesToUse="$VolumesToUse
1123$VolumeToAssign"
1124 return 0
1125}
1126
1127BackupLog()
1128{
1129 # Usage: BackupLog file
1130 # Summary: Copies file into BackupLogLocationDir.
1131 # BackupLogLocationDir must be defined prior
1132 # to running this function.
1133 #
1134 local FileToBackUp="$1"
1135 local BackupNumber=0
1136 FileToBackupBase=`basename "$FileToBackUp"`
1137 local DestinationFileName
1138 if ! $DoBackupLogs ; then
1139 return
1140 elif [ ! -f "$FileToBackUp" ] ; then
1141 return
1142 # Else if this is not a file that should be backed up
1143 elif [ -z "`printf "%s" "$FileToBackUp" | egrep -ie "$LogsToBackUpPattern" | egrep -ive "$LogsToNotBackUpPattern"`" ] ; then
1144 return
1145 fi
1146 if [ ! -d "$BackupLogLocationDir" ] ; then
1147 mkdir -p "$BackupLogLocationDir"
1148 chmod 777 "$BackupLogLocationDir" "$BackupLogLocationRootDir"
1149 fi
1150 DestinationFileName="$FileToBackupBase"
1151 while [ -f "$BackupLogLocationDir/$DestinationFileName" ] ; do
1152 let BackupNumber=$BackupNumber+1
1153 # If file name contains a period with a character on each side and no other periods
1154 if [ "`printf "%s" "$FileToBackupBase" | grep -e '.\..' | grep -ve '\..*\.'`" ] ; then
1155 DestinationFileName=`printf "%s" "$FileToBackupBase" | awk -v NUM="$BackupNumber" '{
1156 # Put hyphen + NUM in front of the period
1157 sub("\\\.", "-" NUM ".", $0)
1158 print $0}'`
1159 else
1160 # Put hyphen + NUM at end of the file name
1161 DestinationFileName="$FileToBackupBase-$BackupNumber"
1162 fi
1163 done
1164 ditto "$FileToBackUp" "$BackupLogLocationDir/$DestinationFileName"
1165 chmod 666 "$BackupLogLocationDir/$DestinationFileName"
1166}
1167
1168CheckIfValidVolume()
1169{
1170 # Usage: CheckIfValidVolume volume
1171 # Summary: If volume is a valid volume path, the path, with extra
1172 # slashes removed, is written to standard output.
1173 #
1174 local PathToPrint=""
1175 local VolumePathToCheck="$1"
1176 # If VolumePathToCheck is the boot volume
1177 if [ "$VolumePathToCheck" -ef / ] ; then
1178 PathToPrint=/
1179 # Else if VolumePathToCheck begins with /
1180 elif [ "`printf "%s" "$VolumePathToCheck" | grep '^/'`" ] ; then
1181 # If it is a directory and not a link
1182 if [ -d "$VolumePathToCheck" -a ! -L "$VolumePathToCheck" ] ; then
1183 # Strip any extra slashes
1184 VolumePathToCheck=`printf "%s" "$VolumePathToCheck" | sed 's|//*|/|g'`
1185 if [ "`dirname "$VolumePathToCheck"`" = "/Volumes" ] ; then
1186 PathToPrint="/Volumes/`basename "$VolumePathToCheck"`"
1187 fi
1188 fi
1189 fi
1190 [ "$PathToPrint" ] && echo "$PathToPrint"
1191}
1192
1193DeleteCrontabEntries()
1194{
1195 # Usage: DeleteCrontabEntries [$1]
1196 # Argument: $1 = Volume name. The name should begin with "/Volumes/"
1197 # unless it is "/" (boot volume). If NULL, then / is
1198 # used as volume name.
1199 # Authors: John Hansen, Corey Swertfager
1200 # Summary: Deletes from / or volume specified the crontab entries
1201 # created by Norton Scheduler and Symantec Scheduler.
1202 # Note: User must be root when calling this function.
1203 #
1204 if [ "z$1" = z/ ] ; then
1205 VolumeToDeleteCrontabsFrom=""
1206 else
1207 VolumeToDeleteCrontabsFrom="$1"
1208 fi
1209 CRONDIRNEW="$VolumeToDeleteCrontabsFrom/private/var/at/tabs" # OS 10.5 and later crontab directory
1210 CRONDIROLD="$VolumeToDeleteCrontabsFrom/private/var/cron/tabs" # OS 10.4 and earlier crontab directory
1211 if [ ! -d "$CRONDIRNEW" -a ! -d "$CRONDIROLD" ] ; then
1212 if $CreateFilesRemovedListOnly ; then
1213 if [ -z "$VolumeToDeleteCrontabsFrom" ] ; then
1214 echo "No crontab directory was found on on the current boot volume." >> "$FilesRemovedList"
1215 else
1216 echo "No crontab directory was found on on the volume \"`basename "$VolumeToDeleteCrontabsFrom"`\"." >> "$FilesRemovedList"
1217 fi
1218 echo "" >> "$FilesRemovedList"
1219 else
1220 if [ -z "$VolumeToDeleteCrontabsFrom" ] ; then
1221 echo "No crontab directory was found on on the current boot volume."
1222 else
1223 echo "No crontab directory was found on on the volume \"`basename "$VolumeToDeleteCrontabsFrom"`\"."
1224 fi
1225 fi
1226 return 1
1227 fi
1228 TEMPFILETEMPLATE="/private/tmp/NortonTemp"
1229 GREP1="^#SqzS"
1230 GREP2="^#SYMANTEC SCHEDULER CRON ENTRIES"
1231 GREP3="^#PLEASE DO NOT EDIT\.$"
1232 GREP4="EvType1=.*EvType2=.*Sched="
1233 GREP5="Norton Solutions Support/Scheduler/schedLauncher"
1234 GREP6="Symantec/Scheduler/SymSecondaryLaunch.app/Contents/schedLauncher"
1235 SymantecCrontabEntryExists=false
1236 CurrentDir="`pwd`" # Save initial directory location
1237 # Set IFS to only newline to get all crontabs
1238 IFS='
1239'
1240 for CRONDIR in `ls -d "$CRONDIRNEW" "$CRONDIROLD" 2>/dev/null` ; do
1241 cd "$CRONDIR"
1242 # List each crontab, pipe through grep command and replace
1243 for user in $ComputerUsers ; do
1244 # If there is no crontab file for this user, skip user
1245 [ ! -f "$user" ] && continue
1246 # If deleting from boot volume
1247 if [ -z "$VolumeToDeleteCrontabsFrom" ] ; then
1248 # Check to see if there is a Symantec crontab entry
1249 if [ "`crontab -u "$user" -l | grep -c "$GREP1\|$GREP2\|$GREP3\|$GREP4\|$GREP5\|$GREP6"`" != 0 ] ; then
1250 SymantecCrontabEntryExists=true
1251 else
1252 continue # Nothing to remove, skip user
1253 fi
1254 $CreateFilesRemovedListOnly && break
1255 TEMPFILE="$TEMPFILETEMPLATE`date +"%Y%m%d%H%M%S"`"
1256 crontab -u "$user" -l | grep -v "$GREP1\|$GREP2\|$GREP3\|$GREP4\|$GREP5\|$GREP6" > $TEMPFILE
1257 # Restore crontab file if it has more entries, else remove
1258 if [ -s "$TEMPFILE" ] ; then
1259 crontab -u "$user" $TEMPFILE &>/dev/null
1260 else
1261 echo "y" | crontab -u "$user" -r &>/dev/null
1262 fi
1263 else
1264 # Check to see if there is a Symantec crontab entry
1265 if [ "`grep -c "$GREP1\|$GREP2\|$GREP3\|$GREP4\|$GREP5\|$GREP6" "$user"`" != 0 ] ; then
1266 SymantecCrontabEntryExists=true
1267 else
1268 continue # Nothing to remove, skip user
1269 fi
1270 $CreateFilesRemovedListOnly && break
1271 TEMPFILE="$TEMPFILETEMPLATE`date +"%Y%m%d%H%M%S"`"
1272 grep -v "$GREP1\|$GREP2\|$GREP3\|$GREP4\|$GREP5\|$GREP6" "$user" > $TEMPFILE
1273 # Restore crontab file if it has more entries, else remove
1274 if [ -s "$TEMPFILE" ] ; then
1275 cat $TEMPFILE >"$user"
1276 else
1277 rm -f "$user" 2>/dev/null
1278 fi
1279 fi
1280 /bin/rm "$TEMPFILE" 2>/dev/null
1281 done
1282 [ $CreateFilesRemovedListOnly = true -a $SymantecCrontabEntryExists = true ] && break
1283 done
1284 cd "$CurrentDir" # Return to intial directory
1285 if $SymantecCrontabEntryExists ; then
1286 if $CreateFilesRemovedListOnly ; then
1287 if [ -z "$VolumeToDeleteCrontabsFrom" ] ; then
1288 echo "Symantec crontab entries would be deleted from the current boot volume." >> "$FilesRemovedList"
1289 else
1290 echo "Symantec crontab entries would be deleted from the volume" >> "$FilesRemovedList"
1291 echo "\"`basename "$VolumeToDeleteCrontabsFrom"`\"." >> "$FilesRemovedList"
1292 fi
1293 echo "" >> "$FilesRemovedList"
1294 else
1295 if [ -z "$VolumeToDeleteCrontabsFrom" ] ; then
1296 echo "Symantec crontab entries were deleted from the current boot volume."
1297 else
1298 echo "Symantec crontab entries were deleted from the volume"
1299 echo "\"`basename "$VolumeToDeleteCrontabsFrom"`\"."
1300 fi
1301 fi
1302 NoFilesToRemove=false
1303 else
1304 if $CreateFilesRemovedListOnly ; then
1305 if [ -z "$VolumeToDeleteCrontabsFrom" ] ; then
1306 echo "There are no Symantec crontab entries on the current boot volume;" >> "$FilesRemovedList"
1307 echo "no crontab entries would be removed from it." >> "$FilesRemovedList"
1308 else
1309 echo "There are no Symantec crontab entries on the volume \"`basename "$VolumeToDeleteCrontabsFrom"`\";" >> "$FilesRemovedList"
1310 echo "no crontabs would be adjusted on that volume." >> "$FilesRemovedList"
1311 fi
1312 echo "" >> "$FilesRemovedList"
1313 elif [ -z "$VolumeToDeleteCrontabsFrom" ] ; then
1314 echo "There are no Symantec crontab entries to delete from the current boot volume."
1315 else
1316 echo "There are no Symantec crontab entries to delete from the volume"
1317 echo "\"`basename "$VolumeToDeleteCrontabsFrom"`\"."
1318 fi
1319 fi
1320 return 0
1321}
1322
1323DeleteLaunchdPlists()
1324{
1325 # Usage: DeleteLaunchdPlists [$1]
1326 # Argument: $1 = Volume name. The name should begin with "/Volumes/"
1327 # unless it is "/" (boot volume). If NULL, then / is
1328 # used as volume name.
1329 # Summary: Deletes from / or volume specified the launchd plists
1330 # created by Symantec Scheduler.
1331 # Note: User must be root when calling this function.
1332 #
1333 if [ "z$1" = z/ ] ; then
1334 VolumeToDeleteLaunchdPlistsFrom=""
1335 else
1336 VolumeToDeleteLaunchdPlistsFrom="$1"
1337 fi
1338 LaunchdPlists=`ls -d "$VolumeToDeleteLaunchdPlistsFrom/Library/LaunchDaemons/com.symantec.Sched"*.plist 2>/dev/null`
1339 if [ "$LaunchdPlists" ] ; then
1340 if $CreateFilesRemovedListOnly ; then
1341 if [ -z "$VolumeToDeleteLaunchdPlistsFrom" ] ; then
1342 echo "Symantec Scheduler launchd plists would be deleted from the current boot volume." >> "$FilesRemovedList"
1343 else
1344 echo "Symantec Scheduler launchd plists would be deleted from the volume" >> "$FilesRemovedList"
1345 echo "\"`basename "$VolumeToDeleteLaunchdPlistsFrom"`\"." >> "$FilesRemovedList"
1346 fi
1347 echo "" >> "$FilesRemovedList"
1348 else
1349 IFS='
1350'
1351 for EachPlist in $LaunchdPlists ; do
1352 rm -f "$EachPlist" 2>/dev/null
1353 done
1354 if [ -z "$VolumeToDeleteLaunchdPlistsFrom" ] ; then
1355 echo "Symantec Scheduler launchd plists were deleted from the current boot volume."
1356 else
1357 echo "Symantec Scheduler launchd plists were deleted from the volume"
1358 echo "\"`basename "$VolumeToDeleteLaunchdPlistsFrom"`\"."
1359 fi
1360 fi
1361 NoFilesToRemove=false
1362 else
1363 if $CreateFilesRemovedListOnly ; then
1364 if [ -z "$VolumeToDeleteLaunchdPlistsFrom" ] ; then
1365 echo "There are no Symantec Scheduler launchd plists on the current boot volume," >> "$FilesRemovedList"
1366 echo "so none would be removed from it." >> "$FilesRemovedList"
1367 else
1368 echo "There are no Symantec Scheduler launchd plists on the volume" >> "$FilesRemovedList"
1369 echo "\"`basename "$VolumeToDeleteLaunchdPlistsFrom"`\", so none would be removed from it." >> "$FilesRemovedList"
1370 fi
1371 echo "" >> "$FilesRemovedList"
1372 elif [ -z "$VolumeToDeleteLaunchdPlistsFrom" ] ; then
1373 echo "There are no Symantec Scheduler launchd plists to delete from the current boot"
1374 echo "volume."
1375 else
1376 echo "There are no Symantec Scheduler launchd plists to delete from the volume"
1377 echo "\"`basename "$VolumeToDeleteLaunchdPlistsFrom"`\"."
1378 fi
1379 fi
1380 return 0
1381}
1382
1383DeleteSymantecLoginItems()
1384{
1385 # Usage: DeleteSymantecLoginItems [volume]
1386 #
1387 # Argument: volume - volume from which to remove login items; volume must
1388 # begin with "/Volumes/" unless it is "/" (boot volume); if
1389 # nothing is passed, / is assumed.
1390 #
1391 # Summary: Deletes Symantec items from all com.apple.loginitems.plist and
1392 # loginwindow.plist files on volume specified.
1393 #
1394 # If a file is purged on the boot volume, file path defined by
1395 # SymantecCleanupRestartFile is created so that reboot messaging
1396 # can be displayed by scripts that use this function.
1397 #
1398 # Returns: The number of files purged.
1399 #
1400 # Note: If this function is run while booted in OS 10.1.x, it will
1401 # not be able to adjust loginwindow.plist files on an OS 10.4
1402 # or later volume because plutil did not ship with OS 10.1.x.
1403 #
1404 # The com.apple.loginitems.plist files are not purged if
1405 # /usr/libexec/PlistBuddy does not exist (PlistBuddy first
1406 # appeared in OS 10.5).
1407 #
1408 # GetComputerUsers() function must be run before calling this
1409 # function so that ComputerUsersHomeDirsAndRootDir is defined.
1410 #
1411 # CreateFilesRemovedListOnly and FilesRemovedList variables are
1412 # used only in Norton Cleanup scripts.
1413 #
1414 # Version: 3.0.2
1415 #
1416 local ArrayItem
1417 local Base
1418 local Buffer
1419 local CheckSyntax
1420 local CreateFilesRemovedListOnly="$CreateFilesRemovedListOnly"
1421 local Line
1422 local NameKeyValue
1423 local NumberOfFilesPurged=0
1424 local OriginalPlistFile
1425 local PatternOfKeyNames="Norton WiFi Privacy\.app"
1426 local PatternOfKeyNamesToExclude="Norton Solutions|Symantec|SymSecondaryLaunch|Norton"
1427 local PlistBuddyError
1428 local PropertyKeyToUse
1429 local SavedIFS="$IFS"
1430 local StartupPathPatterns="/Applications/Norton AntiVirus.app
1431/Applications/Norton Internet Security.app
1432/Applications/Norton Security.app
1433/Applications/Symantec Cloud Security.app
1434/Applications/Symantec Unified Endpoint Protection.app
1435/Library/Application Support/Norton Solutions
1436/Library/Application Support/Symantec
1437/Library/StartupItems/Norton
1438/Norton Zone.app
1439/Scheduler/SymSecondaryLaunch.app
1440Norton WiFi Privacy"
1441 local SymantecLoginItemsWereFound=false
1442 local SymantecLoginItemWasFound
1443 local TargetVolume="$1"
1444 local TempFileTemplate=/private/tmp/Delete_Symantec_Login_Items
1445 local TempScrapFile=${TempFileTemplate}`date +"%Y%m%d%H%M%S"`-Scrap
1446 local TempPlistFile=${TempFileTemplate}`date +"%Y%m%d%H%M%S"`-PlistCopy
1447 [ "$1" -ef / ] && TargetVolume=""
1448 [ "z$CreateFilesRemovedListOnly" != ztrue -o ! -f "$FilesRemovedList" ] && CreateFilesRemovedListOnly=false
1449 [ -z "$SymantecCleanupRestartFile" ] && SymantecCleanupRestartFile="/private/tmp/com.symantec.cleanup.restart"
1450 which plutil &>/dev/null
1451 # If plutil program is not installed
1452 if [ $? != 0 ] ; then
1453 # If running OS 10.4 or later
1454 if [ $OSXmajorVersion -gt 3 ] ; then
1455 # Show message and skip plist adjustments because plists are in binary format in OS 10.4 and later
1456 if $CreateFilesRemovedListOnly ; then
1457 echo "NOTE: plutil is not installed, so loginwindow.plist files cannot be adjusted." >> "$FilesRemovedList"
1458 else
1459 echo "NOTE: plutil is not installed, so loginwindow.plist files cannot be adjusted."
1460 fi
1461 return
1462 fi
1463 fi
1464 IFS='
1465'
1466 for Line in $StartupPathPatterns ; do
1467 Base=`basename "$Line" .app`
1468 if [ -z "`echo "$Base" | egrep -xe "$PatternOfKeyNamesToExclude"`" ] ; then
1469 PatternOfKeyNames="${PatternOfKeyNames}|$Base"
1470 fi
1471 done
1472 # Remove login items from loginwindow.plist files
1473 for EachHomeDir in $ComputerUsersHomeDirsAndRootDir ; do
1474 if [ "$EachHomeDir" = / ] ; then
1475 OriginalPlistFile="$TargetVolume/Library/Preferences/loginwindow.plist"
1476 else
1477 OriginalPlistFile="$TargetVolume$EachHomeDir/Library/Preferences/loginwindow.plist"
1478 fi
1479 [ ! -f "$OriginalPlistFile" ] && continue
1480 rm -rf "$TempPlistFile" 2>/dev/null
1481 cp "$OriginalPlistFile" "$TempPlistFile"
1482 CheckSyntax=true
1483 plutil -convert xml1 "$TempPlistFile" 2>/dev/null
1484 # If plutil failed to convert the plist, don't check syntax later
1485 [ $? != 0 ] && CheckSyntax=false
1486 IsBinaryFormat=false
1487 # If original plist is different than converted plist, treat it as a binary file
1488 [ -n "`diff "$OriginalPlistFile" "$TempPlistFile" 2>/dev/null`" ] && IsBinaryFormat=true
1489 # If no Symantec login item was found, skip to next file
1490 [ `grep -c -F "$StartupPathPatterns" "$TempPlistFile"` = 0 ] && continue
1491 SymantecLoginItemsWereFound=true
1492 if $CreateFilesRemovedListOnly ; then
1493 echo "Symantec login items would be removed from:" >> "$FilesRemovedList"
1494 echo " \"$OriginalPlistFile\"" >> "$FilesRemovedList"
1495 continue
1496 fi
1497 # Purge Symantec login item(s)
1498 printf "" > "$TempScrapFile"
1499 Buffer=""
1500 DoWriteBuffer=true
1501 for Line in `cat "$TempPlistFile"` ; do
1502 # If beginning of a dictionary key
1503 if [ "`printf "%s" "$Line" | grep '<dict>$'`" ] ; then
1504 [ "$Buffer" ] && echo "$Buffer" >> "$TempScrapFile"
1505 Buffer="$Line"
1506 DoWriteBuffer=true
1507 else
1508 if [ "$Buffer" ] ; then
1509 Buffer="$Buffer
1510$Line"
1511 else
1512 Buffer="$Line"
1513 fi
1514 # If end of a dictionary key
1515 if [ "`printf "%s" "$Line" | grep '</dict>$'`" ] ; then
1516 $DoWriteBuffer && echo "$Buffer" >> "$TempScrapFile"
1517 Buffer=""
1518 DoWriteBuffer=true
1519 # Else if Symantec path was found
1520 elif [ "`printf "%s" "$Line" | grep -F "$StartupPathPatterns"`" ] ; then
1521 DoWriteBuffer=false
1522 fi
1523 fi
1524 done
1525 [ "$Buffer" ] && echo "$Buffer" >> "$TempScrapFile"
1526 # If some login item information is missing
1527 if [ `grep -c '<dict>$' "$TempScrapFile"` != `grep -c '</dict>$' "$TempScrapFile"` ] ; then
1528 echo "ERROR: Could not remove Symantec login items from:"
1529 echo " $OriginalPlistFile"
1530 # Else if syntax is to be checked and plist contains bad syntax
1531 elif [ $CheckSyntax = true -a -n "`plutil -s "$TempScrapFile" 2>/dev/null`" ] ; then
1532 echo "ERROR: Could not remove Symantec login items (plutil conversion failed) from:"
1533 echo " $OriginalPlistFile"
1534 else
1535 echo "Removing Symantec login items from:"
1536 echo " \"$OriginalPlistFile\""
1537 cat "$TempScrapFile" > "$OriginalPlistFile"
1538 $IsBinaryFormat && plutil -convert binary1 "$OriginalPlistFile" 2>/dev/null
1539 let NumberOfFilesPurged=$NumberOfFilesPurged+1
1540 fi
1541 done
1542 rm -f "$TempScrapFile" 2>/dev/null
1543 # Remove login items from com.apple.loginitems.plist files if PlistBuddy is installed
1544 if [ -f /usr/libexec/PlistBuddy ] ; then
1545 for EachHomeDir in $ComputerUsersHomeDirsAndRootDir ; do
1546 if [ "$EachHomeDir" = / ] ; then
1547 OriginalPlistFile="$TargetVolume/Library/Preferences/com.apple.loginitems.plist"
1548 else
1549 OriginalPlistFile="$TargetVolume$EachHomeDir/Library/Preferences/com.apple.loginitems.plist"
1550 fi
1551 [ ! -f "$OriginalPlistFile" ] && continue
1552 rm -rf "$TempPlistFile" 2>/dev/null
1553 cp "$OriginalPlistFile" "$TempPlistFile"
1554 PropertyKeyToUse=':privilegedlist:CustomListItems'
1555 NameKeyValue=`/usr/libexec/PlistBuddy "$TempPlistFile" -c "print ${PropertyKeyToUse}:0:Name" 2>/dev/null`
1556 if [ -z "$NameKeyValue" ] ; then
1557 PropertyKeyToUse=':SessionItems:CustomListItems'
1558 NameKeyValue=`/usr/libexec/PlistBuddy "$TempPlistFile" -c "print ${PropertyKeyToUse}:0:Name" 2>/dev/null`
1559 [ -z "$NameKeyValue" ] && continue
1560 fi
1561 PlistBuddyError=0
1562 SymantecLoginItemWasFound=false
1563 ArrayItem=0
1564 while [ "$NameKeyValue" ] ; do
1565 # If this is a Symantec login item that should be deleted
1566 if [ "`printf "%s" "$NameKeyValue" | egrep -xe "$PatternOfKeyNames"`" ] ; then
1567 SymantecLoginItemWasFound=true
1568 $CreateFilesRemovedListOnly && break
1569 /usr/libexec/PlistBuddy "$TempPlistFile" -c "delete ${PropertyKeyToUse}:$ArrayItem" 2>/dev/null
1570 PlistBuddyError=$?
1571 [ $PlistBuddyError != 0 ] && break
1572 else
1573 let ArrayItem=$ArrayItem+1
1574 fi
1575 NameKeyValue=`/usr/libexec/PlistBuddy "$TempPlistFile" -c "print ${PropertyKeyToUse}:$ArrayItem:Name" 2>/dev/null`
1576 done
1577 $SymantecLoginItemWasFound && SymantecLoginItemsWereFound=true
1578 if $CreateFilesRemovedListOnly ; then
1579 if $SymantecLoginItemWasFound ; then
1580 echo "Symantec login items would be removed from:" >> "$FilesRemovedList"
1581 echo " \"$OriginalPlistFile\"" >> "$FilesRemovedList"
1582 fi
1583 # Else if some login item could not be deleted
1584 elif [ $PlistBuddyError != 0 ] ; then
1585 echo "ERROR: Could not remove Symantec login items from:"
1586 echo " $OriginalPlistFile"
1587 elif $SymantecLoginItemWasFound ; then
1588 echo "Removing Symantec login items from:"
1589 echo " \"$OriginalPlistFile\""
1590 cp "$TempPlistFile" "$OriginalPlistFile"
1591 let NumberOfFilesPurged=$NumberOfFilesPurged+1
1592 fi
1593 done
1594 fi
1595 rm -f "$TempPlistFile" 2>/dev/null
1596 if ! $SymantecLoginItemsWereFound ; then
1597 if $CreateFilesRemovedListOnly ; then
1598 echo "No Symantec login items were found." >> "$FilesRemovedList"
1599 else
1600 echo "No Symantec login items were found."
1601 fi
1602 fi
1603 $CreateFilesRemovedListOnly && echo "" >> "$FilesRemovedList"
1604 # If some Symantec items were purged from files on boot volume, trigger restart
1605 [ $NumberOfFilesPurged -gt 0 -a -z "$TargetVolume" ] && touch "$SymantecCleanupRestartFile"
1606 IFS="$SavedIFS"
1607 return $NumberOfFilesPurged
1608}
1609
1610DetermineAction()
1611{
1612 # Usage: DetermineAction
1613 # Summary: Determines which action to take based on user input.
1614 #
1615 clear
1616 echo
1617 ShowVersion
1618 echo "
1619WARNING: This script will remove all files and folders created by Symantec
1620 OS X products (except Symantec Adminstration Console for Macintosh
1621 files) and any files within those folders. Therefore, you will
1622 lose ALL files that reside in those folders, including any that
1623 you have created.
1624"
1625 echo "1 - Remove all Symantec files/folders."
1626 echo
1627 echo "2 - Quit. Do not remove any files."
1628 echo
1629 printf "Enter choice (1 or 2): "
1630 choice=1
1631 echo
1632 case "`echo "z$choice" | awk '{print tolower(substr($0,2))}'`" in
1633 1) # Remove files
1634 CreateFilesRemovedListOnly=false
1635 ;;
1636 2|q|quit) # Quit
1637 echo "Program cancelled. No files were removed."
1638 ExitScript 0
1639 ;;
1640 *) # Show choices again
1641 DetermineAction
1642 ;;
1643 esac
1644}
1645
1646DisableBrowserExtensionHostAssignment()
1647{
1648 # Usage: DisableBrowserExtensionHostAssignment
1649 # Summary: Comments out browser extension host assignment in /etc/hosts.
1650 #
1651 local BrowserExtensionHost="macplugin.norton.com"
1652 local BrowserExtensionHostPattern=`echo "$BrowserExtensionHost" | sed 's/\./\\\./g'`
1653 local BrowserExtensionHostCommentedOutPattern
1654 local HostsContent=""
1655 local HostsFile="/etc/hosts"
1656 local Line
1657 BrowserExtensionHostPattern="[[:space:]]$BrowserExtensionHostPattern[[:space:][:cntrl:]]*$"
1658 BrowserExtensionHostCommentedOutPattern="^[[:space:]]*#.*$BrowserExtensionHostPattern"
1659 # If host assignment was found in hosts file that wasn't already commented out
1660 if [ "`grep "$HostsFile" -e "$BrowserExtensionHostPattern" 2>/dev/null | egrep -ve "$BrowserExtensionHostCommentedOutPattern"`" ] ; then
1661 echo "Commenting out $BrowserExtensionHost host assignment in $HostsFile"
1662 for Line in `cat "$HostsFile" 2>/dev/null` ; do
1663 # If line is a host assignment that has not been commented out
1664 if [ "`printf "%s" "$Line" | egrep -e "$BrowserExtensionHostPattern" | egrep -ve "$BrowserExtensionHostCommentedOutPattern"`" ] ; then
1665 # Comment it out
1666 HostsContent="$HostsContent
1667#$Line"
1668 else
1669 # Leave it as is
1670 HostsContent="$HostsContent
1671$Line"
1672 fi
1673 done
1674 echo "$HostsContent" | grep . > "$HostsFile"
1675 fi
1676}
1677
1678ExitScript()
1679{
1680 # Usage: ExitScript [-b] [-e] [exit_number [error_string]]
1681 # Summary: Checks to see if ShowQuitMessage and RunScriptAsStandAlone
1682 # variables are set to true. If so, a message is displayed;
1683 # otherwise, no message is displayed. The script is then
1684 # exited and passes exit_number to exit command. If no
1685 # exit_number is passed, then 0 is passed to exit command. If
1686 # a non-integer is passed as exit_number, 255 is passed to
1687 # exit command. If error_string is passed, it is printed to
1688 # to standard out before exiting and is padded by blank lines
1689 # if error_string is not "". Pass -b before exit_number to
1690 # suppress beginning padding line, -e to suppress ending
1691 # padding line, both to suppress both. Also removes temp
1692 # files and kills Terminal if need be.
1693 #
1694 local PadBeginning=true
1695 local PadEnd=true
1696 while [ "$1" ] ; do
1697 case "$1" in
1698 -b)
1699 PadBeginning=false
1700 ;;
1701 -e)
1702 PadEnd=false
1703 ;;
1704 *)
1705 break
1706 ;;
1707 esac
1708 shift
1709 done
1710 rm -f "$FilesRemovedList" "$FilesRemovedFilesOnlyList" "$LogFile" 2>/dev/null 1>&2
1711 if $QuitTerminalForcefully ; then
1712 KillTerminal
1713 fi
1714 if [ $# -gt 1 ] ; then
1715 if [ -z "$2" ] ; then
1716 PadBeginning=false
1717 PadEnd=false
1718 fi
1719 $PadBeginning && echo
1720 printf "%s\n" "$2"
1721 $PadEnd && echo
1722 fi
1723 if [ "z$ShowQuitMessage" = ztrue -a "z$RunScriptAsStandAlone" = ztrue ] ; then
1724 [ $# -lt 2 -o \( $PadEnd = false -a -n "$2" \) ] && echo
1725 echo "NOTE: If you double-clicked this program, quit Terminal application now."
1726 [ $PadEnd = true -o -z "$2" ] && echo
1727 fi
1728 [ -z "$1" ] && exit 0
1729 [ -z "`expr "$1" / 1 2>/dev/null`" ] && exit 255 || exit $1
1730}
1731
1732FinishCleanup()
1733{
1734 # Usage: FinishCleanup
1735 # Summary: Displays then deletes the file named by LogFile, a log
1736 # of files not removed by RemoveItem function, if ErrorOccurred
1737 # is true. If NoFilesToRemove is true, a message is shown
1738 # and the function is exited. If RemoveInvisibleFilesOnly
1739 # is true, a message is shown and the function is exited;
1740 # otherwise, a message is shown. Returns value assigned to
1741 # ExitCodeWhenSomeFileWasNotRemoved if ErrorOccurred is true,
1742 # 0 otherwise.
1743 #
1744 if $DoShowOnlyFilesThatShouldHaveBeenUninstalled ; then
1745 # Translate [ into \[ to avoid text in between [ and ] being treated as a bracket expression
1746 PatternForOmission=`echo "$NotRemovedByNIS6UninstallerText|$NotRemovedBySymantecUninstallerText" | sed 's|\[|\\\[|g'`
1747 FilesThatRemain=`cat "$FilesRemovedList" 2>/dev/null | grep '^/' | egrep -ve "$PatternForOmission"`
1748 if [ "$FilesThatRemain" ] ; then
1749 echo "$FilesThatRemain"
1750 return $ExitCodeWhenFilesRemain
1751 else
1752 return 0
1753 fi
1754 elif $CreateFilesRemovedListOnly ; then
1755 clear >&2
1756 if $UseMore ; then
1757 ShowContents "$FilesRemovedList"
1758 else
1759 cat "$FilesRemovedList"
1760 fi
1761 echo "" >&2
1762 echo "NOTE: No files have been removed." >&2
1763 echo "" >&2
1764 /bin/rm -rf "$FilesRemovedList" "$FilesRemovedFilesOnlyList" 2>/dev/null 1>&2
1765 return 0
1766 elif $ErrorOccurred ; then
1767 echo
1768 # Display LogFile
1769 ShowContents "$LogFile"
1770 # Remove LogFile
1771 /bin/rm -rf "$LogFile" 2>/dev/null 1>&2
1772 echo
1773 if $RemoveInvisibleFilesOnly ; then
1774 echo "NOTE: Not all of the invisible Symantec files were removed."
1775 echo " Make sure each volume passed is unlocked and accessible."
1776 else
1777 echo "NOTE: Not all folders/files were removed."
1778 echo " Perhaps a file or folder listed above is in use or a folder"
1779 echo " listed above is not empty."
1780 if $RestartMayBeNeeded ; then
1781 echo
1782 echo "Some Symantec product files have been removed from the boot volume."
1783 else
1784 if $SomeFileWasRemoved ; then
1785 echo
1786 echo "Some folders or files have been removed."
1787 fi
1788 fi
1789 fi
1790 return $ExitCodeWhenSomeFileWasNotRemoved
1791 fi
1792 if $RemoveInvisibleFilesOnly ; then
1793 if $NoFilesToRemove ; then
1794 echo "There were no invisible Symantec files to be removed."
1795 else
1796 echo "AntiVirus QuickScan and/or Norton FS files have been removed."
1797 fi
1798 return 0
1799 fi
1800 if $NoFilesToRemove ; then
1801 echo "There were no files that needed to be removed. No files were removed."
1802 return 0
1803 fi
1804 $RemoveCrontabEntriesOnly && return 0
1805 echo
1806 if $RestartMayBeNeeded ; then
1807 printf "Symantec product files have been removed from the boot volume"
1808 if $SomeFileWasRemovedFromNonBootVolume ; then
1809 echo
1810 echo "and from other volume(s) listed above."
1811 else
1812 echo "."
1813 fi
1814 else
1815 echo "Symantec product files have been removed from the above volume(s)."
1816 fi
1817 return 0
1818}
1819
1820GetAdminPassword()
1821{
1822 # Usage: GetAdminPassword [$1]
1823 # Argument: $1 - Prompt for password. If true is passed, a user that
1824 # is not root will always be asked for a password. If
1825 # something other than true is passed or if nothing is
1826 # passed, then a user that is not root will only be
1827 # prompted for a password if authentication has lapsed.
1828 # Summary: Gets an admin user password from the user so that
1829 # future sudo commands can be run without a password
1830 # prompt. The script is exited with a value of 1 if
1831 # the user enters an invalid password or if the user
1832 # is not an admin user. If the user is the root user,
1833 # then there is no prompt for a password (there is
1834 # no need for a password when user is root).
1835 # NOTE: Make sure ExitScript function is in the script.
1836 #
1837 # If root user, no need to prompt for password
1838 [ "`whoami`" = "root" ] && return 0
1839 echo >&2
1840 # If prompt for password
1841 if [ "$1" = "true" -o "$1" = "true" ] ; then
1842 ShowVersion >&2
1843 echo >&2
1844 sudo -k >&2 # Make sudo require a password the next time it is run
1845 echo "You must be an admin user to run this script." >&2
1846 fi
1847 # A dummy sudo command to get password
1848 sudo -p "Please enter your admin password: " date 2>/dev/null 1>&2
1849 if [ ! $? = 0 ] ; then # If failed to get password, alert user and exit script
1850 echo "You entered an invalid password or you are not an admin user. Script aborted." >&2
1851 ExitScript 1
1852 fi
1853}
1854
1855GetComputerUsers()
1856{
1857 # Usage: GetComputerUsers [-r] [volume]
1858 #
1859 # Version: 1.0.1
1860 #
1861 # Summary: Defines the following variables:
1862 #
1863 # ComputerUsers
1864 # ComputerUsersHomeDirs
1865 # ComputerUsersHomeDirsAndRootDir
1866 # ComputerUsersTable
1867 #
1868 # Omitted are users whose home directories contain no Library
1869 # directory and users that are not root whose home directory is
1870 # /var/root. If volume is passed and there is no /Users on that
1871 # volume, variables are all set to "". ComputerUsersTable is a
1872 # list of users and their home directories, separated by tabs.
1873 #
1874 # Note: This function must be run as root to find all users. When an
1875 # OS X volume other than / is passed or if the dscl program fails
1876 # or does not exist, non-root users that do not have their home
1877 # directories in /Users are not included and root's home directory
1878 # is assumed to be /var/root.
1879 #
1880 # History: 1.0.1 - 08/11/2014 - Corey Swertfager:
1881 # * Added ComputerUsersTable variable assignment.
1882 # * Now always includes root user in case this function
1883 # is not run as root.
1884 # * Added volume argument.
1885 #
1886 local CurrentDir
1887 local GCUHomeDir
1888 local CGLibraryDir
1889 local CGLibraryDirs
1890 local GCUUser
1891 local GCUUsers
1892 local SavedIFS="$IFS"
1893 local VolumePassed="$1"
1894 ComputerUsers=""
1895 ComputerUsersHomeDirs=""
1896 ComputerUsersHomeDirsAndRootDir=""
1897 ComputerUsersTable=""
1898 # If a directory other than / is passed
1899 if [ -d "$VolumePassed" -a ! "$VolumePassed" -ef / ] ; then
1900 # If not an OS X volume, skip it
1901 [ ! -d "$VolumePassed/Users" ] && return
1902 CurrentDir=`pwd`
1903 cd "$VolumePassed"
1904 CGLibraryDirs=`ls -d Users/*/Library 2>/dev/null | grep -v 'Users/Shared'`
1905 cd "$CurrentDir"
1906 # If no Library folders were found, skip
1907 [ -z "$CGLibraryDirs" ] && return
1908 CGLibraryDirs="$CGLibraryDirs
1909var/root/Library"
1910 IFS='
1911'
1912 for CGLibraryDir in $CGLibraryDirs ; do
1913 GCUHomeDir="/`dirname "$CGLibraryDir"`"
1914 GCUUser=`basename "$GCUHomeDir"`
1915 ComputerUsersHomeDirs="$ComputerUsersHomeDirs
1916$GCUHomeDir"
1917 ComputerUsers="$ComputerUsers
1918$GCUUser"
1919 ComputerUsersTable="$ComputerUsersTable
1920$GCUUser $GCUHomeDir"
1921 done
1922 else
1923 GCUUsers=`dscl . list /Users 2>/dev/null | egrep '^[[:alnum:]]' | egrep -vx 'daemon|nobody'`
1924 if [ -z "$GCUUsers" ] ; then
1925 GCUUsers="`ls /Users | egrep '^[[:alnum:]]' | grep -vx Shared`
1926root"
1927 fi
1928 IFS='
1929'
1930 for GCUUser in $GCUUsers ; do
1931 GCUHomeDir=`echo $(eval echo ~"$GCUUser")`
1932 # If home directory could not be evaluated
1933 if [ "`printf "%s" "$GCUHomeDir" | grep '^~'`" ] ; then
1934 continue
1935 elif [ "$GCUUser" != root ] ; then
1936 if [ ! -d "$GCUHomeDir/Library" ] ; then
1937 continue
1938 elif [ "$GCUHomeDir" = /var/root ] ; then
1939 continue
1940 fi
1941 fi
1942 ComputerUsers="$ComputerUsers
1943$GCUUser"
1944 ComputerUsersHomeDirs="$ComputerUsersHomeDirs
1945$GCUHomeDir"
1946 ComputerUsersTable="$ComputerUsersTable
1947$GCUUser $GCUHomeDir"
1948 done
1949 fi
1950 IFS="$SavedIFS"
1951 ComputerUsers=`echo "$ComputerUsers" | grep . | sort -f | uniq`
1952 ComputerUsersHomeDirs=`echo "$ComputerUsersHomeDirs" | grep / | sort -f | uniq`
1953 ComputerUsersHomeDirsAndRootDir="/
1954$ComputerUsersHomeDirs"
1955 ComputerUsersTable=`echo "$ComputerUsersTable" | grep / | sort -f | uniq`
1956}
1957
1958KillNortonZone()
1959{
1960 $CreateFilesRemovedListOnly && return
1961 ZoneProcesses=`ps -axww | grep "Norton Zone.app/Contents/MacOS/Norton Zone" | grep -v grep | awk '{print $1}'`
1962 for EachZoneAppPID in $ZoneProcesses ; do
1963 kill -9 "$EachZoneAppPID"
1964 done
1965 [ "$ZoneProcesses" ] && killall Finder
1966}
1967
1968KillSymantecProcesses()
1969{
1970 # Usage: KillSymantecProcesses [-n] [ProcessPattern [ProductName]]
1971 #
1972 # Kills Symantec processes that match extended regular expression
1973 # ProcessPattern. If ProcessPattern is not passed, all processes
1974 # that match those in ProcessPatternDefault are used. If ProductName
1975 # is passed, that name is shown when kill attempt is made; otherwise
1976 # "Symantec" is shown.
1977 #
1978 # If -n is passed as the first argument, no kill is attempted and no
1979 # output is shown.
1980 #
1981 # Returns 1 if there remains some matching process in memory, 0 if not.
1982 #
1983 # Version: 1.0.2
1984 #
1985 # History: 1.0.1 - 07/24/2014 - Corey Swertfager:
1986 # * Added ProcessPattern and ProductName arguments.
1987 # * Added definitions of ProcessesToSkipPattern and
1988 # ProcessPatternDefault.
1989 # * Added -n option.
1990 # 1.0.2 - 08/27/2014 - Corey Swertfager:
1991 # * Now uses egrep instead of grep for process matching.
1992 # * Now excludes process that include the name of the
1993 # script that is running this function.
1994 # * Now excludes Symantec Uninstaller.app and SymantecRemovalTool
1995 # when no ProcessPattern is passed.
1996 # * Changed -c to -n in Usage.
1997 #
1998 local aUID
1999 local DoKill=true
2000 local ExclusionPattern
2001 local NoKillOption="-n"
2002 local ProcessesToSkipPattern="/LiveUpdateAdminUtility/|/RemoveSymantecMacFiles\.command|/RemoveSymantecMacFiles\.command|/Symantec Uninstaller.app|/SymantecRemovalTool"
2003 local ProcessPattern
2004 local ProcessPatternDefault="/Application Support/Norton|/Application Support/Symantec|/Applications/Norton|/Applications/Symantec|PrivateFrameworks/NPF|PrivateFrameworks/Sym|/StartupItems/.*Norton|/StartupItems/NUMCompatibilityCheck|/StartupItems/SMac Client|/StartupItems/Sym|/StartupItems/TrackDelete|/StartupItems/VolumeAssist"
2005 local ProductName
2006 local SavedIFS="$IFS"
2007 local UIAGENT_USERS
2008 if [ "z$1" = "z$NoKillOption" ] ; then
2009 shift
2010 DoKill=false
2011 fi
2012 ProcessPattern="$1"
2013 ProductName="$2"
2014 ExclusionPattern=`basename "$0" 2>/dev/null | sed 's/\./\\\./g'`
2015 # If script name was successfully obtained
2016 if [ "$ExclusionPattern" ] ; then
2017 # Add / + current script name to ExclusionPattern
2018 ExclusionPattern=" egrep -|/$ExclusionPattern$|/$ExclusionPattern "
2019 else
2020 ExclusionPattern=" egrep -"
2021 fi
2022 if [ -z "$ProcessPattern" ] ; then
2023 ProcessPattern="$ProcessPatternDefault"
2024 ProcessesToSkipPattern="$ExclusionPattern|$ProcessesToSkipPattern"
2025 else
2026 ProcessesToSkipPattern="$ExclusionPattern"
2027 fi
2028 if [ -z "$ProductName" ] ; then
2029 ProductName="Symantec"
2030 fi
2031 Processes=`ps -wwax | egrep -i "$ProcessPattern" | egrep -v "$ProcessesToSkipPattern" | sort -f | uniq`
2032 if [ $DoKill = true -a -n "$Processes" ] ; then
2033 IFS='
2034'
2035 # If launchctl program exists, unload SymUIAgent
2036 if which launchctl &>/dev/null ; then
2037 # Code by Haridharan Nattamaig to unload SymUIAgent
2038 UIAGENT_USERS=`ps -aef | grep SymUIAgent | grep -v grep | awk '{print $1}' | sort | uniq`
2039 for aUID in ${UIAGENT_USERS} ; do
2040 id -u ${aUID} >& /dev/null
2041 if [ $? -eq 0 ] ; then
2042 echo "Unloading SymUIAgent for UID $aUID"
2043 sudo -u \#${aUID} launchctl unload /Library/LaunchAgents/com.symantec.uiagent.application.plist >& /dev/null
2044 fi
2045 done
2046 fi
2047 echo "Ending $ProductName processes..."
2048 for TheProcess in $Processes ; do
2049 echo "$TheProcess"
2050 kill -9 `echo "z $TheProcess" | awk '{print $2}'`
2051 done
2052 IFS="$SavedIFS"
2053 Processes=`ps -wwax | egrep -i "$ProcessPattern" | egrep -v "$ProcessesToSkipPattern" | sort -f | uniq`
2054 fi
2055 if [ "$Processes" ] ; then
2056 if $DoKill ; then
2057 echo "*** $ProductName processes still in memory:"
2058 echo "$Processes"
2059 fi
2060 return 1
2061 else
2062 if $DoKill ; then
2063 echo "*** There are no $ProductName processes in memory"
2064 fi
2065 return 0
2066 fi
2067}
2068
2069KillTerminal()
2070{
2071 ProcessLines=`ps -axww | grep -e "/Applications/Utilities/Terminal.app" | grep -v grep | sort -f`
2072 if [ -z "$ProcessLines" ] ; then
2073 return
2074 elif [ `echo "$ProcessLines" | grep . -c` -gt 1 -a $QuitTerminalForcefullyForAll = false ] ; then
2075 echo "NOTE: Terminal was launched more than once so it could not be quit."
2076 echo " Use the -QQ option to force Terminal to be quit for all users."
2077 return
2078 else
2079 echo "WARNING: Quitting Terminal."
2080 fi
2081 IFS='
2082'
2083 for ProcessLine in $ProcessLines ; do
2084 ProcessID=`printf "%s" "$ProcessLine" | awk '{print $1}'`
2085 kill -9 "$ProcessID"
2086 done
2087}
2088
2089ProcessArguments()
2090{
2091 # Usage: ProcessArguments [ --OptionTakesUnparsedArgument=string ] [ --OptionIsOneArgument=string ] "$@"
2092 #
2093 # Version: 1.0.1
2094 #
2095 # Summary: Processes arguments passed to script. Arguments beginning with a
2096 # single hyphen (-) are parsed into separate options except when an
2097 # argument is negative integer. Arguments beginning with two hypens
2098 # are treated as one argument; if the argument contains is an equals
2099 # sign (=), the string after the first "=" is treated as a separate
2100 # argument (i.e., the value assigned to the double-hyphen argument).
2101 #
2102 # For each --OptionTakesUnparsedArgument passed before "$@", the string
2103 # after "=" is used as an option that takes the next argument in full
2104 # without parsing it (see examples below); string must be a hyphen
2105 # followed by a single character.
2106 #
2107 # For each --OptionIsOneArgument passed before "$@", the string after
2108 # "=" is used as an option that should be treated as a single argument.
2109 # This is useful when processing an argument that begins with a single
2110 # hyphen to avoid having that argument parsed into separate options.
2111 # The referenced option cannot be embedded within other options (see
2112 # final example below).
2113 #
2114 # "$@" must be the last argument passed to ProcessArguments. Put all custom
2115 # option handling between "--- Customized argument handling begins here ---"
2116 # and "--- Customized argument handling ends here ---".
2117 #
2118 # Note: ProcessArgumentsNextArgument may be called to verify and obtain the
2119 # next argument after or before a given option; see that function's usage
2120 # for more details. OriginalArgumentNumber can be used to determine if
2121 # two arguments were originally passed within the same string of options.
2122 #
2123 # Examples: These examples have expanded the arguments passed as "$@".
2124 #
2125 # ProcessArguments -ab -c
2126 # Would process three arguments: -a, -b, and -c
2127 # ProcessArguments --ab -c
2128 # Would process two arguments: --ab and -c
2129 # ProcessArguments --equation=a=b+c
2130 # Would process two arguments: --equation and a=b+c
2131 # ProcessArguments -10
2132 # Would process one argument: -10
2133 # ProcessArguments -10a
2134 # Would process three arguments: -1, -0, -a
2135 # ProcessArguments --OptionTakesUnparsedArgument=-e -e -ger
2136 # Would process two arguments: -e and -ger
2137 # ProcessArguments --OptionTakesUnparsedArgument=-e -peer
2138 # Would process three arguments: -p, -e, and er
2139 # ProcessArguments --OptionTakesUnparsedArgument=-e --OptionTakesUnparsedArgument=-t -eter -ter
2140 # Would process four arguments: -e, ter, -t, and er
2141 # ProcessArguments --OptionIsOneArgument=-hi -hi
2142 # Would process one argument: -hi
2143 # ProcessArguments --OptionIsOneArgument=-hi -his
2144 # Would process three arguments: -h, -i, and -s
2145 #
2146 # History: 1.0.1 - 06/23/2013 - Corey Swertfager:
2147 # * Added processing of options within a string that begins
2148 # with a single hyphen.
2149 # * Added --OptionTakesUnparsedArgument option.
2150 # * Added --OptionIsOneArgument option.
2151 #
2152 local ArgList=""
2153 local ArgsToAdd
2154 local ArgWasAdded=false
2155 local CurrentArgNumber=1
2156 local CurrentArgument
2157 local CurrentCharacter
2158 local DoNotParseNextArgument=false
2159 local NextArgument=""
2160 local NumberOfArgumentsPassed
2161 local NumberOfArgumentsToUse=0
2162 local OptionToAdd
2163 local OriginalArgumentNumber=0
2164 local OriginalArgumentNumberList=""
2165 local RemainingOptionsInString
2166 local TableOfOptionsWithoutParsing="*** Each option in this table will have its succeeding argument left unparsed. ***"
2167 local TableOfUndividedArguments="*** Each item in this table should each be treated as single argument. ***"
2168 while [ "$1" ] ; do
2169 case "$1" in
2170 --OptionIsOneArgument)
2171 ExitScript 99 "WARNING: Bad use of --OptionIsOneArgument passed to ProcessArguments:
2172 \"$1\""
2173 ;;
2174 --OptionIsOneArgument=*)
2175 OptionToAdd=`printf "%s" "$1" | awk '{match($0,"=") ; print substr($0,RSTART+1)}'`
2176 [ -z "$OptionToAdd" ] && ExitScript 99 "WARNING: Bad use of --OptionIsOneArgument passed to ProcessArguments:
2177 \"$1\""
2178 TableOfUndividedArguments="$TableOfUndividedArguments
2179$OptionToAdd"
2180 ;;
2181 --OptionTakesUnparsedArgument|--OptionTakesUnparsedArgument=*)
2182 OptionToAdd=`printf "%s" "$1" | awk '{match($0,"=") ; print substr($0,RSTART+1)}'`
2183 [ -z "`printf "%s" "$OptionToAdd" | grep -xe '-.'`" ] && ExitScript 99 "WARNING: Bad use of --OptionTakesUnparsedArgument passed to ProcessArguments:
2184 \"$1\""
2185 TableOfOptionsWithoutParsing="$TableOfOptionsWithoutParsing
2186$OptionToAdd"
2187 ;;
2188 *)
2189 break
2190 ;;
2191 esac
2192 shift
2193 done
2194 NumberOfArgumentsPassed=$#
2195 while [ $# != 0 ] ; do
2196 let OriginalArgumentNumber=$OriginalArgumentNumber+1
2197 # If argument is in the list of arguments whose next argument should not be parsed
2198 if [ "`printf "%s" "$1" | grep -xF "$TableOfOptionsWithoutParsing"`" ] ; then
2199 ArgsToAdd="$1"
2200 OriginalArgumentNumberList="$OriginalArgumentNumberList
2201$OriginalArgumentNumber"
2202 DoNotParseNextArgument=true
2203 # Else if argument is in the list of arguments that should be treated as one argument
2204 elif [ "`printf "%s" "$1" | grep -xF "$TableOfUndividedArguments"`" ] ; then
2205 ArgsToAdd="$1"
2206 OriginalArgumentNumberList="$OriginalArgumentNumberList
2207$OriginalArgumentNumber"
2208 else
2209 case "$1" in
2210 -|-?)
2211 # If argument was a hyphen or a hyphen followed by a single character
2212 ArgsToAdd="$1"
2213 OriginalArgumentNumberList="$OriginalArgumentNumberList
2214$OriginalArgumentNumber"
2215 DoNotParseNextArgument=false
2216 ;;
2217 --*)
2218 # If a value was passed to the option that begins with --
2219 if [ "`printf "%s" "$1" | grep =`" ] ; then
2220 # Add the option and its value as separate arguments
2221 ArgsToAdd="`printf "%s" "$1" | awk -F = '{print $1}'`
2222`printf "%s" "$1" | awk '{match($0,"=") ; print substr($0,RSTART+1)}'`"
2223 OriginalArgumentNumberList="$OriginalArgumentNumberList
2224$OriginalArgumentNumber
2225$OriginalArgumentNumber"
2226 else
2227 ArgsToAdd="$1"
2228 OriginalArgumentNumberList="$OriginalArgumentNumberList
2229$OriginalArgumentNumber"
2230 fi
2231 DoNotParseNextArgument=false
2232 ;;
2233 -*)
2234 # If argument should not be parsed or is a negative integer
2235 if [ $DoNotParseNextArgument = true -o -z "`printf "%s" "$1" | awk '{print substr($0,2)}' | tr -d '[:digit:]'`" ] ; then
2236 # Treat argument as a single argument
2237 ArgsToAdd="$1"
2238 OriginalArgumentNumberList="$OriginalArgumentNumberList
2239$OriginalArgumentNumber"
2240 DoNotParseNextArgument=false
2241 else
2242 # Parse string into separate arguments
2243 ArgsToAdd=""
2244 RemainingOptionsInString=`printf "%s" "$1" | awk '{print substr($0,2)}'`
2245 while [ "$RemainingOptionsInString" ] ; do
2246 CurrentCharacter=`printf "%s" "$RemainingOptionsInString" | awk '{print substr($0,1,1)}'`
2247 # Prefix the character with a hyphen and add as an argument
2248 if [ "$ArgsToAdd" ] ; then
2249 ArgsToAdd="$ArgsToAdd
2250-$CurrentCharacter"
2251 else
2252 ArgsToAdd="-$CurrentCharacter"
2253 fi
2254 OriginalArgumentNumberList="$OriginalArgumentNumberList
2255$OriginalArgumentNumber"
2256 RemainingOptionsInString=`printf "%s" "$RemainingOptionsInString" | awk '{print substr($0,2)}'`
2257 # If this is an option whose next string should not be parsed
2258 if [ "`printf "%s" "$TableOfOptionsWithoutParsing" | grep -xe "-$CurrentCharacter"`" ] ; then
2259 # If string has characters remaining after that option
2260 if [ "$RemainingOptionsInString" ] ; then
2261 # Add remainder of string as the unparsed string argument
2262 ArgsToAdd="$ArgsToAdd
2263$RemainingOptionsInString"
2264 OriginalArgumentNumberList="$OriginalArgumentNumberList
2265$OriginalArgumentNumber"
2266 else
2267 # Use next argument passed as unparsed string argument
2268 DoNotParseNextArgument=true
2269 fi
2270 break
2271 fi
2272 done
2273 fi
2274 ;;
2275 *)
2276 ArgsToAdd="$1"
2277 OriginalArgumentNumberList="$OriginalArgumentNumberList
2278$OriginalArgumentNumber"
2279 DoNotParseNextArgument=false
2280 ;;
2281 esac
2282 fi
2283 if $ArgWasAdded ; then
2284 ArgList="$ArgList
2285$ArgsToAdd"
2286 else
2287 ArgList="$ArgsToAdd"
2288 fi
2289 ArgWasAdded=true
2290 shift
2291 done
2292 if [ $NumberOfArgumentsPassed -gt 0 ] ; then
2293 # Add a non-blank line to ArgList in case last argument passed was ""
2294 ArgList="$ArgList
2295 TheEnd"
2296 OriginalArgumentNumberList=`echo "$OriginalArgumentNumberList" | grep .`
2297 NumberOfArgumentsToUse=`printf "%s" "$ArgList" | grep "" -c`
2298 let NumberOfArgumentsToUse=$NumberOfArgumentsToUse-1
2299 fi
2300 # --- Customized argument handling begins here ---
2301 BootVolumeWillBeSearched=false
2302 CreateFilesRemovedListOnly=false
2303 DoBackupLogs=true
2304 DoKillProcesses=true
2305 DoRemoveFSDFolders=true
2306 DoRemoveInstallerLaunchAgents=true
2307 DoRemoveIPUA=true
2308 DoRemoveLogs=true
2309 DoRunPredeleteScripts=true
2310 DoShowOnlyFilesThatShouldHaveBeenUninstalled=false
2311 FindOption1=""
2312 FindOption2=""
2313 ListOnlyFilesThatExist=false
2314 NoFilesToRemove=true
2315 PauseBeforeRestarting=true
2316 QuitTerminalForcefully=false
2317 QuitTerminalForcefullyForAll=false
2318 QuitWithoutRestarting=false
2319 $AutoRunScript && QuitWithoutRestarting=true
2320 RemoveCrontabEntries=true
2321 RemoveCrontabEntriesOnly=false
2322 RemoveInvisibleFiles=true
2323 RemoveInvisibleFilesOnly=false
2324 RemoveFromAllVolumes=false
2325 RemoveFromOtherVolumes=false
2326 RestartAutomatically=false
2327 RestartMayBeNeeded=false
2328 ShowFilesAsRemoved=true
2329 ShowOnlyRegularFiles=false
2330 ShowPredeleteErrors=false
2331 ShowQuitMessage=true
2332 SomeFileWasRemoved=false
2333 SomeFileWasRemovedFromNonBootVolume=false
2334 SomeFileWasRemovedFromBootVolume=false
2335 UseMore=false
2336 while [ $CurrentArgNumber -le $NumberOfArgumentsToUse ] ; do
2337 CurrentArgument=`printf "%s" "$ArgList" | head -n $CurrentArgNumber | tail -n 1`
2338 OriginalArgumentNumber=`echo "$OriginalArgumentNumberList" | head -n $CurrentArgNumber | tail -n 1`
2339 case "$CurrentArgument" in
2340 -A)
2341 RemoveFromAllVolumes=true
2342 BootVolumeWillBeSearched=true
2343 ;;
2344 -c)
2345 RemoveCrontabEntriesOnly=true
2346 RemoveCrontabEntries=true
2347 RemoveInvisibleFilesOnly=false
2348 RemoveInvisibleFiles=false
2349 ;;
2350 -C)
2351 RemoveCrontabEntriesOnly=false
2352 RemoveCrontabEntries=false
2353 ;;
2354 -d)
2355 DoRunPredeleteScripts=false
2356 ;;
2357 -e)
2358 ShowPredeleteErrors=true
2359 ;;
2360 -F)
2361 CreateFilesRemovedListOnly=true
2362 ListOnlyFilesThatExist=true
2363 ShowOnlyRegularFiles=true
2364 FindOption1=-type
2365 FindOption2=f
2366 ;;
2367 -f)
2368 ShowFilesAsRemoved=false
2369 ;;
2370 -g)
2371 DoRemoveLogs=false
2372 ;;
2373 -H)
2374 ShowUsage 0
2375 ;;
2376 -h)
2377 ShowHelp 0
2378 ;;
2379 -i)
2380 RemoveInvisibleFilesOnly=true
2381 RemoveInvisibleFiles=true
2382 RemoveCrontabEntries=false
2383 RemoveCrontabEntriesOnly=false
2384 ;;
2385 -I)
2386 RemoveInvisibleFilesOnly=false
2387 RemoveInvisibleFiles=false
2388 ;;
2389 -k)
2390 DoKillProcesses=false
2391 ;;
2392 -l|-R)
2393 CreateFilesRemovedListOnly=true
2394 ListOnlyFilesThatExist=true
2395 ;;
2396 -L)
2397 CreateFilesRemovedListOnly=true
2398 ListOnlyFilesThatExist=false
2399 ;;
2400 -m)
2401 UseMore=true
2402 ;;
2403 -p)
2404 PauseBeforeRestarting=false
2405 ;;
2406 -q)
2407 QuitWithoutRestarting=true
2408 RestartAutomatically=false
2409 ;;
2410 -Q)
2411 # If -Q was previously passed, treat as -QQ
2412 if $QuitTerminalForcefully ; then
2413 # Treat as if -QQ was passed
2414 QuitTerminalForcefullyForAll=true
2415 else
2416 QuitTerminalForcefullyForAll=false
2417 fi
2418 QuitTerminalForcefully=true
2419 QuitWithoutRestarting=true
2420 RestartAutomatically=false
2421 ;;
2422 -QQ)
2423 QuitTerminalForcefully=true
2424 QuitTerminalForcefullyForAll=true
2425 QuitWithoutRestarting=true
2426 RestartAutomatically=false
2427 ;;
2428 -r|-re)
2429 RestartAutomatically=true
2430 QuitWithoutRestarting=false
2431 ;;
2432 -u)
2433 DoShowOnlyFilesThatShouldHaveBeenUninstalled=true
2434 ;;
2435 -V)
2436 echo $Version
2437 ExitScript 0
2438 ;;
2439 *)
2440 AssignVolume "$CurrentArgument" # Assign it to a Volume variable
2441 # If not a valid volume
2442 if [ $? = 1 ] ; then
2443 ShowUsage 4 "ERROR: Invalid option or volume name: \"$CurrentArgument\"."
2444 fi
2445 RemoveFromOtherVolumes=true
2446 ;;
2447 esac
2448 let CurrentArgNumber=$CurrentArgNumber+1
2449 done
2450 if $DoShowOnlyFilesThatShouldHaveBeenUninstalled ; then
2451 CreateFilesRemovedListOnly=true
2452 ListOnlyFilesThatExist=true
2453 fi
2454 [ "`echo "$ListOfProgramsThatShouldNotBackUpLogs" | grep -x "$FullScriptName"`" ] && DoBackupLogs=false
2455 [ "`echo "$ListOfProgramsThatShouldNotKillProcesses" | grep -x "$FullScriptName"`" ] && DoKillProcesses=false
2456 [ "`echo "$ListOfProgramsThatShouldNotRemoveFSDFolders" | grep -x "$FullScriptName"`" ] && DoRemoveFSDFolders=false
2457 [ "`echo "$ListOfProgramsThatShouldNotRemoveInstallerLaunchAgents" | grep -x "$FullScriptName"`" ] && DoRemoveInstallerLaunchAgents=false
2458 [ "`echo "$ListOfProgramsThatShouldNotRemoveLogs" | grep -x "$FullScriptName"`" ] && DoRemoveLogs=false
2459 [ "`echo "$ListOfProgramsThatShouldNotRemoveSymantecIPUA" | grep -x "$FullScriptName"`" ] && DoRemoveIPUA=false
2460 # --- Customized argument handling ends here ---
2461}
2462
2463ProcessArgumentsNextArgument()
2464{
2465 # Usage: ProcessArgumentsNextArgument [exit_code] [-F | -P] [-p | -r ] [operator]
2466 #
2467 # Version: 1.0.0
2468 #
2469 # Arguments: exit_code Pass integer in range 0-255 to ShowUsage when next
2470 # argument is missing or invalid. If exit_code is not
2471 # specified, 0 is assumed.
2472 #
2473 # -F Assign the full logical path to NextArgumentFullPath.
2474 # This is the default. ShowFullFilePath function must
2475 # be included in script. If no operator was passed, -E
2476 # is the assumed operator.
2477 #
2478 # -P Assign the full physical path to NextArgumentFullPath.
2479 # ShowFullFilePath function must be included in script.
2480 # If no operator was passed, -e is the assumed operator.
2481 #
2482 # -p Get previous argument instead of next argument. If
2483 # there is no previous argument, sets NextArgument to ""
2484 # and returns 1.
2485 #
2486 # -r Return 1 instead of exiting script if there is no next
2487 # argument. Sets NextArgument to "".
2488 #
2489 # operator Operator used to test next argument:
2490 # -d Folder
2491 # -E File, folder, or link
2492 # -e File, folder, or link to an existing file/folder
2493 # -f File
2494 # -i [min [max]]
2495 # Integer in range min-max; pass "" to min and
2496 # an integer to max if there is no minimum but
2497 # a maximum is desired; pass "" to to both min
2498 # and max if passing another option after the -i
2499 # option. Also tests to see if the value of the
2500 # next argument is out of range for the currently
2501 # running version of Mac OS.
2502 # -L Link; does not check to see if link is broken
2503 # unless -P option was also passed
2504 # -l Link to an existing file/folder
2505 # -n Non-null string
2506 #
2507 # Summary: Called by ProcessArguments 1.0.1 or later to assign values to:
2508 #
2509 # CurrentArgNumber
2510 # NextArgument
2511 # NextArgumentFullPath
2512 # NextArgumentOriginalArgumentNumber
2513 #
2514 # using pre-existing values of:
2515 #
2516 # ArgList
2517 # CurrentArgNumber
2518 # CurrentArgument
2519 # OriginalArgumentNumberList
2520 # NumberOfArgumentsToUse
2521 #
2522 # Returns 0 if next or previous argument was assigned to NextArgument,
2523 # CurrentArgNumber was incremented (or decremented if -p was passed),
2524 # and NextArgumentOriginalArgumentNumber was assigned.
2525 #
2526 # Assigns "" to NextArgument and NextArgumentFullPath and returns 1 if
2527 # -p is passed and there is no previous argument, or if -r is passed
2528 # and there is no next argument; otherwise, calls ShowUsage to show
2529 # error message and exit script if operator test fails or if there is
2530 # no next or previous argument.
2531 #
2532 # Note: ShowFullFilePath function must be included in script in order to
2533 # assign a value to NextArgumentFullPath.
2534 #
2535 # Examples: ProcessArgumentsNextArgument
2536 # Returns 0 if there was a next argument; otherwise, passes 0 to
2537 # ShowUsage and displays error message about missing argument.
2538 # ProcessArgumentsNextArgument -r
2539 # Returns 0 if there was a next argument; otherwise, assigns "" to
2540 # NextArgument and NextArgumentFullPath, then returns 1.
2541 # ProcessArgumentsNextArgument 2 -d
2542 # Returns 0 if NextArgument was set to a folder; otherwise, passes
2543 # 2 to ShowUsage and displays error message if the next argument is
2544 # missing or is not a folder.
2545 # ProcessArgumentsNextArgument 3 -r -d
2546 # Returns 0 if NextArgument was set to a folder. If the next argument
2547 # is missing, assigns "" to NextArgument and NextArgumentFullPath,
2548 # then returns 1. If next argument is not a folder, passes 3 to
2549 # ShowUsage and displays error message.
2550 # ProcessArgumentsNextArgument 4 -i 1
2551 # Returns 0 if NextArgument was set to an integer; otherwise, passes
2552 # 4 to ShowUsage and displays error message if the next argument is
2553 # missing, is not an integer, or is less than 1.
2554 # ProcessArgumentsNextArgument -i "" 100 5
2555 # Returns 0 if NextArgument was set to an integer; otherwise, passes
2556 # 5 to ShowUsage and displays error message if the next argument is
2557 # missing, is not an integer, or is greater than 100.
2558 # ProcessArgumentsNextArgument -i "" "" 6
2559 # Returns 0 if NextArgument was set to an integer; otherwise, passes
2560 # 6 to ShowUsage and displays error message if the next argument is
2561 # missing or is not an integer.
2562 #
2563 local DoShowMissingError=true
2564 local DirectionText=after
2565 local ExitCode=0
2566 local ErrorText=""
2567 local GoToPreviousArgument=false
2568 local Max
2569 local Min
2570 local NextArgumentOriginal
2571 local PathOption=""
2572 local TestOperator=""
2573 NextArgumentFullPath=""
2574 while [ "$1" ] ; do
2575 case "$1" in
2576 -d)
2577 ErrorText="folder"
2578 TestOperator="$1"
2579 ;;
2580 -E)
2581 ErrorText="file, folder, or link"
2582 TestOperator="$1"
2583 ;;
2584 -e)
2585 ErrorText="file or folder"
2586 TestOperator="$1"
2587 ;;
2588 -F)
2589 PathOption="$1"
2590 if [ -z "$ErrorText" ] ; then
2591 ErrorText="file, folder, or link"
2592 TestOperator="-E"
2593 fi
2594 ;;
2595 -f)
2596 ErrorText="file"
2597 TestOperator="$1"
2598 ;;
2599 -i)
2600 ErrorText="integer"
2601 TestOperator="$1"
2602 Min="$2"
2603 Max="$3"
2604 shift 2
2605 ;;
2606 -L)
2607 ErrorText="link"
2608 TestOperator="$1"
2609 [ "z$PathOption" = "z-P" ] && ErrorText="unbroken link"
2610 ;;
2611 -l)
2612 ErrorText="unbroken link"
2613 TestOperator="-L"
2614 ;;
2615 -n)
2616 ErrorText="non-null string"
2617 TestOperator="$1"
2618 ;;
2619 -P)
2620 PathOption="$1"
2621 if [ -z "$ErrorText" ] ; then
2622 ErrorText="file or folder"
2623 TestOperator="-e"
2624 elif [ "$ErrorText" = "link" ] ; then
2625 ErrorText="unbroken link"
2626 fi
2627 ;;
2628 -p)
2629 GoToPreviousArgument=true
2630 DirectionText=before
2631 ;;
2632 -r)
2633 DoShowMissingError=false
2634 ;;
2635 *)
2636 ExitCode=`printf "%s" "$1" | tr -d -c "[:digit:]"`
2637 [ -z "$ExitCode" ] && ExitCode=0
2638 ;;
2639 esac
2640 shift
2641 done
2642 if $GoToPreviousArgument ; then
2643 if [ $CurrentArgNumber -gt 1 ] ; then
2644 let CurrentArgNumber=$CurrentArgNumber-1
2645 NextArgument=`printf "%s" "$ArgList" | head -n $CurrentArgNumber | tail -n 1`
2646 NextArgumentOriginalArgumentNumber=`echo "$OriginalArgumentNumberList" | head -n $CurrentArgNumber | tail -n 1`
2647 else
2648 NextArgument=""
2649 NextArgumentFullPath=""
2650 return 1
2651 fi
2652 # Else if there are no more arguments in ArgList
2653 elif [ $CurrentArgNumber = $NumberOfArgumentsToUse ] ; then
2654 if $DoShowMissingError ; then
2655 ShowUsage $ExitCode "ERROR: Nothing was passed after $CurrentArgument" >&2
2656 else
2657 NextArgument=""
2658 NextArgumentFullPath=""
2659 return 1
2660 fi
2661 else
2662 let CurrentArgNumber=$CurrentArgNumber+1
2663 NextArgument=`printf "%s" "$ArgList" | head -n $CurrentArgNumber | tail -n 1`
2664 NextArgumentOriginalArgumentNumber=`echo "$OriginalArgumentNumberList" | head -n $CurrentArgNumber | tail -n 1`
2665 fi
2666 NextArgumentFullPath=`ShowFullFilePath $PathOption "$NextArgument"`
2667 if [ "z$ErrorText" = zinteger ] ; then
2668 NextArgumentOriginal="$NextArgument"
2669 if [ -z "$NextArgument" ] ; then
2670 ShowUsage $ExitCode "ERROR: Argument passed $DirectionText $CurrentArgument is not an integer: \"$NextArgumentOriginal\"" >&2
2671 # Else if argument contains something other than a hyphen or digits
2672 elif [ "`printf "%s" "$NextArgument" | tr -d "[:digit:]-"`" ] ; then
2673 ShowUsage $ExitCode "ERROR: Argument passed $DirectionText $CurrentArgument is not an integer:
2674 \"$NextArgumentOriginal\"" >&2
2675 # Else if argument contains a hyphen that is not at the beginning
2676 elif [ "`printf "%s" "$NextArgument" | grep '..*-'`" ] ; then
2677 ShowUsage $ExitCode "ERROR: Argument passed $DirectionText $CurrentArgument is not an integer:
2678 \"$NextArgumentOriginal\"" >&2
2679 fi
2680 NextArgument=`expr "$NextArgument" / 1 2>/dev/null`
2681 test "$NextArgumentOriginal" -eq "$NextArgument" 2>/dev/null
2682 if [ $? != 0 ] ; then
2683 ShowUsage $ExitCode "ERROR: Value passed $DirectionText $CurrentArgument is out of range for this OS:
2684 $NextArgumentOriginal" >&2
2685 fi
2686 # If minimum value was specified
2687 if [ "$Min" ] ; then
2688 [ $NextArgument -lt $Min ] && ShowUsage $ExitCode "ERROR: Value passed $DirectionText $CurrentArgument ($NextArgumentOriginal) is less than
2689 minimum value ($Min)." >&2
2690 fi
2691 # If maximum value was specified
2692 if [ "$Max" ] ; then
2693 [ $NextArgument -gt $Max ] && ShowUsage $ExitCode "ERROR: Value passed $DirectionText $CurrentArgument ($NextArgumentOriginal) is greater than
2694 maximum value ($Max)." >&2
2695 fi
2696 elif [ "z$ErrorText" = "zfile, folder, or link" ] ; then
2697 [ ! -e "$NextArgument" -a ! -L "$NextArgument" ] && ShowUsage $ExitCode "ERROR: Argument passed $DirectionText $CurrentArgument is not a $ErrorText:
2698 \"$NextArgument\"" >&2
2699 elif [ "z$ErrorText" = "zunbroken link" ] ; then
2700 if [ ! -L "$NextArgument" ] ; then
2701 ShowUsage $ExitCode "ERROR: Argument passed $DirectionText $CurrentArgument is not a link:
2702 \"$NextArgument\"" >&2
2703 # Else if link is broken
2704 elif [ ! -e "$NextArgument" ] ; then
2705 ShowUsage $ExitCode "ERROR: The target of the link passed $DirectionText $CurrentArgument does not exist:
2706 \"$NextArgument\"" >&2
2707 fi
2708 elif [ "$ErrorText" ] ; then
2709 [ ! $TestOperator "$NextArgument" ] && ShowUsage $ExitCode "ERROR: Argument passed $DirectionText $CurrentArgument is not a $ErrorText:
2710 \"$NextArgument\"" >&2
2711 fi
2712 if [ "$PathOption" ] ; then
2713 if [ -z "$NextArgumentFullPath" ] ; then
2714 if [ -L "$NextArgument" ] ; then
2715 ShowUsage $ExitCode "ERROR: The target of the link passed $DirectionText $CurrentArgument does not exist:
2716 \"$NextArgument\"" >&2
2717 else
2718 ExitScript $ExitCode "WARNING: ShowFullFilePath function could not resolve path for:
2719 \"$NextArgument\"" >&2
2720 fi
2721 fi
2722 fi
2723 return 0
2724}
2725
2726RemoveAllNortonFiles()
2727{
2728 # Usage: RemoveAllNortonFiles $1
2729 # Argument: $1 = Volume name. The name should begin with "/Volumes/"
2730 # unless it is "/" (boot volume).
2731 # Summary: Removes all OS X Norton products' files and folders
2732 # from volume named by $1 if RemoveInvisibleFilesOnly
2733 # equals false; otherwise, removes only the invisible Norton
2734 # files. Removes the invisible Norton files from other
2735 # volumes that are passed to the script. Symantec crontab
2736 # entries are removed if RemoveCrontabEntries = true.
2737 #
2738 # If not a valid volume, return 1
2739 [ -z "`CheckIfValidVolume "$1"`" ] && return 1
2740 CurrentVolumeBeingUsed="$1"
2741 GetComputerUsers "$CurrentVolumeBeingUsed"
2742 if $CreateFilesRemovedListOnly ; then
2743 printf "" > "$FilesRemovedFilesOnlyList"
2744 echo "" >> "$FilesRemovedList"
2745 if [ `echo "$ListOfVolumesToUse" | grep -c .` -gt 1 ] ; then
2746 if [ "$1" = / ] ; then
2747 echo "------ Volume: / (current boot volume) ------" >> "$FilesRemovedList"
2748 else
2749 echo "------ Volume: \"`basename "$1"`\" ------" >> "$FilesRemovedList"
2750 fi
2751 echo "" >> "$FilesRemovedList"
2752 fi
2753 fi
2754 $RemoveCrontabEntries && DeleteCrontabEntries "$1"
2755 $RemoveCrontabEntries && DeleteLaunchdPlists "$1"
2756 $RemoveCrontabEntriesOnly && return 0
2757 ! $RemoveInvisibleFilesOnly && DeleteSymantecLoginItems "$1"
2758 if $CreateFilesRemovedListOnly ; then
2759 if ! $RemoveInvisibleFilesOnly ; then
2760 RunPredeleteScripts "$1"
2761 echo "" >> "$FilesRemovedList"
2762 fi
2763 if $ListOnlyFilesThatExist ; then
2764 echo "The following files/folders currently exist and would be removed unless" >> "$FilesRemovedList"
2765 echo "otherwise noted:" >> "$FilesRemovedList"
2766 else
2767 echo "$FullScriptName would attempt to find and remove the following:" >> "$FilesRemovedList"
2768 fi
2769 echo "" >> "$FilesRemovedList"
2770 fi
2771 RemoveInvisibleFilesFromVolume "$1"
2772 $RemoveInvisibleFilesOnly && return 0
2773 # If not just creating a list of removed files
2774 if ! $CreateFilesRemovedListOnly ; then
2775 RunPredeleteScripts "$1"
2776 # If removing files from the boot volume
2777 if [ "z$CurrentVolumeBeingUsed" = z/ ] ; then
2778 echo "Removing system profile if it exists: com.symc.enroll"
2779 profiles -R -p com.symc.enroll &>/dev/null
2780 # 7.0.55: If Norton WiFi Privacy Service is installed
2781 if [ -e "/Library/LaunchDaemons/com.symantec.NWPService.plist" ] ; then
2782 # Unload it
2783 launchctl unload /Library/LaunchDaemons/com.symantec.NWPService.plist
2784 fi
2785 # Kill Symantec processes before attempting to remove visible files (Etrack 3442959)
2786 $DoKillProcesses && KillSymantecProcesses
2787 fi
2788 fi
2789 # If not an OS X volume, return 1
2790 [ ! -d "$1/Library/Application Support" ] && return 1
2791 if $CreateFilesRemovedListOnly ; then
2792 $DoShowOnlyFilesThatShouldHaveBeenUninstalled || echo "Finding visible Symantec files on: $1" >&2
2793 elif $ShowFilesAsRemoved ; then
2794 echo "Locating visible Symantec files in: $1"
2795 else
2796 echo "Removing visible Symantec files from: $1"
2797 fi
2798 cd "$1"
2799 if [ "`pwd`" = "/" ] ; then
2800 VolumePrefix=""
2801 else
2802 VolumePrefix="`pwd`"
2803 fi
2804 KillNortonZone
2805 RemoveItem "/.com_symantec_symfs_private"
2806 RemoveItem "/.symSchedScanLockxz"
2807 RemoveItem "/Applications/Firefox.app/Contents/MacOS/extensions/{0e10f3d7-07f6-4f12-97b9-9b27e07139a5}"
2808 RemoveItem "/Applications/Firefox.app/Contents/MacOS/extensions/{29dd9c80-9ea1-4aaf-9305-a0314aba24e3}"
2809 RemoveItem "/Applications/Firefox.app/Contents/MacOS/extensions/nortonsafetyminder@symantec.com"
2810 RemoveItem "/Applications/GatherSymantecInfo"
2811 RemoveItem "/Applications/Late Breaking News"
2812 RemoveItem "/Applications/LiveUpdate"
2813 RemoveItem "/Applications/LiveUpdate Folder"
2814 RemoveItem "/Applications/LiveUpdate Folder (OS X)"
2815# Remove navx incorrectly installed by NAV 800.007 installer:
2816 RemoveItem "/Applications/navx"
2817 # 7.0.55: Exclude NWP so that it doesn't show up when -u script option is used
2818 RemoveItem "/Applications/Norton " "*" -x "Norton WiFi Privacy.app"
2819 # 7.0.55: Remove NWP app
2820 RemoveItem "/Applications/Norton WiFi Privacy.app" -u
2821 RemoveItem "/Applications/Symantec AntiVirus"
2822 RemoveItem "/Applications/Symantec Cloud Security.app"
2823 RemoveItem "/Applications/Symantec Endpoint Protection.app"
2824 RemoveItem "/Applications/Symantec Endpoint Protection Cloud.app"
2825 RemoveItem "/Applications/Symantec Solutions"
2826 RemoveItem "/Applications/Symantec Unified Endpoint Protection.app"
2827# The next 3 items are erroneously created by early builds of NAV 10 installer
2828 RemoveItem "/Applications/Symantec/LiveUpdate.app"
2829 RemoveItem "/Applications/Symantec/Read Me Files"
2830 RemoveItem "/Applications/Symantec" -e
2831 RemoveItem "/Applications/Trash Running Daemons"
2832 RemoveItem "/Applications/uDelete Preferences"
2833 RemoveItem "/Applications/Register Your Software"
2834 RemoveItem "/etc/liveupdate.conf"
2835 RemoveItem "/etc/mach_init.d/SymSharedSettings.plist"
2836 RemoveItem "/etc/Symantec.conf"
2837# Folder erroneously created by NPF 300.001 - removed if empty:
2838 RemoveItem "/Firewall" -e -u
2839 RemoveItem "/Library/Application Support/com.symantec.NWPService" -u
2840 RemoveItem "/Library/Application Support/NAVDiagnostic.log"
2841 RemoveItem "/Library/Application Support/NAV.history"
2842 RemoveItem "/Library/Application Support/nat_" "*" -u
2843 RemoveItem "/Library/Application Support/nat_" "*" -u
2844 RemoveItem "/Library/Application Support/nav_" "*" -u
2845 RemoveItem "/Library/Application Support/nis_" "*" -u
2846 RemoveItem "/Library/Application Support/nsm_" "*" -u
2847 RemoveItem "/Library/Application Support/Norton Application Aliases"
2848 RemoveItem "/Library/Application Support/Norton Solutions Support"
2849 RemoveItem "/Library/Application Support/norton_" "*" -u
2850 RemoveItem "/Library/Application Support/o2spy.log"
2851 RemoveItem "/Library/Application Support/regid.1992-12.com.symantec" "*"
2852 RemoveItem "/Library/Application Support/Symantec"
2853 $DoRemoveIPUA && RemoveItem "/Library/Application Support/Symantec_IPUA"
2854 RemoveItem "/Library/Application Support/symantec_uninstalldashboard" "*"
2855 RemoveItem "/Library/Application Support/SymRun"
2856 RemoveItem "/Library/Authenticators/SymAuthenticator.bundle"
2857 RemoveItem "/Library/CFMSupport/Norton Shared Lib"
2858 RemoveItem "/Library/CFMSupport/Norton Shared Lib Carbon"
2859 RemoveItem "/Library/Contextual Menu Items/NAVCMPlugIn.plugin"
2860 RemoveItem "/Library/Contextual Menu Items/SAVCMPlugIn.plugin"
2861 RemoveItem "/Library/Contextual Menu Items/SymFileSecurityCM.plugin"
2862 RemoveItem "/Library/Documentation/Help/LiveUpdate Help"
2863 RemoveItem "/Library/Documentation/Help/LiveUpdate-Hilfe"
2864 RemoveItem "/Library/Documentation/Help/Norton AntiVirus Help"
2865 RemoveItem "/Library/Documentation/Help/Norton AntiVirus-Hilfe"
2866 RemoveItem "/Library/Documentation/Help/Norton Help"
2867 RemoveItem "/Library/Documentation/Help/Norton Help Scripts"
2868 RemoveItem "/Library/Documentation/Help/Norton Help Scripts Folder"
2869 RemoveItem "/Library/Documentation/Help/Norton Utilities Help"
2870 RemoveItem "/Library/Extensions/FileSecurity.kext"
2871 RemoveItem "/Library/Extensions/ndcengine.kext"
2872 RemoveItem "/Library/Extensions/NortonForMac.kext"
2873 RemoveItem "/Library/Extensions/SymAPComm.kext"
2874 RemoveItem "/Library/Extensions/SymFirewall.kext"
2875 RemoveItem "/Library/Extensions/SymInternetSecurity.kext"
2876 RemoveItem "/Library/Extensions/SymIPS.kext"
2877 RemoveItem "/Library/Extensions/SymPersonalFirewall.kext"
2878 RemoveItem "/Library/Extensions/SymXIPS.kext"
2879 RemoveItem "/Library/Frameworks/mach_inject_bundle.framework"
2880 RemoveItem "/Library/InputManagers/Norton Confidential for Safari"
2881 RemoveItem "/Library/InputManagers/Norton Safety Minder"
2882 RemoveItem "/Library/InputManagers/SymWebKitUtils"
2883 RemoveItem "/Library/Internet Plug-Ins/Norton Confidential for Safari.plugin"
2884 RemoveItem "/Library/Internet Plug-Ins/Norton Family Safety.plugin"
2885 RemoveItem "/Library/Internet Plug-Ins/Norton Safety Minder.plugin"
2886 RemoveItem "/Library/Internet Plug-Ins/NortonFamilyBF.plugin"
2887 RemoveItem "/Library/Internet Plug-Ins/NortonInternetSecurityBF.plugin"
2888 RemoveItem "/Library/Internet Plug-Ins/NortonSafetyMinderBF.plugin"
2889 RemoveItem "/Library/LaunchDaemons/com.norton" "*"
2890 RemoveItem "/Library/LaunchDaemons/com.symantec" "*" -x 'com\.symantec\.saturn\.plist'
2891 RemoveCrashReporterLogs
2892 RemoveItem "/Library/Plug-ins/DiskImages/NUMPlugin.bundle"
2893 RemoveItem "/Library/Plug-ins/DiskImages/VRPlugin.bundle"
2894 RemoveItem "/Library/Plug-ins/DiskImages" -e -u
2895 RemoveItem "/Library/Plug-ins" -e -u
2896 RemoveItem "/Library/PreferencePanes/APPrefPane.prefPane"
2897 RemoveItem "/Library/PreferencePanes/FileSaver.prefPane"
2898 RemoveItem "/Library/PreferencePanes/Norton Family Safety.prefPane"
2899 RemoveItem "/Library/PreferencePanes/Norton Safety Minder.prefPane"
2900 RemoveItem "/Library/PreferencePanes/Ribbon.Norton.prefPane"
2901 RemoveItem "/Library/PreferencePanes/SymantecQuickMenu.prefPane"
2902 RemoveItem "/Library/PreferencePanes/SymAutoProtect.prefPane"
2903 RemoveItem "/Library/PrivateFrameworks/NPF.framework"
2904 RemoveItem "/Library/PrivateFrameworks/NPFCoreServices.framework"
2905 RemoveItem "/Library/PrivateFrameworks/NPFDataSource.framework"
2906 RemoveItem "/Library/PrivateFrameworks/PlausibleDatabase.framework"
2907 RemoveItem "/Library/PrivateFrameworks/SymAppKitAdditions.framework"
2908 RemoveItem "/Library/PrivateFrameworks/SymAVScan.framework"
2909 RemoveItem "/Library/PrivateFrameworks/SymBase.framework"
2910 RemoveItem "/Library/PrivateFrameworks/SymConfidential.framework"
2911 RemoveItem "/Library/PrivateFrameworks/SymDaemon.framework"
2912 RemoveItem "/Library/PrivateFrameworks/SymFirewall.framework"
2913 RemoveItem "/Library/PrivateFrameworks/SymInternetSecurity.framework"
2914 RemoveItem "/Library/PrivateFrameworks/SymIPS.framework"
2915 RemoveItem "/Library/PrivateFrameworks/SymIR.framework"
2916 RemoveItem "/Library/PrivateFrameworks/SymLicensing.framework"
2917 RemoveItem "/Library/PrivateFrameworks/SymNetworking.framework"
2918 RemoveItem "/Library/PrivateFrameworks/SymOxygen.framework"
2919 RemoveItem "/Library/PrivateFrameworks/SymPersonalFirewall.framework"
2920 RemoveItem "/Library/PrivateFrameworks/SymScheduler.framework"
2921 RemoveItem "/Library/PrivateFrameworks/SymSEP.framework"
2922 RemoveItem "/Library/PrivateFrameworks/SymSharedSettings.framework"
2923 RemoveItem "/Library/PrivateFrameworks/SymSubmission.framework"
2924 RemoveItem "/Library/PrivateFrameworks/SymSystem.framework"
2925 RemoveItem "/Library/PrivateFrameworks/SymUIAgent.framework"
2926 RemoveItem "/Library/PrivateFrameworks/SymUIAgentUI.framework"
2927 if [ ! -e "$VolumePrefix/Library/PrivateFrameworks/SymWebKitUtils.framework/Versions/A/Resources/SymWKULoader.dylib" \
2928 -o \( $CreateFilesRemovedListOnly = true -a $ListOnlyFilesThatExist = false \) ] ; then
2929 RemoveItem "/Library/PrivateFrameworks/SymWebKitUtils.framework"
2930 fi
2931 RemoveItem "/Library/PrivilegedHelperTools/com.symantec" "*" -x "com\.symantec\.NWPService"
2932 RemoveItem "/Library/PrivilegedHelperTools/com.symantec.NWPService" -u
2933 RemoveItem "/Library/PrivilegedHelperTools/NATRemoteLock.app"
2934 IFS='
2935'
2936 for EachReceiptLine in `echo "$ReceiptsTable" | grep . | grep -v '^#'` ; do
2937 ReceiptName=`echo "$EachReceiptLine" | awk -F " " '{print $1}'`
2938 ReceiptArg=`echo "$EachReceiptLine" | awk -F " " '{print $2}'`
2939 if [ "z$ReceiptArg" = z-a ] ; then
2940 RemoveItem "/Library/Receipts/$ReceiptName" "*"
2941 RemoveItem "/Library/Receipts/$ReceiptName"Dev "*"
2942 else
2943 if [ "z$ReceiptName" = zSymWebKitUtils.pkg -o "z$ReceiptName" = zSymWebKitUtilsDev.pkg ] ; then
2944 # If SymWKULoader exists and CleanUpSymWebKitUtils does not, skip deletion of SymWebKitUtils receipt
2945 [ -e "$VolumePrefix/Library/PrivateFrameworks/SymWebKitUtils.framework/Versions/A/Resources/SymWKULoader.dylib" -a ! -e /Library/StartupItems/CleanUpSymWebKitUtils ] && continue
2946 fi
2947 RemoveItem "/Library/Receipts/$ReceiptName"
2948 if [ "`echo "$ReceiptName" | grep '\.pkg$'`" ] ; then
2949 ReceiptName="`basename "$ReceiptName" .pkg`Dev.pkg"
2950 RemoveItem "/Library/Receipts/$ReceiptName"
2951 fi
2952 fi
2953 done
2954 RemoveItem "/Library/ScriptingAdditions/SymWebKitUtils.osax"
2955 RemoveItem "/Library/ScriptingAdditions/SymWebKitUtilsSL.osax"
2956 RemoveItem "/Library/Services/Norton for Mac.service"
2957 RemoveItem "/Library/Services/ScanService.service"
2958 RemoveItem "/Library/Services/Symantec" "*"
2959 RemoveItem "/Library/Services/SymSafeWeb.service"
2960 RemoveItem "/Library/Services" -e -u
2961 RemoveItem "/Library/StartupItems/NortonAutoProtect"
2962 RemoveItem "/Library/StartupItems/NortonAutoProtect.kextcache"
2963 RemoveItem "/Library/StartupItems/NortonLastStart"
2964 RemoveItem "/Library/StartupItems/NortonMissedTasks"
2965 RemoveItem "/Library/StartupItems/NortonPersonalFirewall"
2966 RemoveItem "/Library/StartupItems/NortonPrivacyControl"
2967 RemoveItem "/Library/StartupItems/NUMCompatibilityCheck"
2968 RemoveItem "/Library/StartupItems/SMC"
2969 RemoveItem "/Library/StartupItems/SymAutoProtect"
2970 RemoveItem "/Library/StartupItems/SymAutoProtect.kextcache"
2971 RemoveItem "/Library/StartupItems/SymDCInit"
2972 RemoveItem "/Library/StartupItems/SymMissedTasks"
2973 RemoveItem "/Library/StartupItems/SymProtector"
2974 RemoveItem "/Library/StartupItems/SymQuickMenuOSFix"
2975 RemoveItem "/Library/StartupItems/SymWebKitUtilsOSFix"
2976 RemoveItem "/Library/StartupItems/TrackDelete"
2977 RemoveItem "/Library/StartupItems/VolumeAssist"
2978 RemoveItem "/Library/Symantec/tmp"
2979 RemoveItem "/Library/Symantec" -E -u
2980 RemoveItem "/Library/Widgets/NAV.wdgt"
2981 RemoveItem "/Library/Widgets/Symantec Alerts.wdgt"
2982 RemoveItem "/Library/Widgets" -E -u
2983 RemoveItem "/Norton AntiVirus Installer Log"
2984# Folder with files erroneously created by an early Corsair installer:
2985 RemoveItem "/opt/Symantec"
2986# Folder erroneously created by that Corsair installer - removed if empty:
2987 RemoveItem "/opt" -E -u
2988# Folder erroneously created by NPF 300.001 - removed if empty:
2989 RemoveItem "/Personal" -e -u
2990# Folder erroneously created by NPF 300.001 - removed if empty:
2991 RemoveItem "/Solutions" -e -u
2992# Folder erroneously created by NPF 300.001 - removed if empty:
2993 RemoveItem "/Support/Norton" -e -u
2994# Folder erroneously created by NPF 300.001 - removed if empty:
2995 RemoveItem "/Support" -e -u
2996 RemoveItem "/symaperr.log"
2997 RemoveItem "/symapout.log"
2998# Four frameworks erroneously installed by early builds of NAV 9.0.1:
2999 RemoveItem "/SymAppKitAdditions.framework"
3000 RemoveItem "/SymBase.framework"
3001 RemoveItem "/SymNetworking.framework"
3002 RemoveItem "/SymSystem.framework"
3003 RemoveItem "/System/Library/Authenticators/SymAuthenticator.bundle"
3004 RemoveItem "/System/Library/CFMSupport/Norton Shared Lib Carbon"
3005 RemoveItem "/System/Library/CoreServices/NSWemergency"
3006 RemoveItem "/System/Library/CoreServices/NUMemergency"
3007 RemoveItem "/System/Library/Extensions/DeleteTrap.kext"
3008 RemoveItem "/System/Library/Extensions/KTUM.kext"
3009 RemoveItem "/System/Library/Extensions/ndcengine.kext"
3010 RemoveItem "/System/Library/Extensions/NortonForMac.kext"
3011 RemoveItem "/System/Library/Extensions/NPFKPI.kext"
3012 RemoveItem "/System/Library/Extensions/SymDC.kext"
3013 RemoveItem "/System/Library/Extensions/SymEvent.kext"
3014 RemoveItem "/System/Library/Extensions/symfs.kext"
3015 RemoveItem "/System/Library/Extensions/SymInternetSecurity.kext"
3016 RemoveItem "/System/Library/Extensions/SymIPS.kext"
3017 RemoveItem "/System/Library/Extensions/SymOSXKernelUtilities.kext"
3018 RemoveItem "/System/Library/Extensions/SymPersonalFirewall.kext"
3019 RemoveItem "/System/Library/Extensions/SymXIPS.kext"
3020 RemoveItem "/System/Library/StartupItems/NortonAutoProtect"
3021 RemoveItem "/System/Library/StartupItems/SymMissedTasks"
3022 RemoveItem "/System/Library/Symantec"
3023 RemoveItem "/System/Library/SymInternetSecurity.kext"
3024 RemoveItem "/SystemWorks Installer Log"
3025 RemoveItem "/tmp/com.symantec.liveupdate.reboot"
3026 RemoveItem "/tmp/com.symantec.liveupdate.restart"
3027 RemoveItem "/tmp/com.symantec.NFM.liveupdate.reboot"
3028 RemoveItem "/tmp/jlulogtemp"
3029 RemoveItem "/tmp/LiveUpdate." "*"
3030 RemoveItem "/tmp/liveupdate"
3031 RemoveItem "/tmp/lulogtemp"
3032 RemoveItem "/tmp/O2Spy.log"
3033 RemoveItem "/tmp/SymSharedFrameworks" "*"
3034 RemoveItem "/tmp/symask"
3035 RemoveItem "/Users/dev/bin/smellydecode"
3036 RemoveItem "/Users/dev/bin" -E -u
3037 RemoveItem "/Users/dev" -E -u
3038 RemoveItem "/Users/Shared/NAV Corporate"
3039 RemoveItem "/Users/Shared/NIS Corporate"
3040 RemoveItem "/Users/Shared/RemoveSymantecMacFilesRemovesThese.txt"
3041 RemoveItem "/Users/Shared/RemoveSymantecMacFilesLog.txt"
3042 RemoveItem "/Users/Shared/RemoveSymantecMacFilesRemovesThese.txt"
3043 RemoveItem "/Users/Shared/RemoveSymantecMacFilesLog.txt"
3044 RemoveItem "/Users/Shared/SymantecRemovalToolRemovesThese.txt"
3045 RemoveItem "/Users/Shared/SymantecRemovalToolLog.txt"
3046 RemoveItem "/usr/bin/nortonscanner"
3047 RemoveItem "/usr/bin/nortonsettings"
3048 RemoveItem "/usr/bin/MigrateQTF"
3049 RemoveItem "/usr/bin/navx"
3050 RemoveItem "/usr/bin/npfx"
3051 RemoveItem "/usr/bin/savx"
3052 RemoveItem "/usr/bin/scfx"
3053 RemoveItem "/usr/bin/symsched"
3054 RemoveItem "/usr/lib/libsymsea." "dylib"
3055 RemoveItem "/usr/lib/libwpsapi.dylib"
3056 RemoveItem "/usr/local/bin/CoreLocationProviderTest"
3057 RemoveItem "/usr/local/bin/KeyGenerator"
3058 RemoveItem "/usr/local/bin/LocationProviderInterfaceTest"
3059 RemoveItem "/usr/local/bin/LocationProviderTest"
3060 RemoveItem "/usr/local/bin/MigrateQTF"
3061 RemoveItem "/usr/local/bin/navx"
3062 RemoveItem "/usr/local/bin/nortonscanner"
3063 RemoveItem "/usr/local/bin/nortonsettings"
3064 RemoveItem "/usr/local/bin/npfx"
3065 RemoveItem "/usr/local/bin/SkyhookProviderTest"
3066 RemoveItem "/usr/local/bin" -E -u
3067 RemoveItem "/usr/local/lib/libAPFeature.a"
3068 RemoveItem "/usr/local/lib/libcx_lib.so"
3069 RemoveItem "/usr/local/lib/libecomlodr.dylib"
3070 RemoveItem "/usr/local/lib/libgecko3parsers.dylib"
3071 RemoveItem "/usr/local/lib/liblux.so." "*"
3072 RemoveItem "/usr/local/lib/libnlucallback.dylib"
3073 RemoveItem "/usr/local/lib/libsymsea." "dylib"
3074 RemoveItem "/usr/local/lib" -E -u
3075 RemoveItem "/usr/share/man/man1/NAVScanIDs.h"
3076 RemoveItem "/var/db/NATSqlDatabase.db"
3077 RemoveItem '/var/db/receipts/$(SYM_SKU_REVDOMAIN).install.bom'
3078 RemoveItem '/var/db/receipts/$(SYM_SKU_REVDOMAIN).install.plist'
3079 RemoveItem "/var/db/receipts/com.symantec" "*" -x "com\.symantec-it\..*"
3080 RemoveItem "/var/db/receipts/com.Symantec" "*" -x "com\.Symantec-it\..*"
3081 RemoveItem "/var/log/du.log" "*"
3082 RemoveItem "/var/log/dulux.log" "*"
3083 RemoveItem "/var/log/lut.log" "*"
3084 RemoveItem "/var/log/lux.log" "*"
3085 RemoveItem "/var/log/luxtool.log" "*"
3086 RemoveItem "/var/log/mexd.log" "*"
3087 RemoveItem "/var/log/microdef.log" "*"
3088 RemoveItem "/var/log/nortondns.log"
3089 RemoveItem "/var/log/Npfkernel.log.fifo"
3090 RemoveItem "/var/root/Applications/Norton Internet Security.app"
3091 RemoveItem "/var/root/Applications" -E
3092 RemoveItem "/var/root/Library/Bundles/NAVIR.bundle"
3093 RemoveItem "/var/root/Library/Bundles" -E -u
3094 RemoveItem "/var/root/Library/Contextual Menu Items/NAVCMPlugIn.plugin"
3095 RemoveItem "/var/root/Library/Contextual Menu Items" -E -u
3096 RemoveItem "/var/tmp/com.symantec" "*"
3097 RemoveItem "/var/tmp/com.Symantec" "*"
3098 RemoveItem "/var/tmp/symantec_error_report" "*"
3099 # Delete logs listed in logging conf files within /etc/symantec
3100 IFS='
3101'
3102 for LUXLogFile in `cat "/Library/Application Support/Symantec/Silo/NFM/LiveUpdate/Conf/lux.logging.conf" /etc/symantec/dulux.logging.conf /etc/symantec/lux.logging.conf /etc/symantec/microdef.logging.conf 2>/dev/null | tr '\015' '\012' | grep logger.sink.file.filePath= | awk -F = '{print $2}' | sort -f | uniq` ; do
3103 RemoveItem "$LUXLogFile" "*"
3104 done
3105 if [ -f /etc/symantec/defutils.conf ] ; then
3106 DefUtilsLogContents=`cat /etc/symantec/defutils.conf 2>/dev/null | tr '\015' '\012'`
3107 DefUtilsLogDir=`printf "%s" "$DefUtilsLogContents" | grep defutillog_dir= | awk -F = '{print $2}'`
3108 if [ "$DefUtilsLogDir" ] ; then
3109 DefUtilsLogBaseName=`printf "%s" "$DefUtilsLogContents" | grep defutillog_name= | awk -F = '{print $2}'`
3110 [ "$DefUtilsLogBaseName" ] && RemoveItem "$DefUtilsLogDir/$DefUtilsLogBaseName".log "*"
3111 fi
3112 fi
3113 RemoveItem "/etc/symantec" -d -x "saturn"
3114 RemoveItem "/etc/symantec" -E -u
3115 if [ -f "$VolumePrefix/etc/syslog.conf" -a $CreateFilesRemovedListOnly = false ] ; then
3116 # Remove Norton Personal Firewall entries from /etc/syslog.conf
3117 sed -e "/Norton Personal Firewall/d" -e "/Npfkernel.log.fifo/d" "$VolumePrefix/etc/syslog.conf" > /tmp/NPF.syslog.conf
3118 if [ -s /tmp/NPF.syslog.conf ] ; then
3119 /bin/cp -f /tmp/NPF.syslog.conf "$VolumePrefix/etc/syslog.conf"
3120 fi
3121 /bin/rm -f /tmp/NPF.syslog.conf
3122 fi
3123 RemoveFilesFromLibraryAndUserDirectories "$1"
3124 RemoveItem /Library/Preferences/Network -E -u
3125 if [ -s "$FilesRemovedFilesOnlyList" ] ; then
3126 sort -f "$FilesRemovedFilesOnlyList" | uniq | grep . >> "$FilesRemovedList"
3127 fi
3128 RemoveLoginKeychainPasswords "$CurrentVolumeBeingUsed"
3129 # If removing files from the boot volume
3130 if [ $CreateFilesRemovedListOnly = false -a "z$CurrentVolumeBeingUsed" = z/ ] ; then
3131 # Kill Symantec processes and attempt to remove Symantec folder again in case Symantec
3132 # folder was re-created with incorrect permissions (Etrack 3442959) while other files
3133 # were removed
3134 $DoKillProcesses && KillSymantecProcesses &>/dev/null
3135 RemoveItem "/Library/Application Support/Symantec"
3136 fi
3137}
3138
3139RemoveCrashReporterLogs()
3140{
3141 # Usage: RemoveCrashReporterLogs
3142 # Summary: Removes CrashReporter logs. GetComputerUsers function must be run
3143 # and VolumePrefix must be defined before running this function.
3144 #
3145 # CrashLogGrepPattern will match visible or invisible (name begins with a period) Symantec files
3146 local CrashLogGrepPattern='/\.?com\.norton|/\.?com\.symantec|/\.?LiveUpdate|\.?/LUTool|/\.?NFM|/\.?Norton|/\.?Sym'
3147 local LogsToDelete=""
3148 local LogToDelete
3149 local UserDir
3150 IFS='
3151'
3152 for UserDir in $ComputerUsersHomeDirsAndRootDir ; do
3153 [ "$UserDir" = / ] && UserDir=""
3154 LogsToDelete="$LogsToDelete
3155`find "$VolumePrefix$UserDir/Library/Application Support/CrashReporter" "$VolumePrefix$UserDir/Library/Application Support/DiagnosticReports" "$VolumePrefix$UserDir/Library/Logs/CrashReporter" "$VolumePrefix$UserDir/Library/Logs/DiagnosticReports" -type f 2>/dev/null | egrep -i "$CrashLogGrepPattern"`"
3156 done
3157 LogsToDelete=`echo "$LogsToDelete" | grep / | sort -f`
3158 if [ "$VolumePrefix" ] ; then
3159 # Remove VolumePrefix from beginning of paths
3160 LogsToDelete=`echo "$LogsToDelete" | awk -v VOLUME="$VolumePrefix" '{print substr($0,length(VOLUME)+1)}'`
3161 fi
3162 if [ "$LogsToDelete" ] ; then
3163 for LogToDelete in $LogsToDelete ; do
3164 RemoveItem "$LogToDelete" -u
3165 done
3166 fi
3167}
3168
3169RemoveEmptyDirectory()
3170{
3171 # Usage: RemoveEmptyDirectory $1
3172 # Argument: $1 = Full path name of directory
3173 # Summary: Removes directory $1 if it is empty or if it contains
3174 # only .DS_Store and/or .localized (the next best thing
3175 # to being empty).
3176 #
3177 # If $1 is a directory and not a link
3178 if [ -d "$1" -a ! -L "$1" ] ; then
3179 # If folder contains only .DS_Store and/or .localized, or is empty
3180 if [ -z "`ls "$1" 2>/dev/null | grep -v "^\.DS_Store\|^\.localized"`" ] ; then
3181 $ShowFilesAsRemoved && echo " Removing: \"$1\""
3182 # Clear immutable bit to remove any Finder lock
3183 chflags -R nouchg "$1" 2>/dev/null 1>&2
3184 /bin/rm -rf "$1" 2>/dev/null 1>&2 # Remove folder
3185 fi
3186 fi
3187}
3188
3189RemoveFilesFromLibraryAndUserDirectories()
3190{
3191 # Usage: RemoveFilesFromLibraryAndUserDirectories $1
3192 # Argument: $1 = Name of volume from which to remove preferences.
3193 # The name must begin with "/Volumes/"
3194 # unless it is "/" (boot volume).
3195 # Summary: Removes all Symantec files & folders from each user's
3196 # preferences, /Library/Caches, and /Library/Preferences.
3197 # Removes help files from /Library/Documentation. Removes
3198 # folders incorrectly created by NAV 7.0.2 from each
3199 # user's home directory.
3200 #
3201 local FSDDir
3202 local UserHomeDir
3203 local UserLibraryDir
3204 CurrentVolumeBeingUsed="$1"
3205 if [ "$1" = "/" ] ; then
3206 VolumeToCheck=""
3207 else
3208 VolumeToCheck="$1"
3209 fi
3210 # set IFS to only newline to get all user names
3211 IFS='
3212'
3213 for UserHomeDir in $ComputerUsersHomeDirsAndRootDir ; do
3214 if [ "$UserHomeDir" = "/" ] ; then
3215 UserHomeDir=""
3216 fi
3217 UserLibraryDir="$UserHomeDir/Library"
3218 # If UserLibraryDir is not a directory, skip to the next name
3219 [ ! -d "$VolumeToCheck$UserLibraryDir" ] && continue
3220 cd "$VolumeToCheck/"
3221 # If a user's home directory, delete folders from user's home directory
3222 # that were incorrectly created by NAV 7.0.2
3223 if [ "$UserHomeDir" ] ; then
3224 RemoveItem "$UserHomeDir/Applications/LiveUpdate Folder (OS X)"
3225 RemoveItem "$UserHomeDir/Applications/Norton AntiVirus (OS X)"
3226 RemoveItem "$UserHomeDir/Applications" -e -u
3227 fi
3228 FirefoxExtensions=`find "$UserLibraryDir/Application Support/Firefox/Profiles/"*/extensions/*"@symantec.com.xpi" 2>/dev/null`
3229 for FirefoxExtension in $FirefoxExtensions ; do
3230 RemoveItem "$FirefoxExtension"
3231 done
3232 RemoveItem "$UserLibraryDir/Application Support/Norton" "*"
3233 # If a user directory
3234 if [ "$UserHomeDir" ] ; then
3235 RemoveItem "$UserLibraryDir/Application Support/Symantec"
3236 RemoveItem "$UserHomeDir/Application Support/Symantec"
3237 RemoveItem "$UserHomeDir/Application Support" -e
3238 # If .fsd folders should be removed
3239 if $DoRemoveFSDFolders ; then
3240 # For each .fsd folder in user's Downloads folder
3241 for FSDDir in `find "$UserHomeDir/Downloads" -type d -name ".fsd" 2>/dev/null` ; do
3242 RemoveItem "$FSDDir"
3243 done
3244 fi
3245 elif ! $CreateFilesRemovedListOnly ; then
3246 # Make second attempt to remove "/Application Support/Symantec/ErrorReporting"
3247 RemoveItem "$UserLibraryDir/Application Support/Symantec/ErrorReporting"
3248 RemoveItem "$UserLibraryDir/Application Support/Symantec"
3249 fi
3250 RemoveItem "$UserLibraryDir/Documentation/Help/Norton Privacy Control Help"
3251 RemoveItem "$UserLibraryDir/Documentation/Help/Norton Personal Firewall Help"
3252 RemoveItem "$UserLibraryDir/Caches/com.apple.Safari/Extensions/Norton" "*" -u
3253 RemoveItem "$UserLibraryDir/Caches/com.apple.Safari/Extensions/Symantec" "*" -u
3254 RemoveItem "$UserLibraryDir/Caches/com.norton" "*" -u
3255 RemoveItem "$UserLibraryDir/Caches/com.symantec" "*" -u
3256 RemoveItem "$UserLibraryDir/Caches/Norton" "*" -u
3257 RemoveItem "$UserLibraryDir/Caches/Symantec" "*" -u
3258 if $DoRemoveIPUA ; then
3259 # If not a user directory
3260 if [ -z "$UserHomeDir" ] ; then
3261 RemoveItem "$UserLibraryDir/LaunchAgents/com.symantec" "*"
3262 elif $DoRemoveInstallerLaunchAgents ; then
3263 RemoveItem "$UserLibraryDir/LaunchAgents/com.symantec" "*"
3264 else
3265 RemoveItem "$UserLibraryDir/LaunchAgents/com.symantec" "*" -x 'com\.symantec\..*Installer\.plist'
3266 fi
3267 else
3268 # If not a user directory
3269 if [ -z "$UserHomeDir" ] ; then
3270 RemoveItem "$UserLibraryDir/LaunchAgents/com.symantec" "*" -x 'com\.symantec\.ipua\.plist'
3271 elif $DoRemoveInstallerLaunchAgents ; then
3272 RemoveItem "$UserLibraryDir/LaunchAgents/com.symantec" "*" -x 'com\.symantec\.ipua\.plist'
3273 else
3274 RemoveItem "$UserLibraryDir/LaunchAgents/com.symantec" "*" -x 'com\.symantec\..*Installer\.plist' -x 'com\.symantec\.ipua\.plist'
3275 fi
3276 fi
3277 RemoveItem "$UserLibraryDir/Logs/.ipuaint"
3278 RemoveItem "$UserLibraryDir/Logs/.ipualog"
3279 RemoveItem "$UserLibraryDir/Logs/LUTool.txt"
3280 RemoveItem "$UserLibraryDir/Logs/Norton" "*"
3281 RemoveItem "$UserLibraryDir/Logs/o2spy.log"
3282 RemoveItem "$UserLibraryDir/Logs/Symantec" "*"
3283# RemoveItem "$UserLibraryDir/Logs/Symantec" "*" -u # May need to add this back with refined matching
3284 RemoveItem "$UserLibraryDir/Logs/SymaIpua" "*"
3285 RemoveItem "$UserLibraryDir/Logs/SymAPErr.log"
3286 RemoveItem "$UserLibraryDir/Logs/SymAPOut.log"
3287 RemoveItem "$UserLibraryDir/Logs/SymBfw_NFM.log"
3288 RemoveItem "$UserLibraryDir/Logs/SymCommP" "*"
3289 RemoveItem "$UserLibraryDir/Logs/SymDebugLeaks.log"
3290 RemoveItem "$UserLibraryDir/Logs/SymDeepsight" "*"
3291 RemoveItem "$UserLibraryDir/Logs/SymFWDeepSightTrie.txt"
3292 RemoveItem "$UserLibraryDir/Logs/SymFWLog.log"
3293 RemoveItem "$UserLibraryDir/Logs/SymFWRules.log" "*"
3294 RemoveItem "$UserLibraryDir/Logs/SymHTTPSubmissions.txt"
3295 RemoveItem "$UserLibraryDir/Logs/SymInstall" "*"
3296 RemoveItem "$UserLibraryDir/Logs/SymIpua" "*"
3297 RemoveItem "$UserLibraryDir/Logs/SymOxygen" "*"
3298 RemoveItem "$UserLibraryDir/Logs/SymQual" "*"
3299 RemoveItem "$UserLibraryDir/Logs/SymScanServerDaemon.log"
3300 RemoveItem "$UserLibraryDir/Logs/SymSharedSettingsd.log"
3301 RemoveItem "$UserLibraryDir/Logs/SymUninstall" "*"
3302 RemoveItem "$UserLibraryDir/Logs/UIAgent" "*"
3303 RemoveItem "$UserLibraryDir/Preferences/ByHost/com.symantec" "*"
3304 RemoveItem "$UserLibraryDir/Preferences/com.norton" "*"
3305 if $DoRemoveIPUA ; then
3306 RemoveItem "$UserLibraryDir/Preferences/com.symantec" "*" -x 'com\.symantec\.sacm.*' -x 'com\.symantec\.smac.*'
3307 else
3308 RemoveItem "$UserLibraryDir/Preferences/com.symantec" "*" -x 'com\.symantec\.sacm.*' -x 'com\.symantec\.smac.*' -x 'com\.symantec\.ipua\.plist'
3309 fi
3310 RemoveItem "$UserLibraryDir/Preferences/group.com.symantec" "*"
3311 RemoveItem "$UserLibraryDir/Preferences/group.symantec" "*"
3312 RemoveItem "$UserLibraryDir/Preferences/LiveUpdate Preferences"
3313 RemoveItem "$UserLibraryDir/Preferences/LU Admin Preferences"
3314 RemoveItem "$UserLibraryDir/Preferences/LU Host Admin.plist"
3315 RemoveItem "$UserLibraryDir/Preferences/NAV8.0.003.plist"
3316 RemoveItem "$UserLibraryDir/Preferences/Network/com.symantec" "*"
3317 RemoveItem "$UserLibraryDir/Preferences/Norton AntiVirus Prefs Folder"
3318 RemoveItem "$UserLibraryDir/Preferences/Norton Application Aliases"
3319 RemoveItem "$UserLibraryDir/Preferences/Norton Personal Firewall Log"
3320 RemoveItem "$UserLibraryDir/Preferences/Norton Scheduler OS X.plist"
3321 RemoveItem "$UserLibraryDir/Preferences/Norton Utilities Preferences"
3322 RemoveItem "$UserLibraryDir/Preferences/Norton Zone"
3323 RemoveItem "$UserLibraryDir/Preferences/wcid"
3324 RemoveItem "$UserLibraryDir/Safari/Extensions/Norton" "*"
3325 RemoveItem "$UserLibraryDir/Safari/Extensions/Symantec" "*"
3326 RemoveItem "$UserLibraryDir/Saved Application State/com.symantec" "*" -u
3327 done
3328}
3329
3330RemoveInvisibleFilesFromVolume()
3331{
3332 # Usage: RemoveInvisibleFilesFromVolume $1
3333 # Argument: $1 = Volume name. The name should begin with "/Volumes/"
3334 # unless it is "/" (boot volume).
3335 # Summary: Removes the invisible Symantec for OS X files - Norton FS
3336 # and AntiVirus QuickScan files - from $1.
3337 #
3338 ! $RemoveInvisibleFiles && return
3339 CurrentVolumeBeingUsed="$1"
3340 cd "$1"
3341 if $CreateFilesRemovedListOnly ; then
3342 $DoShowOnlyFilesThatShouldHaveBeenUninstalled || echo "Finding invisible Symantec files on: $1" >&2
3343 elif $ShowFilesAsRemoved ; then
3344 echo "Locating invisible Symantec files in: $1"
3345 else
3346 echo "Removing invisible Symantec files from: $1"
3347 fi
3348 RemoveItem "/.SymAVQSFile"
3349 RemoveItem "/NAVMac800QSFile"
3350 RemoveItem "/Norton FS Data"
3351 RemoveItem "/Norton FS Index"
3352 RemoveItem "/Norton FS Volume"
3353 RemoveItem "/Norton FS Volume 2"
3354}
3355
3356RemoveItem()
3357{
3358 # Usage: RemoveItem ["private_was_added"] FilePath [-d] [-e | -E] [-u] [-x <pattern>] [FileExtension]
3359 #
3360 # Summary: Deletes the file or folder passed, FilePath, from the
3361 # current directory. FilePath should be full path beginning
3362 # with /.
3363 #
3364 # Options:
3365 # -d Treat FilePath as a directory in which to match FileExtension
3366 # or when using the -x option. See FileExtension and -x option
3367 # below. The -d must be passed prior to passing the -x option.
3368 # FilePath itself will not be deleted, only the matching items
3369 # within it will be deleted. If no FileExtension is passed, "*"
3370 # is assumed.
3371 # -e Delete FilePath only if it is a directory that is empty or
3372 # that contains only ".DS_Store" and/or ".localized" files.
3373 # If the folder could not be deleted, error message is shown.
3374 # -E Same as the -e option, except no error message is shown if
3375 # the folder could not be deleted.
3376 # -u Item is not removed by Symantec Uninstaller.app.
3377 # -x <Pattern>
3378 # Pattern to exclude from file list. Pattern will become
3379 # ^FilePathPattern$ (or ^FilePath/Pattern$ if -d was passed
3380 # before -x was passed) so add wildcards as needed. Make sure
3381 # to prefix special characters you wish to match with \
3382 # (example: to match a period, \.). You may pass several
3383 # -x <pattern> groupings. Pattern is an extended regular
3384 # expression. Letter case is ignored.
3385 # <FileExtension>
3386 # All files are deleted that match FilePath.*FileExtension or
3387 # if -d was passed that match FilePath/.*FileExtension.
3388 # To match any files that begin with FilePath, pass "*" as
3389 # FileExtension (don't pass * unquoted). Only the last
3390 # FileExtension passed will be used. Periods will be escaped
3391 # (i.e., each . will become \.).
3392 # "private_was_added"
3393 # This gets passed as the first argument by RemoveItem() when
3394 # FilePath is a link in PrivateLinksPattern. This option is
3395 # only to be passed by RemoveItem() itself.
3396 #
3397 # Note: Make sure to run the SetupCleanup function before the
3398 # first run of this function and run the FinishCleanup
3399 # function before exiting the script.
3400 #
3401 # Make sure to change directory to root of the volume you
3402 # want the file or folder removed from before calling this
3403 # function.
3404 #
3405 # FilePath must be the first argument unless "private_was_added"
3406 # was passed as the first. The other options may appear after
3407 # FilePath in any order.
3408 #
3409 local ExclusionPattern=""
3410 local FilePath="$1"
3411 shift
3412 # If / or no file name passed
3413 if [ "z$FilePath" = z/ -o -z "$FilePath" ] ; then
3414 return
3415 # Else if this is a call by RemoveItem() with /private added to original path
3416 elif [ "z$FilePath" = zprivate_was_added ] ; then
3417 FilePath="$1"
3418 shift
3419 # Else if original path begins with /private/ and is targeted by a link in /
3420 elif [ "`echo "$FilePath" | egrep -e "$PrivateDirectoriesPattern"`" ] ; then
3421 # Remove /private from beginning of path
3422 FilePath=`echo "$FilePath" | awk '{print substr($0,9)}'`
3423 fi
3424 VolumeFromWhichToRemove="`pwd`"
3425 # If path passed begins with /etc/, /tmp/, or /var/
3426 if [ "`echo "$FilePath" | egrep -e "$PrivateLinksPattern"`" ] ; then
3427 PrivateLinkName=`echo "$FilePath" | awk -F / '{print $2}'`
3428 PrivateLinkRoot="$VolumeFromWhichToRemove/$PrivateLinkName"
3429 PrivateDirRoot="$VolumeFromWhichToRemove/private/$PrivateLinkName"
3430 # If path does not point to the same file as "/private/" + path
3431 if [ ! "$PrivateLinkRoot" -ef "$PrivateDirRoot" ] ; then
3432 FilePathOriginal="$FilePath"
3433 # Attempt to remove path from within /private first
3434 RemoveItem "private_was_added" "/private$FilePath" "$@"
3435 # Then attempt to remove path itself
3436 FilePath="$FilePathOriginal"
3437 fi
3438 fi
3439 if [ "$VolumeFromWhichToRemove" = "/" ] ; then
3440 FullFilePath="$FilePath"
3441 else
3442 FullFilePath="$VolumeFromWhichToRemove$FilePath"
3443 fi
3444 # If logs should not be removed
3445 if ! $DoRemoveLogs ; then
3446 # If file path contains "/Library/Logs/", skip removal
3447 if [ "`echo "$FullFilePath" | egrep '/Library/Logs/'`" ] ; then
3448 return
3449 fi
3450 fi
3451 PathDir=`dirname "$FullFilePath"`
3452 [ -z "$PathDir" ] && return
3453 # Set PathBasePattern = basename of path with each . translated to \.
3454 PathBasePattern=`basename "$FullFilePath" | sed s/"\."/"\\\\\."/g`
3455 [ -z "$PathBasePattern" ] && return
3456 DeleteOnlyIfEmptyDir=false
3457 ExtensionPassed=""
3458 PathIsDirectory=false
3459 SkipErrorMessageIfEmptyDirNotFound=false
3460 ShouldNotBeRemovedBySymantecUninstaller=false
3461 while [ "$1" ] ; do
3462 case "$1" in
3463 -d)
3464 PathDir="$FullFilePath"
3465 PathBasePattern=""
3466 PathIsDirectory=true
3467 ;;
3468 -e)
3469 DeleteOnlyIfEmptyDir=true
3470 SkipErrorMessageIfEmptyDirNotFound=false
3471 ;;
3472 -E)
3473 DeleteOnlyIfEmptyDir=true
3474 SkipErrorMessageIfEmptyDirNotFound=true
3475 ;;
3476 -u)
3477 ShouldNotBeRemovedBySymantecUninstaller=true
3478 ;;
3479 -x)
3480 if [ "$2" ] ; then
3481 shift
3482 if [ "$ExclusionPattern" ] ; then
3483 ExclusionPattern="$ExclusionPattern|^$PathDir/$1$"
3484 else
3485 ExclusionPattern="^$PathDir/$1$"
3486 fi
3487 fi
3488 ;;
3489 *)
3490 ExtensionPassed="$1"
3491 ;;
3492 esac
3493 shift
3494 done
3495 if [ "z$ExtensionPassed" = "z*" ] ; then
3496 ListOfPaths=`find "$PathDir" -mindepth 1 -maxdepth 1 2>/dev/null | grep -i "^$PathDir/$PathBasePattern" | sort -f`
3497 PathToShow="$FullFilePath`$PathIsDirectory && echo /`*"
3498 elif [ "$ExtensionPassed" ] ; then
3499 ExtensionPassedPattern=`printf "%s" "$ExtensionPassed" | sed s/"\."/"\\\\\."/g`
3500 ListOfPaths=`find "$PathDir" -mindepth 1 -maxdepth 1 2>/dev/null | grep -i "^$PathDir/$PathBasePattern.*$ExtensionPassedPattern$" | sort -f`
3501 PathToShow="$FullFilePath*$ExtensionPassed"
3502 elif $PathIsDirectory ; then
3503 ListOfPaths=`find "$FullFilePath" -mindepth 1 -maxdepth 1 2>/dev/null | sort -f`
3504 PathToShow="$FullFilePath/*"
3505 else
3506 ListOfPaths=`ls -d "$FullFilePath" 2>/dev/null`
3507 PathToShow="$FullFilePath"
3508 fi
3509 # If there are items to exclude from the list and there are matching items
3510 if [ "z$ExclusionPattern" != z -a -n "$ListOfPaths" ] ; then
3511 ListOfPaths=`printf "%s" "$ListOfPaths" | egrep -i -v -e "$ExclusionPattern"`
3512 fi
3513 if $CreateFilesRemovedListOnly ; then
3514 # If -E passed, then don't list the item
3515 $SkipErrorMessageIfEmptyDirNotFound && return
3516 if ! $ListOnlyFilesThatExist ; then
3517 echo "$PathToShow`$DeleteOnlyIfEmptyDir && echo " [folder deleted only if empty]"`" >> "$FilesRemovedList"
3518 # Else if file exists
3519 elif [ "$ListOfPaths" ] ; then
3520 ItemsToAddToList=""
3521 IFS='
3522'
3523 if $DeleteOnlyIfEmptyDir ; then
3524 $ShowOnlyRegularFiles || ItemsToAddToList="$ListOfPaths"
3525 else
3526 for EachItemListed in $ListOfPaths ; do
3527 if [ -f "$EachItemListed" ] ; then
3528 ItemsToAddToList="$ItemsToAddToList
3529$EachItemListed"
3530 elif [ -L "$EachItemListed" -a $ShowOnlyRegularFiles = false ] ; then
3531 ItemsToAddToList="$ItemsToAddToList
3532$EachItemListed"
3533 else
3534 ItemsToAddToList="$ItemsToAddToList
3535`find "$EachItemListed" $FindOption1 $FindOption2 2>/dev/null`"
3536 fi
3537 done
3538 fi
3539 for EachItemFound in $ItemsToAddToList ; do
3540 if $ShouldNotBeRemovedBySymantecUninstaller ; then
3541 AddedText="$NotRemovedBySymantecUninstallerText"
3542 elif [ "`echo "$EachItemFound" | grep -F "$NotRemovedByNIS6Uninstaller"`" ] ; then
3543 AddedText="$NotRemovedByNIS6UninstallerText"
3544 elif [ "`echo "$EachItemFound" | grep -F "$NotRemovedBySymantecUninstaller"`" ] ; then
3545 AddedText="$NotRemovedBySymantecUninstallerText"
3546 else
3547 AddedText=""
3548 fi
3549 if $ShowOnlyRegularFiles ; then
3550 # If would be an empty folder or would not be removed by Symantec Uninstaller, don't add item to the list
3551 [ $DeleteOnlyIfEmptyDir = true -o -n "$AddedText" ] && continue
3552 fi
3553 echo "$EachItemFound`$DeleteOnlyIfEmptyDir && echo " [folder deleted only if empty]"`$AddedText" >> "$FilesRemovedFilesOnlyList"
3554 done
3555 NoFilesToRemove=false
3556 FilesFoundOnThisVolume=true
3557 fi
3558 return
3559 fi
3560 IFS='
3561'
3562 for EachFullPath in $ListOfPaths ; do
3563 # If -e or -E was passed
3564 if $DeleteOnlyIfEmptyDir ; then
3565 # remove directory only if empty
3566 RemoveEmptyDirectory "$EachFullPath"
3567 # If -E passed, then skip error reporting
3568 $SkipErrorMessageIfEmptyDirNotFound && continue
3569 else
3570 $ShowFilesAsRemoved && echo " Removing: \"$EachFullPath\""
3571 # Clear immutable bit to remove any Finder lock
3572 chflags -R nouchg "$EachFullPath" 2>/dev/null 1>&2
3573 BackupLog "$EachFullPath"
3574 /bin/rm -rf "$EachFullPath" 2>/dev/null 1>&2 # Remove file/folder
3575 fi
3576 # If file still exists
3577 if [ "`ls -d "$EachFullPath" 2>/dev/null`" ] ; then
3578 TheFileWasRemoved=false
3579 else
3580 TheFileWasRemoved=true
3581 SomeFileWasRemoved=true
3582 fi
3583 # If the file/folder was not removed
3584 if ! $TheFileWasRemoved ; then
3585 if ! $ErrorOccurred ; then
3586 # Create LogFile
3587 echo "Symantec files/folders not removed:" >"$LogFile"
3588 chmod a=rw "$LogFile"
3589 ErrorOccurred=true
3590 fi
3591 echo " $EachFullPath" >>"$LogFile"
3592 # Else if boot volume
3593 elif [ "$CurrentVolumeBeingUsed" = "/" ] ; then
3594 RestartMayBeNeeded=true
3595 # If it's not a file that does not require a restart (Etrack 3925328)
3596 if [ -z "`printf "%s" "$EachFullPath" | egrep -ie "$FilesThatDoNotRequireRebootPattern"`" ] ; then
3597 touch "$SymantecCleanupRestartFile"
3598 fi
3599 SomeFileWasRemovedFromBootVolume=true
3600 else
3601 SomeFileWasRemovedFromNonBootVolume=true
3602 fi
3603 NoFilesToRemove=false
3604 FilesFoundOnThisVolume=true
3605 done
3606}
3607
3608RemoveLoginKeychainPasswords()
3609{
3610 # Usage: RemoveLoginKeychainPasswords volume
3611 # Summary: Removes items from login keychains.
3612 # If volume is not / (current boot volume), removal is skipped.
3613 # If volume is not specified, / is assumed.
3614 #
3615 local VolumeBeingPurged="$1"
3616 local ComputerUserEntry
3617 local EachLoginKeychain
3618 local HelpTextToShow
3619 local LoginKeychainPasswordToDelete
3620 local LoginKeychainPasswordToDeleteLine
3621 local UserDir
3622 local UserOfKeychain
3623 # If volume not specified, assume it is boot volume
3624 [ -z "$VolumeBeingPurged" ] && VolumeBeingPurged=/
3625 # If volume being cleaned up is not the boot volume, skip purge
3626 [ "z$VolumeBeingPurged" != z/ ] && return
3627 $DoShowOnlyFilesThatShouldHaveBeenUninstalled || echo "Looking for Symantec login keychain items" 2>/dev/null
3628 IFS='
3629'
3630 for ComputerUserEntry in $ComputerUsersTable ; do
3631 UserOfKeychain=`echo "$ComputerUserEntry" | awk -F ' ' '{print $1}'`
3632 UserDir=`echo "$ComputerUserEntry" | awk -F ' ' '{print $2}'`
3633 EachLoginKeychain="$UserDir/Library/Keychains/login.keychain"
3634 [ ! -f "$EachLoginKeychain" ] && continue
3635 for LoginKeychainPasswordToDeleteLine in $LoginKeychainPasswordsToDelete ; do
3636 LoginKeychainPasswordToDelete=`echo "$LoginKeychainPasswordToDeleteLine" | awk -F ' ' '{print $1}'`
3637 HelpTextToShow=`echo "$LoginKeychainPasswordToDeleteLine" | awk -F ' ' '{print $2}'`
3638 /usr/bin/security find-generic-password -s "$LoginKeychainPasswordToDelete" "$EachLoginKeychain" 2>/dev/null 1>&2
3639 if [ $? = 0 ] ; then
3640 if $CreateFilesRemovedListOnly ; then
3641 echo "$HelpTextToShow ($LoginKeychainPasswordToDelete) would be removed" >> "$FilesRemovedList"
3642 echo "from $UserOfKeychain's login keychain" >> "$FilesRemovedList"
3643 echo "" >> "$FilesRemovedList"
3644 else
3645 echo "Removing $HelpTextToShow ($LoginKeychainPasswordToDelete)"
3646 echo "from $UserOfKeychain's login keychain"
3647 /usr/bin/security delete-generic-password -s "$LoginKeychainPasswordToDelete" "$EachLoginKeychain" 2>/dev/null 1>&2
3648 fi
3649 fi
3650 done
3651 done
3652}
3653
3654RemoveNortonZoneDirectories()
3655{
3656 # Usage: RemoveNortonZoneDirectories user_home_directory
3657 # Summary: Removes Norton Zone paths listed in zoneDirectoryManagerRegistryKey in
3658 # user_home_directory/Preference/com.symantec.nds.Norton-Zone.plist
3659 #
3660 local UserHomeDir="$1"
3661 local ZonePath
3662 local ZonePaths
3663 [ ! -d "$UserHomeDir" ] && return
3664 ZonePaths=`defaults read "$UserHomeDir/Library/Preferences/"com.symantec.nds.Norton-Zone zoneDirectoryManagerRegistryKey 2>/dev/null | grep = | awk -F '"' '{print $2}'`
3665 IFS='
3666'
3667 for ZonePath in $ZonePaths ; do
3668 RemoveItem "$ZonePath"
3669 done
3670 RemoveItem "$UserHomeDir/Norton Zone" "*"
3671}
3672
3673RestartComputer()
3674{
3675 # Usage: RestartComputer
3676 # Summary: Prompts to see if user would like to restart. Restarts
3677 # computer using 'reboot' command if 'yes' or 'y' is
3678 # entered; exits the script otherwise.
3679 # Note: User must be root or an admin for reboot to work, so this
3680 # function should only be used in scripts run as root or
3681 # admin user.
3682 #
3683 echo
3684 if $RunningFromWithinAppBundleOrSupportFolder ; then
3685 ExitScript $FinishedExitCode
3686 elif $QuitWithoutRestarting ; then
3687 echo "Exited the script without restarting the computer."
3688 ExitScript $FinishedExitCode
3689 fi
3690 if $RestartAutomatically ; then
3691 if $PauseBeforeRestarting ; then
3692 printf "Computer will restart in 3 seconds (ctrl-C to cancel restart)..."
3693 sleep 1 &>/dev/null
3694 printf " 3"
3695 sleep 1 &>/dev/null
3696 printf " 2"
3697 sleep 1 &>/dev/null
3698 printf " 1"
3699 sleep 1 &>/dev/null
3700 fi
3701 echo
3702 echo "Computer is restarting..."
3703 reboot
3704 else
3705 echo "Exited the script without restarting the computer."
3706 ExitScript $FinishedExitCode
3707 fi
3708}
3709
3710RunPredeleteScripts()
3711{
3712 # Usage: RunPredeleteScripts [$1]
3713 # Argument: $1 = Path of current volume.
3714 # Summary: If $1 is "" or /, predelete scripts in receipts listed in
3715 # ReceiptsTable are run.
3716 #
3717 local EachReceiptLine
3718 local EachReceiptMatchingAll
3719 local ReceiptList
3720 local ReceiptListMatchingAll=""
3721 local VolumePathPassed="$1"
3722 [ "z$VolumePathPassed" = z/ ] && VolumePathPassed=""
3723 if $CreateFilesRemovedListOnly ; then
3724 if [ "$VolumePathPassed" ] ; then
3725 echo "Receipt predelete scripts would not be run on that volume." >> "$FilesRemovedList"
3726 elif $DoRunPredeleteScripts ; then
3727 echo "Receipt predelete scripts would be run as they are found." >> "$FilesRemovedList"
3728 else
3729 echo "Receipt predelete scripts would not be run because the -d option was specified." >> "$FilesRemovedList"
3730 fi
3731 return
3732 elif [ "$VolumePathPassed" ] ; then
3733 echo "Receipt predelete scripts were not run on that volume."
3734 return
3735 elif ! $DoRunPredeleteScripts ; then
3736 echo "Receipt predelete scripts were not run because the -d option was specified."
3737 return
3738 fi
3739 SYMANTEC_SAVED_DATA_DIR="/private/tmp/$FullScriptName-SYMANTEC_SAVED_DATA_DIR-`date +"%Y%m%d%H%M%S"`"
3740 mkdir -p "$SYMANTEC_SAVED_DATA_DIR" 2>/dev/null
3741 IFS='
3742'
3743 echo "Looking for predelete scripts in Symantec Uninstaller's Receipts folder"
3744 for PredeleteScript in `find "/Library/Application Support/Symantec/Uninstaller" 2>/dev/null | grep -E 'predelete$|pre_delete$'` ; do
3745 if [ -x "$PredeleteScript" ] ; then
3746 echo "--- Running $PredeleteScript ---"
3747 export SYMANTEC_SAVED_DATA_DIR
3748 if $ShowPredeleteErrors ; then
3749 "$PredeleteScript"
3750 else
3751 "$PredeleteScript" 2>/dev/null 1>&2
3752 fi
3753 fi
3754 done
3755 echo "Looking for predelete scripts in /Library/Receipts"
3756 ReceiptList=`echo "$ReceiptsTable" | grep '\.pkg' | grep -v '^#'`
3757 for EachReceiptMatchingAll in `echo "$ReceiptsTable" | grep ' -a' | grep -v '^#' | awk -F ' ' '{print $1}'` ; do
3758 ReceiptListMatchingAll="$ReceiptListMatchingAll
3759`ls -d "/Library/Receipts/$EachReceiptMatchingAll"* 2>/dev/null`"
3760 done
3761 for EachReceiptMatchingAll in $ReceiptListMatchingAll ; do
3762 ReceiptList="$ReceiptList
3763`basename "$EachReceiptMatchingAll"`"
3764 done
3765 for EachReceiptLine in $ReceiptList ; do
3766 ReceiptArg=`echo "$EachReceiptLine" | awk -F " " '{print $2}'`
3767 [ "z$ReceiptArg" = z-s ] && continue
3768 ReceiptName=`echo "$EachReceiptLine" | awk -F " " '{print $1}'`
3769 [ -z "`echo "$ReceiptName" | grep '\.pkg$'`" ] && continue
3770 if [ -d "/Library/Receipts/$ReceiptName" ] ; then
3771 for PredeleteScript in `find "/Library/Receipts/$ReceiptName" 2>/dev/null | grep -E 'predelete$|pre_delete$'` ; do
3772 if [ -x "$PredeleteScript" ] ; then
3773 echo "--- Running $PredeleteScript ---"
3774 export SYMANTEC_SAVED_DATA_DIR
3775 if $ShowPredeleteErrors ; then
3776 "$PredeleteScript"
3777 else
3778 "$PredeleteScript" 2>/dev/null 1>&2
3779 fi
3780 fi
3781 done
3782 fi
3783 ReceiptName="`basename "$ReceiptName" .pkg`Dev.pkg"
3784 if [ -d "/Library/Receipts/$ReceiptName" ] ; then
3785 for PredeleteScript in `find "/Library/Receipts/$ReceiptName" 2>/dev/null | grep -E 'predelete$|pre_delete$'` ; do
3786 if [ -x "$PredeleteScript" ] ; then
3787 echo "--- Running $PredeleteScript ---"
3788 export SYMANTEC_SAVED_DATA_DIR
3789 if $ShowPredeleteErrors ; then
3790 "$PredeleteScript"
3791 else
3792 "$PredeleteScript" 2>/dev/null 1>&2
3793 fi
3794 fi
3795 done
3796 fi
3797 done
3798 rm -rf "$SYMANTEC_SAVED_DATA_DIR" 2>/dev/null
3799}
3800
3801SetupCleanup()
3802{
3803 # Usage: SetupCleanup
3804 # Summary: Initializes variables needed for the RemoveItem function.
3805 #
3806 BackupLogLocationDir="$BackupLogLocationRootDir/`date +"%Y-%m-%d_%H-%M-%S"`"
3807 ErrorOccurred=false
3808 NoFilesToRemove=true
3809 /bin/rm -rf "$FilesRemovedList" "$FilesRemovedFilesOnlyList" 2>/dev/null 1>&2
3810 if $CreateFilesRemovedListOnly ; then
3811 if $ListOnlyFilesThatExist ; then
3812 echo "Summary of what $FullScriptName would do, based on files" > "$FilesRemovedList"
3813 echo "`$RemoveCrontabEntries && echo "and crontab entries "`that currently exist:" >> "$FilesRemovedList"
3814 else
3815 echo "Summary of what $FullScriptName would attempt to do:" > "$FilesRemovedList"
3816 fi
3817 fi
3818}
3819
3820ShowContents()
3821{
3822 # Usage1: ShowContents [-c] [-w] File [TextToShow]
3823 # Usage2: ShowContents [-c] [-w] -s String [TextToShow]
3824 # Summary: Displays contents of File or String. If there are more than
3825 # $LINES or 23 lines, more command is used, using TextToShow as
3826 # the name of the file; if TextToShow is not passed, "....." is
3827 # used. If -c is specified, screen is cleared beforehand.
3828 # If -w is specified, then width of strings will be factored
3829 # into the line count (this option makes output slower when
3830 # the number of lines is less than $LINES or 23).
3831 #
3832 local SCLineCount
3833 local SCCurrentDir
3834 local SCTempFolder
3835 local SCTempFile
3836 local SCColumns
3837 local SCColumnsMax
3838 local SCColumnsMaxDefault=80
3839 local SCColumnsRemainder
3840 local CSDoAdjustForWidth=false
3841 local CSDoUseString=false
3842 local SCEachLine
3843 local SCGrepPattern='.'
3844 local SCLineFactor
3845 local SCLines
3846 local SCLinesMax
3847 local SCLinesMaxDefault=23
3848 local SCText
3849 while [ "$1" ] ; do
3850 if [ "z$1" = z-c ] ; then
3851 clear
3852 elif [ "z$1" = z-s ] ; then
3853 CSDoUseString=true
3854 elif [ "z$1" = z-w ] ; then
3855 CSDoAdjustForWidth=true
3856 else
3857 break
3858 fi
3859 shift
3860 done
3861 [ "$COLUMNS" ] && SCColumnsMax=`expr "$COLUMNS" - 0 2>/dev/null`
3862 [ -z "$SCColumnsMax" ] && SCColumnsMax=$SCColumnsMaxDefault
3863 [ "$LINES" ] && SCLinesMax=`expr "$LINES" - 1 2>/dev/null`
3864 [ -z "$SCLinesMax" ] && SCLinesMax=$SCLinesMaxDefault
3865 [ $SCColumnsMax -ge $SCColumnsMaxDefault ] && SCGrepPattern='.................................................................................'
3866 if $CSDoUseString ; then
3867 SCLineCount=`printf "%s\n" "$1" | grep -c ""`
3868 $CSDoAdjustForWidth && SCText=`printf "%s\n" "$1" | grep "$SCGrepPattern"`
3869 elif [ -f "$1" ] ; then
3870 SCLineCount=`grep -c "" "$1"`
3871 $CSDoAdjustForWidth && SCText=`grep "$SCGrepPattern" "$1"`
3872 else
3873 return 1
3874 fi
3875 if $CSDoAdjustForWidth ; then
3876 if [ $SCLineCount -le $SCLinesMax ] ; then
3877 IFS='
3878'
3879 for SCColumns in `printf "%s" "$SCText" | awk '{print length($0)}'` ; do
3880 [ $SCLineCount -gt $SCLinesMax ] && break
3881 SCLineFactor=`expr $SCColumns / $SCColumnsMax`
3882 [ `expr $SCColumns % $SCColumnsMax` -gt 0 ] && let SCLineFactor=$SCLineFactor+1
3883 [ $SCLineFactor -gt 1 ] && let SCLineCount=$SCLineCount+$SCLineFactor-1
3884 done
3885 fi
3886 fi
3887 if $CSDoUseString ; then
3888 if [ $SCLineCount -gt $SCLinesMax ] ; then
3889 SCCurrentDir=`pwd`
3890 SCTempFolder="/private/tmp/$FullScriptName-SC-`date +"%Y%m%d%H%M%S"`"
3891 mkdir "$SCTempFolder" 2>/dev/null
3892 [ ! -d "$SCTempFolder" ] && return 1
3893 cd "$SCTempFolder" 2>/dev/null
3894 [ "$2" ] && SCTempFile="$2" || SCTempFile="....."
3895 printf "%s\n" "$1" >"$SCTempFile"
3896 more -E "$SCTempFile"
3897 cd "$SCCurrentDir" 2>/dev/null
3898 rm -rf "$SCTempFolder" 2>/dev/null
3899 else
3900 printf "%s\n" "$1"
3901 fi
3902 elif [ -f "$1" ] ; then
3903 if [ $SCLineCount -gt $SCLinesMax ] ; then
3904 SCCurrentDir=`pwd`
3905 SCTempFolder="/private/tmp/$FullScriptName-SC-`date +"%Y%m%d%H%M%S"`"
3906 mkdir "$SCTempFolder" 2>/dev/null
3907 [ ! -d "$SCTempFolder" ] && return 1
3908 [ "$2" ] && SCTempFile="$2" || SCTempFile="....."
3909 cat "$1" >"$SCTempFolder/$SCTempFile"
3910 cd "$SCTempFolder" 2>/dev/null
3911 more -E "$SCTempFile"
3912 cd "$SCCurrentDir" 2>/dev/null
3913 rm -rf "$SCTempFolder" 2>/dev/null
3914 else
3915 cat "$1"
3916 fi
3917 fi
3918 return 0
3919}
3920
3921ShowFullFilePath()
3922{
3923 # Usage: ShowFullFilePath [-a] [-P | -L] [-e] Path [[-e] Path]
3924 # Version: 1.0.2
3925 # Summary: Prints the full path starting at / of Path if Path exists
3926 # and Path is accessible by the user calling this function.
3927 # Run this function as root to ensure full path displaying.
3928 # If there is more than one existing file that matches the
3929 # name, then only the first path that the shell matches is
3930 # printed unless -a or more than one path is specified.
3931 # You can specify wild card characters ? and * and other
3932 # argument operators in the Path (e.g., "../*", "a?.txt",
3933 # "[ab]*").
3934 # Options: -a Show all matching paths, sorted alphanumerically. If
3935 # -P is not passed, the same file may be shown multiple
3936 # times if there is more than one matching link that
3937 # points to it.
3938 # -e <Path>
3939 # Treat argument after -e as a path. Use -e to treat
3940 # -a, -e, -L, or -P as a path.
3941 # -L Show logical path, even if a file pointed to by a link
3942 # doesn't exist. This is the default.
3943 # -P Show physical path. If a link points to a file that
3944 # does not exist, the path won't be shown.
3945 # History: 1.0.1 - Added -e option and ability to pass multiple paths.
3946 # Arguments can now be passed in any order.
3947 # Fixed error that could occur when resolving links
3948 # with long paths.
3949 # 1.0.2 - Modified for case-sensitive volume compatibility.
3950 # Made temporary file names more distinctive.
3951 #
3952 local SFFPArgCount=$#
3953 local SFFPCurrentDir
3954 local SFFPCurrentDirTranslated
3955 local SFFPEachLine
3956 local SFFPEachPath
3957 local SFFPFile
3958 local SFFPLDir
3959 local SFFPLLinkLS
3960 local SFFPLLinkPath
3961 local SFFPLPath
3962 local SFFPPathOption=-L
3963 local SFFPSaveIFS="$IFS"
3964 local SFFPShowAll=false
3965 local SFFPTempBase=/private/tmp/ShowFullFilePath-`/usr/bin/basename "$0"`-`/bin/date +"%Y%m%d%H%M%S"`
3966 local SFFPTempFile="$SFFPTempBase.tmp"
3967 local SFFPTempFile2="$SFFPTempBase-2.tmp"
3968 /bin/rm -f "$SFFPTempFile" 2>/dev/null
3969 while [ $SFFPArgCount != 0 ] ; do
3970 case "$1" in
3971 -a)
3972 SFFPShowAll=true
3973 ;;
3974 -L|-P)
3975 SFFPPathOption="$1"
3976 ;;
3977 *)
3978 [ "z$1" = z-e ] && shift
3979 if [ "$1" ] ; then
3980 [ -s "$SFFPTempFile" ] && SFFPShowAll=true
3981 /usr/bin/printf "%s\n" "$1" >>"$SFFPTempFile"
3982 fi
3983 ;;
3984 esac
3985 shift
3986 let SFFPArgCount=$SFFPArgCount-1
3987 done
3988 [ ! -s "$SFFPTempFile" ] && return
3989 SFFPCurrentDir=`/bin/pwd`
3990 SFFPCurrentDirTranslated=`/bin/pwd $SFFPPathOption 2>/dev/null`
3991 if [ ! -d "$SFFPCurrentDirTranslated" ] ; then
3992 /bin/rm -f "$SFFPTempFile" 2>/dev/null
3993 return
3994 fi
3995 cd "$SFFPCurrentDirTranslated" 2>/dev/null
3996 if [ $? != 0 ] ; then
3997 /bin/rm -f "$SFFPTempFile" 2>/dev/null
3998 return
3999 fi
4000 /usr/bin/printf "" >"$SFFPTempFile2"
4001 IFS='
4002'
4003 for SFFPEachLine in `/bin/cat "$SFFPTempFile" 2>/dev/null` ; do
4004 cd "$SFFPCurrentDirTranslated" 2>/dev/null
4005 [ $? != 0 ] && break
4006 if [ "z$SFFPPathOption" = z-P ] ; then
4007 SFFPLPath="$SFFPEachLine"
4008 while [ -L "$SFFPLPath" ] ; do
4009 [ ! -e "$SFFPLPath" ] && break
4010 cd "`/usr/bin/dirname "$SFFPLPath" 2>/dev/null`" 2>/dev/null
4011 [ $? != 0 ] && break
4012 SFFPLDir=`/bin/pwd -P 2>/dev/null`
4013 [ ! -d "$SFFPLDir" ] && break
4014 SFFPLLinkLS=`/bin/ls -ld "$SFFPLPath" 2>/dev/null`
4015 [ -z "$SFFPLLinkLS" ] && break
4016 # If link or link target contains " -> " in its name
4017 if [ "`echo "z$SFFPLLinkLS" | grep ' -> .* -> '`" ] ; then
4018 SFFPLLinkPath=`/usr/bin/printf "%s" "$SFFPLLinkLS" | /usr/bin/awk -v THESTR="$SFFPLPath -> " '{ match($0,THESTR) ; print substr($0,RSTART+RLENGTH)}'`
4019 else
4020 SFFPLLinkPath=`echo "$SFFPLLinkLS" | awk -F " -> " '{print $2}'`
4021 fi
4022 # If link target begins with /
4023 if [ "`/usr/bin/printf "%s" "$SFFPLLinkPath" | grep '^/'`" ] ; then
4024 SFFPLPath="$SFFPLLinkPath"
4025 else
4026 SFFPLPath="$SFFPLDir/$SFFPLLinkPath"
4027 fi
4028 [ "`/usr/bin/printf "%s" "$SFFPLPath" | grep '^//'`" ] && SFFPLPath=`echo "$SFFPLPath" | /usr/bin/awk '{print substr($0,2)}'`
4029 done
4030 cd "$SFFPCurrentDirTranslated" 2>/dev/null
4031 [ $? != 0 ] && break
4032 if [ ! -e "$SFFPLPath" ] ; then
4033 $SFFPShowAll && continue || break
4034 fi
4035 SFFPEachPath="$SFFPLPath"
4036 else
4037 SFFPEachPath="$SFFPEachLine"
4038 fi
4039 if [ -d "$SFFPEachPath" ] ; then
4040 cd "$SFFPEachPath" 2>/dev/null
4041 if [ $? != 0 ] ; then
4042 $SFFPShowAll && continue || break
4043 fi
4044 SFFPFile=""
4045 elif [ -d "`/usr/bin/dirname "$SFFPEachPath" 2>/dev/null`" ] ; then
4046 cd "`/usr/bin/dirname "$SFFPEachPath" 2>/dev/null`" 2>/dev/null
4047 if [ $? != 0 ] ; then
4048 $SFFPShowAll && continue || break
4049 fi
4050 SFFPFile=`basename "$SFFPEachPath" 2>/dev/null`
4051 [ "z$SFFPFile" = z/ -o "z$SFFPFile" = z. -o "z$SFFPFile" = z.. ] && SFFPFile=""
4052 elif $SFFPShowAll ; then
4053 continue
4054 else
4055 break
4056 fi
4057 SFFPDir=`/bin/pwd $SFFPPathOption 2>/dev/null`
4058 if [ ! -d "$SFFPDir" ] ; then
4059 $SFFPShowAll && continue || break
4060 fi
4061 SFFPPath="$SFFPDir`[ "z$SFFPFile" != z -a "z$SFFPDir" != z/ -a "z$SFFPDir" != z// ] && echo /`$SFFPFile"
4062 if [ ! -e "$SFFPPath" -a ! -L "$SFFPPath" ] ; then
4063 $SFFPShowAll && continue || break
4064 fi
4065 [ "`echo "$SFFPPath" | grep '^//'`" ] && SFFPPath=`echo "$SFFPPath" | /usr/bin/awk '{print substr($0,2)}'`
4066 echo "$SFFPPath" >>"$SFFPTempFile2"
4067 # If neither option -a nor more than one path was passed, don't show any more names
4068 ! $SFFPShowAll && break
4069 done
4070 IFS=$SFFPSaveIFS
4071 [ -s "$SFFPTempFile2" ] && /usr/bin/sort -f "$SFFPTempFile2" | /usr/bin/uniq
4072 /bin/rm -f "$SFFPTempFile" "$SFFPTempFile2" 2>/dev/null
4073 cd "$SFFPCurrentDir" 2>/dev/null
4074}
4075
4076ShowHelp()
4077{
4078 # Usage: ShowHelp [$1]
4079 # Argument: $1 = Exit code.
4080 # Summary: Displays script usage and help then exits script.
4081 # If a number is passed to $1, then script exits with
4082 # that number; else, script is not exited.
4083 #
4084 TEMPFILETEMPLATE="/private/tmp/SymantecTemp"
4085 TEMPFILE="$TEMPFILETEMPLATE`date +"%Y%m%d%H%M%S"`-1"
4086 ShowVersion >>"$TEMPFILE"
4087 $AutoRunScript && echo "
4088Note: This script requires no user interaction if run as root. You can
4089 run this script on several machines at once by using Symantec
4090 Endpoint Protection to push this script to client Macs." >>"$TEMPFILE"
4091 echo "
4092WARNING: This script will remove all files and folders created by Symantec
4093 Mac OS X products (LiveUpdate Administration Utility files) and
4094 any files within those folders. Therefore, you will lose ALL files
4095 that reside in those folders, including any that you have created.
4096
4097Usage: $FullScriptName [-CcdeFfghIikLlmpQqRrV] [-QQ] [-re] [volume ...]
4098
4099Summary: If no option or volume is specified, then all Symantec files are
4100 removed from the current boot volume, including the invisible
4101 Symantec files (i.e., AntiVirus QuickScan and Norton FS files),
4102 and Symantec crontab entries are removed from all users' crontabs;
4103 otherwise, for each volume specified, all Symantec files and
4104 Symantec crontab entries will be removed from that volume if no
4105 options are specified. If files are removed from the current boot
4106 volume, receipt predelete scripts are run unless -d is passsed
4107 and Symantec processes are killed unless -k is passed.
4108
4109 If a volume does not have OS X installed on it, then only the
4110 invisible Symantec files are removed from that volume.
4111
4112 Each volume name may begin with \"/Volumes/\", unless it is \"/\".
4113 The easiest way to specify a volume is to drag the volume onto the
4114 Terminal window.
4115
4116Note: The Terminal application does not support high ASCII or
4117 double-byte character entry via keyboard or via drag-and-drop.
4118 If you want to have files removed from a volume that is not
4119 the current boot volume and that has a name containing high
4120 ASCII or double-byte characters, use the -A option.
4121
4122Options: -A Remove all Symantec files from all mounted volumes.
4123 Crontab entries are also removed from the current boot
4124 volume, but not from other volumes. If a volume does not
4125 have OS X installed on it, then only the invisible Symantec
4126 files are removed from that volume.
4127 -C Do not remove crontab entries.
4128 -c Only remove crontab entries from all users' crontabs.
4129 Nothing is removed from any volume.
4130 -d Bypass the running of receipt predelete scripts. It is best
4131 to have predelete scripts run for more thorough uninstalls.
4132 -e Show errors and other output when run predelete scripts are
4133 run. Predelete scripts are run only when removing files from
4134 the current boot volume.
4135 -F List only regular files that are currently installed and
4136 that would be deleted. No note is added if a file is not
4137 supposed to be removed by Symantec Uninstaller.
4138 -f Do not show files as they are removed. If -f is not
4139 specified, file names are shown as files are removed.
4140 -g Do not remove items located within:
4141 /Library/Logs
4142 {each user's home}/Library/Logs
4143 -h Display help.
4144 -I Do not remove invisible Symantec files.
4145 -i Only remove invisible Symantec files.
4146 -k Do not attempt to kill Symantec processes.
4147 -l List only files that are currently installed and that
4148 would be deleted. As of version 6.0.0, contents of folders
4149 are also shown. Nothing is deleted by this option.
4150 -L List all files that $FullScriptName will attempt
4151 to find and delete. Nothing is deleted by this option.
4152 -m Show output from -l, -L, or -R options using more program.
4153 This is no longer the default action as of version 5.52
4154 of $FullScriptName.
4155 -p Eliminate pause before restarting computer. If option -p
4156 is not specified, then there is a three second delay
4157 before the restart occurs.
4158 -q Quit script without restarting. This also suppresses
4159 the prompt to restart.
4160 -Q Quits Terminal application when script is done. If
4161 Terminal is being run by more than one user at once,
4162 Terminal is not quit. If passed a second time, it is
4163 the same as -QQ option.
4164 -QQ Quits Terminal application for all users when script is
4165 done.
4166 -R This option is equivalent to the -l option.
4167 -r Automatically restart computer when script is done if
4168 there are Symantec processes and/or kexts in memory and
4169 there were non-invisible files removed from /.
4170 -re Same as -r option. Though -re is deprecated, it remains
4171 for backwards compatibility.
4172 -u Only output files that are installed that should have been
4173 removed by the UI uninstaller. If there are files found,
4174 exit with $ExitCodeWhenFilesRemain; otherwise, exit with 0. No progress is shown
4175 and nothing is deleted.
4176 -V Show version only.
4177
4178Examples:
4179 $FullScriptName
4180 Deletes all Symantec files and Symantec crontab entries
4181 from the boot volume.
4182
4183 $FullScriptName /Volumes/OS\ 10.2
4184 Deletes all Symantec files and Symantec crontab entries
4185 from the volume named \"OS 10.2\".
4186 Nothing is deleted from the boot volume.
4187
4188 $FullScriptName Runner /
4189 Deletes all Symantec files and Symantec crontab entries
4190 from the volume named \"Runner\" and from the boot volume.
4191
4192 $FullScriptName -i \"Test Disk\"
4193 Deletes only invisible Symantec files from the volume named
4194 \"Test Disk\".
4195
4196 $FullScriptName -A -r
4197 Deletes all Symantec files and Symantec crontab entries
4198 from all mounted volumes that have OS X installed on them.
4199 Deletes only invisible Symantec files from volumes that do
4200 not have OS X installed on them.
4201 Computer is restarted automatically if necessary.
4202
4203 $FullScriptName -Ai
4204 Deletes only invisible Symantec files from all volumes.
4205
4206 $FullScriptName -I
4207 Deletes all but the invisible Symantec files from the boot
4208 volume. Crontab entries are removed from the boot volume.
4209
4210 $FullScriptName -C
4211 Deletes all Symantec files from the boot volume. No crontab
4212 entries are removed.
4213
4214 $FullScriptName -L -A
4215 Lists all the files that $FullScriptName looks
4216 for on all volumes. The files may or may not be currently
4217 installed. Nothing is deleted.
4218
4219 $FullScriptName -R -A
4220 Lists only the Symantec files that are currently installed
4221 on all volumes. Files within existing folders will also be
4222 shown. Nothing is deleted.
4223
4224 $FullScriptName -l -i
4225 Lists the invisible Symantec files that are currently
4226 installed on the boot volume. Nothing is deleted.
4227
4228Note: You must be root or an admin user to run this script. You can
4229 simply double-click on $FullScriptName to remove all
4230 Symantec files and crontab entries from the boot volume.
4231" >>"$TEMPFILE"
4232 ShowContents "$TEMPFILE"
4233 /bin/rm "$TEMPFILE" 2>/dev/null
4234 [ "$1" ] && exit $1
4235}
4236
4237ShowUsage()
4238{
4239 # Usage: ShowUsage [$1 [$2]]
4240 # Arguments: $1 = Exit code.
4241 # $2 = Error message to display before showing usage.
4242 # Summary: Displays script usage. If an exit code is passed,
4243 # script is exited with that value.
4244 #
4245 if [ "$2" ] ; then
4246 echo
4247 echo "$2"
4248 echo
4249 fi
4250 ShowHelp | grep "^Usage.*:"
4251 [ "$2" ] && echo
4252 [ -n "$1" ] && exit "$1"
4253}
4254
4255ShowVersion()
4256{
4257 # Usage: ShowVersion
4258 # Summary: Displays the name and version of script.
4259 #
4260 echo "********* $FullScriptName $Version *********"
4261}
4262
4263SymantecIsInMemory()
4264{
4265 # Usage: SymantecIsInMemory
4266 # Summary: If a Symantec process or kext is in memory,
4267 # 0 is returned; 1 is returned.
4268 #
4269 local SymantecIsInMemoryResult=1
4270 # If there are no more Symantec processes in memory
4271 if KillSymantecProcesses -n ; then
4272 : # 7.0.49: Commented out the following to avoid potential hang of kextstat (Etrack 3925328)
4273# # Check to see if Symantec kexts are in memory
4274# kextstat 2>/dev/null 1>&2
4275# # If kextstat failed to run
4276# if [ $? -gt 0 ] ; then
4277# # try running kmodstat (for old versions of OS X)
4278# if [ "`kmodstat | grep -i Symantec | grep -v " grep -"` 2>/dev/null" ] ; then
4279# SymantecIsInMemoryResult=0
4280# fi
4281# elif [ "`kextstat | grep -i Symantec | grep -v " grep -"`" ] ; then
4282# SymantecIsInMemoryResult=0
4283# fi
4284# if [ $SymantecIsInMemoryResult = 0 ] ; then
4285# echo "*** There are Symantec kexts loaded."
4286# fi
4287 else
4288 SymantecIsInMemoryResult=0
4289 fi
4290 return $SymantecIsInMemoryResult
4291}
4292
4293YesEntered()
4294{
4295 # Usage: YesEntered
4296 # Summary: Reads a line from standard input. If "y" or "yes"
4297 # was entered, true is shown and 0 is returned; otherwise,
4298 # false is shown and 1 is returned. The case of letters is
4299 # ignored. Sample call:
4300 # if `YesEntered`
4301 #
4302 read YesEnteredString
4303 YesEnteredString=`echo "z$YesEnteredString" | awk '{print tolower(substr($0,2))}'`
4304 if [ "'$YesEnteredString" = "'y" -o "'$YesEnteredString" = "'yes" ] ; then
4305 echo true
4306 return 0
4307 fi
4308 echo false
4309 return 1
4310}
4311
4312# *** Beginning of Commands to Execute ***
4313
4314# Verify that all required programs are installed - Etrack 3539262
4315which which &>/dev/null
4316if [ $? = 0 ] ; then
4317 MissingRequiredPrograms=""
4318 SavedIFS="$IFS"
4319 IFS='
4320'
4321 for RequiredProgram in $RequiredPrograms ; do
4322 which "$RequiredProgram" &>/dev/null
4323 [ $? != 0 ] && MissingRequiredPrograms="$MissingRequiredPrograms
4324 $RequiredProgram"
4325 done
4326 IFS="$SavedIFS"
4327else
4328 MissingRequiredPrograms="
4329 which"
4330fi
4331if [ "$MissingRequiredPrograms" ] ; then
4332 echo
4333 echo "WARNING: Could not continue because the following program(s) could not be found:"
4334 echo "$MissingRequiredPrograms"
4335 echo
4336 exit 2
4337fi
4338ScriptPath=`ShowFullFilePath "$0" -P`
4339ScriptDir=`dirname "$ScriptPath"`
4340if [ $# -eq 0 ] ; then # If no arguments were passed to script
4341 # Run script as if it was double-clicked in Finder so that
4342 # screen will be cleared and quit message will be displayed.
4343 RunScriptAsStandAlone=true
4344else
4345 # Run script in command line mode so that
4346 # screen won't be cleared and quit message won't be displayed.
4347 RunScriptAsStandAlone=false
4348fi
4349# If script was run from support folder or from within an app bundle
4350if [ "`echo "$ScriptDir" | grep -e "$LaunchLocationGrepPattern"`" ] ; then
4351 RunScriptAsStandAlone=false
4352 RunningFromWithinAppBundleOrSupportFolder=true
4353else
4354 RunningFromWithinAppBundleOrSupportFolder=false
4355fi
4356if $RunScriptAsStandAlone ; then
4357 clear >&2
4358fi
4359ProcessArguments --OptionIsOneArgument="-QQ" --OptionIsOneArgument="-re" "$@"
4360if [ "`whoami`" != "root" ] ; then # If not root user,
4361 if $PublicVersion ; then
4362 GetAdminPassword true # Prompt user for admin password
4363 elif ! $DoShowOnlyFilesThatShouldHaveBeenUninstalled ; then
4364 ShowVersion >&2
4365 echo >&2
4366 fi
4367 # Run this script again as root
4368 sudo -p "Please enter your admin password: " "$0" "$@"
4369 ErrorFromSudoCommand=$?
4370 # If unable to authenticate
4371 if [ $ErrorFromSudoCommand -eq 1 ] ; then
4372 echo "You entered an invalid password or you are not an admin user. Script aborted." >&2
4373 ExitScript 1
4374 fi
4375 if $PublicVersion ; then
4376 sudo -k # Make sudo require a password the next time it is run
4377 fi
4378 exit $ErrorFromSudoCommand # Exit so script doesn't run again
4379fi
4380OSXVersion=`cat /System/Library/CoreServices/SystemVersion.plist 2>/dev/null | tr '\015' '\012' | grep . | grep -A1 '<key>ProductVersion' | tail -n 1 | grep '<string>10\.' | awk -F '>' '{print $2}' | awk -F '<' '{print $1}'`
4381OSXmajorVersion=`printf "%s" "$OSXVersion" | awk -F . '{print $2}'`
4382# If no volumes were passed to script, the boot volume will be searched
4383if [ -z "$VolumesToUse" ] ; then
4384 BootVolumeWillBeSearched=true
4385fi
4386if [ $PublicVersion = true -a $CreateFilesRemovedListOnly = false -a \
4387 $RemoveCrontabEntriesOnly = false -a $RemoveInvisibleFilesOnly = false -a \
4388 $AutoRunScript = false -a $RunningFromWithinAppBundleOrSupportFolder = false ] ; then
4389 DetermineAction
4390fi
4391if [ $RemoveFromAllVolumes = true -a $CreateFilesRemovedListOnly = false -a $RemoveCrontabEntriesOnly = false -a $RemoveInvisibleFilesOnly = false -a $AutoRunScript = false -a $RunningFromWithinAppBundleOrSupportFolder = false ] ; then
4392 echo
4393 printf "Are you sure you want to remove Symantec files from ALL mounted volumes (y/n)? "
4394 if `YesEntered` ; then
4395 echo
4396 else
4397 echo
4398 echo "Script aborted. No files were removed."
4399 ExitScript 0
4400 fi
4401fi
4402SetupCleanup
4403WillTense=will
4404if $CreateFilesRemovedListOnly ; then
4405 if ! $DoShowOnlyFilesThatShouldHaveBeenUninstalled ; then
4406 echo "Generating a list of files that would be removed by" >&2
4407 echo " $FullScriptName (no files will be removed at this time)..." >&2
4408 fi
4409 WillTense=would
4410elif $RemoveInvisibleFilesOnly ; then
4411 echo "Removing AntiVirus QuickScan files and Norton FS files..."
4412else
4413 if $BootVolumeWillBeSearched ; then
4414 if [ $RestartAutomatically = true -a $RemoveCrontabEntriesOnly = false ] ; then
4415 echo
4416 echo "Note: Computer will be restarted automatically if necessary."
4417 echo
4418 elif $QuitWithoutRestarting ; then
4419 echo
4420 echo "Note: This script will automatically quit when finished."
4421 echo
4422 fi
4423 fi
4424 echo "Removing Symantec files..."
4425 ! $RemoveInvisibleFiles && echo "Invisible Symantec files will not be deleted."
4426fi
4427if $RemoveCrontabEntriesOnly ; then
4428 echo "Only crontab entries $WillTense be removed."
4429fi
4430! $RemoveCrontabEntries && echo "Symantec crontab entries $WillTense not be removed."
4431! $RemoveInvisibleFiles && echo "AntiVirus QuickScan and Norton FS files $WillTense not be removed."
4432if $RemoveFromAllVolumes ; then
4433 VolumesToUse="/
4434"`ls -d /Volumes/*`
4435elif ! $RemoveFromOtherVolumes ; then
4436 VolumesToUse=/
4437fi
4438ListOfVolumesToUse=`echo "$VolumesToUse" | sort -f | uniq`
4439IFS='
4440'
4441for EachVolume in $ListOfVolumesToUse ; do
4442 [ -L "$EachVolume" ] && continue
4443 FilesFoundOnThisVolume=false
4444 RemoveAllNortonFiles "$EachVolume"
4445 if [ $CreateFilesRemovedListOnly = true -a $FilesFoundOnThisVolume = false -a $ListOnlyFilesThatExist = true ] ; then
4446 echo "No matching files were found on \"`basename "$EachVolume"`\"." >> "$FilesRemovedList"
4447 fi
4448done
4449FinishCleanup
4450FinishedExitCode=$?
4451if [ $BootVolumeWillBeSearched = true -a $CreateFilesRemovedListOnly = false ] ; then
4452 # If some Symantec process or kext is in memory, touch restart file
4453 if SymantecIsInMemory ; then
4454 # touch of Extensions folders may not be necessary, since restart is triggered (Etrack 3925328)
4455 touch "$SymantecCleanupRestartFile" # /Library/Extensions /System/Library/Extensions
4456 # May run kextcache in a future release:
4457 # echo "Rebuilding kext caches"
4458 # kextcache -u /
4459 fi
4460 if [ -f "$SymantecCleanupRestartFile" ] ; then
4461 echo
4462 echo "NOTE: You should now restart the computer to get Symantec processes"
4463 echo " and kexts out of memory and/or to remove login items."
4464 RestartComputer
4465 elif [ -e /Library/StartupItems/CleanUpSymWebKitUtils ] ; then
4466 echo
4467 echo "NOTE: You should now restart the computer to have CleanUpSymWebKitUtils"
4468 echo " finish removing SymWebKitUtils.framework."
4469 RestartComputer
4470 fi
4471fi
4472ExitScript $FinishedExitCode
4473
4474# *** End of Commands to Execute ***