Advertisement
Guest User

Sophos postinstall script

a guest
Mar 15th, 2014
1,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.71 KB | None | 0 0
  1. #!/bin/bash
  2.    
  3. LOGGER="/usr/bin/logger"
  4.  
  5. # Determine working directory
  6. install_dir=`dirname $0`
  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
  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 /
  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."
  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"
  20. fi
  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
  24. # uninstallation process is run.
  25.    
  26. if [[ -f "/Library/Application Support/Sophos/he/Installer.app/Contents/MacOS/InstallationDeployer" ]]; then
  27.     ${LOGGER} "Sophos AV Home Edition present on Mac. Uninstalling before installing new copy."
  28.     "/Library/Application Support/Sophos/he/Installer.app/Contents/MacOS/InstallationDeployer" --remove
  29. else
  30.     ${LOGGER} "Sophos Anti-Virus 9.x Home Edition Uninstaller Not Present"
  31. fi
  32.  
  33. if [[ -f "/Library/Application Support/Sophos/opm-sa/Installer.app/Contents/MacOS/InstallationDeployer" ]]; then
  34.     ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy."
  35.     "/Library/Application Support/Sophos/opm-sa/Installer.app/Contents/MacOS/InstallationDeployer" --remove
  36. elif [[ -f "/Library/Application Support/Sophos/opm-sa-installer/Installer.app/Contents/MacOS/InstallationDeployer" ]]; then
  37.     ${LOGGER} "Sophos AV present on Mac. Uninstalling before installing new copy."
  38.     "/Library/Application Support/Sophos/opm-sa-installer/Installer.app/Contents/MacOS/InstallationDeployer" --remove
  39. else
  40.    ${LOGGER} "Sophos Anti-Virus 9.x Standalone Uninstaller Not Present"
  41. fi
  42.    
  43. # Install Sophos Anti-Virus 9.x
  44.    
  45. if [ -e $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/InstallationDeployer" ]; then
  46.     ${LOGGER} "Installing Sophos Anti-Virus Home Edition"
  47.     $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/InstallationDeployer" --install
  48. else
  49.     if [ -e $install_dir/"Sophos Installer.app/Contents/MacOS/InstallationDeployer" ]; then
  50.         ${LOGGER} "Installing Sophos Anti-Virus 9"
  51.         $install_dir/"Sophos Installer.app/Contents/MacOS/InstallationDeployer" --install
  52.     fi
  53. fi
  54.  
  55. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement