SHOW:
|
|
- or go back to the newest paste.
1 | #!/bin/bash | |
2 | - | |
2 | + | |
3 | LOGGER="/usr/bin/logger" | |
4 | ||
5 | # Determine working directory | |
6 | install_dir=`dirname $0` | |
7 | - | |
7 | + | |
8 | # Uninstall existing copy of Sophos 8.x by checking for the | |
9 | # Sophos Antivirus uninstaller package in /Library/Sophos Anti-Virus. | |
10 | # If present, the uninstallation process is run. | |
11 | ||
12 | - | if [ -d "/Library/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" ]; then |
12 | + | if [ -d /Library/Sophos\ Anti-Virus/Remove\ Sophos\ Anti-Virus.pkg ]; then |
13 | - | ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy." |
13 | + | ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy." |
14 | - | /usr/sbin/installer -pkg "/Library/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" -target / |
14 | + | /usr/sbin/installer -pkg /Library/Sophos Anti-Virus/Remove\ Sophos\ Anti-Virus.pkg -target / |
15 | - | elif [ -d "/Library/Application Support/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" ]; then |
15 | + | elif [ -d /Library/Application\ Support/Sophos Anti-Virus/Remove\ Sophos\ Anti-Virus.pkg ]; then |
16 | - | ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy." |
16 | + | ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy." |
17 | - | /usr/sbin/installer -pkg "/Library/Application Support/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" -target / |
17 | + | /usr/sbin/installer -pkg /Library/Application\ Support/Sophos\ Anti-Virus/Remove\ Sophos\ Anti-Virus.pkg -target / |
18 | else | |
19 | - | ${LOGGER} "Sophos Anti-Virus 8.x Uninstaller Not Present" |
19 | + | ${LOGGER} "Sophos Anti-Virus 8.x Uninstaller Not Present" |
20 | fi | |
21 | - | |
21 | + | |
22 | # Uninstall existing copy of Sophos 9.x by checking for the InstallationDeployer application | |
23 | - | # in /Library/Application Support/Sophos/he/Installer.app/Contents/MacOS. If present, the |
23 | + | # in /Library/Application Support/Sophos/he/Installer.app/Contents/MacOS. If present, the |
24 | # uninstallation process is run. | |
25 | - | |
25 | + | |
26 | - | if [[ -f "/Library/Application Support/Sophos/he/Installer.app/Contents/MacOS/InstallationDeployer" ]]; then |
26 | + | |
27 | - | ${LOGGER} "Sophos AV Home Edition present on Mac. Uninstalling before installing new copy." |
27 | + | # Uninstall SAV Home Edition if it exists |
28 | - | "/Library/Application Support/Sophos/he/Installer.app/Contents/MacOS/InstallationDeployer" --remove |
28 | + | if [ -f /Library/Application\ Support/Sophos/he/Installer.app/Contents/MacOS/InstallationDeployer ]; then |
29 | /Library/Application\ Support/Sophos/he/Installer.app/Contents/MacOS/InstallationDeployer --remove | |
30 | - | ${LOGGER} "Sophos Anti-Virus 9.x Home Edition Uninstaller Not Present" |
30 | + | ${LOGGER} "Sophos AV Home Edition present on Mac. Uninstalling before installing new copy." |
31 | fi | |
32 | ||
33 | - | if [[ -f "/Library/Application Support/Sophos/opm-sa/Installer.app/Contents/MacOS/InstallationDeployer" ]]; then |
33 | + | |
34 | - | ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy." |
34 | + | # Uninstall the different SAV Stand alone versions if they exist |
35 | - | "/Library/Application Support/Sophos/opm-sa/Installer.app/Contents/MacOS/InstallationDeployer" --remove |
35 | + | if [ -f /Library/Application\ Support/Sophos/opm-sa/Installer.app/Contents/MacOS/tools/InstallationDeployer ]; then |
36 | - | elif [[ -f "/Library/Application Support/Sophos/opm-sa-installer/Installer.app/Contents/MacOS/InstallationDeployer" ]]; then |
36 | + | /Library/Application\ Support/Sophos/opm-sa/Installer.app/Contents/MacOS/tools/InstallationDeployer --remove |
37 | - | ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy." |
37 | + | ${LOGGER} "Sophos AV Stand alone present on Mac. Uninstalling before installing new copy." |
38 | - | "/Library/Application Support/Sophos/opm-sa-installer/Installer.app/Contents/MacOS/InstallationDeployer" --remove |
38 | + | elif [ -f /Library/Application\ Support/Sophos/opm-sa-installer/Installer.app/Contents/MacOS/tools/InstallationDeployer ]; then |
39 | /Library/Application\ Support/Sophos/opm-sa-installer/Installer.app/Contents/MacOS/tools/InstallationDeployer --remove | |
40 | - | ${LOGGER} "Sophos Anti-Virus 9.x Standalone Uninstaller Not Present" |
40 | + | ${LOGGER} "Sophos AV Stand alone present on Mac. Uninstalling before installing new copy." |
41 | fi | |
42 | - | |
42 | + | |
43 | - | # Install Sophos Anti-Virus 9.x |
43 | + | |
44 | - | |
44 | + | # Uninstall the SAV Enterprise version if it exists |
45 | if [ -f /Library/Application\ Support/Sophos/opm/Installer.app/Contents/MacOS/tools/InstallationDeployer ]; then | |
46 | - | ${LOGGER} "Installing Sophos Anti-Virus Home Edition" |
46 | + | /Library/Application\ Support/Sophos/opm/Installer.app/Contents/MacOS/tools/InstallationDeployer --remove |
47 | - | $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/InstallationDeployer" --install |
47 | + | ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy." |
48 | fi | |
49 | - | if [ -e $install_dir/"Sophos Installer.app/Contents/MacOS/InstallationDeployer" ]; then |
49 | + | |
50 | - | ${LOGGER} "Installing Sophos Anti-Virus 9" |
50 | + | |
51 | - | $install_dir/"Sophos Installer.app/Contents/MacOS/InstallationDeployer" --install |
51 | + | # Install Sophos Anti-Virus 9.x |
52 | - | fi |
52 | + | |
53 | ${LOGGER} "Installing Sophos Anti-Virus Home Edition" | |
54 | $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/InstallationDeployer" --install | |
55 | else | |
56 | if [ -e $install_dir/Sophos\ Installer.app/Contents/MacOS/InstallationDeployer ]; then | |
57 | ${LOGGER} "Installing Sophos Anti-Virus 9" | |
58 | $install_dir/Sophos\ Installer.app/Contents/MacOS/InstallationDeployer --install | |
59 | fi | |
60 | fi | |
61 | ||
62 | exit 0 |