Skip to content

Instantly share code, notes, and snippets.

@rickychilcott
Created October 6, 2015 21:05
Show Gist options
  • Save rickychilcott/51ba9755bf46e98227fa to your computer and use it in GitHub Desktop.
Save rickychilcott/51ba9755bf46e98227fa to your computer and use it in GitHub Desktop.
Sophos 9.2.8 postinstall script
#!/bin/bash
LOGGER="/usr/bin/logger"
# Determine working directory
install_dir=`dirname $0`
# Uninstall existing copy of Sophos 8.x by checking for the
# Sophos Antivirus uninstaller package in /Library/Sophos Anti-Virus.
# If present, the uninstallation process is run.
if [ -d "/Library/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" ]; then
${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy."
/usr/sbin/installer -pkg "/Library/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" -target /
elif [ -d "/Library/Application Support/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" ]; then
${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy."
/usr/sbin/installer -pkg "/Library/Application Support/Sophos Anti-Virus/Remove Sophos Anti-Virus.pkg" -target /
else
${LOGGER} "Sophos Anti-Virus 8.x Uninstaller Not Present"
fi
# Uninstall existing copy of Sophos 9.x by checking for the InstallationDeployer application
# in /Library/Application Support/Sophos/opm/Installer.app/Contents/MacOS. If present, the
# uninstallation process is run.
if [[ -f "/Library/Application Support/Sophos/opm/Installer.app/Contents/MacOS/InstallationDeployer" ]]; then
${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy."
"/Library/Application Support/Sophos/opm/Installer.app/Contents/MacOS/InstallationDeployer" --remove
else
${LOGGER} "Sophos Anti-Virus 9.x Uninstaller Not Present"
fi
# Install Sophos Anti-Virus 9.x
$install_dir/"Sophos Installer.app/Contents/MacOS/InstallationDeployer" --install
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment