Advertisement
Guest User

Installer script for SAV9 on Mac

a guest
Nov 19th, 2014
1,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.12 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/tools/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/tools/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. ${LOGGER} "Uninstall finished"
  44.    
  45. # Install Sophos Anti-Virus 9.x
  46. # First section does Sophos Anti-Virus Home Edition
  47. # Second section does Sophos Standalone 9.0.x
  48. # Third section does Sophos Standalone 9.2.x
  49.    
  50. if [ -d $install_dir/"Sophos Anti-Virus Home Edition.app" ]; then
  51.     if [ -e $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/InstallationDeployer" ]; then
  52.         ${LOGGER} "Installing Sophos Anti-Virus Home Edition"
  53.         $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/InstallationDeployer" --install
  54.     else
  55.         if [ -e $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/Sophos Installer" ]; then      
  56.             ${LOGGER} "Installing Sophos Anti-Virus Home Edition"
  57.             $install_dir/"Sophos Anti-Virus Home Edition.app/Contents/MacOS/Sophos Installer" --install
  58.         fi
  59.     fi
  60. else
  61.     if [ -d $install_dir/"Sophos Installer.app" ]; then
  62.         if [ -e $install_dir/"Sophos Installer.app/Contents/MacOS/InstallationDeployer" ]; then
  63.             ${LOGGER} "Installing Sophos Anti-Virus 9"
  64.             $install_dir/"Sophos Installer.app/Contents/MacOS/InstallationDeployer" --install
  65.         else
  66.             if [ -e $install_dir/"Sophos Installer.app/Contents/MacOS/Sophos Installer" ]; then
  67.                 ${LOGGER} "Installing Sophos Anti-Virus 9"
  68.                 $install_dir/"Sophos Installer.app/Contents/MacOS/Sophos Installer" --install
  69.             fi
  70.         fi
  71.     else
  72.         if [ -d $install_dir/AutoUpdate/"Sophos Installer.app" ]; then
  73.             if [ -e $install_dir/AutoUpdate/"Sophos Installer.app/Contents/MacOS/tools/InstallationDeployer" ]; then
  74.                 ${LOGGER} "Installing Sophos Anti-Virus 9"
  75.                 $install_dir/AutoUpdate/"Sophos Installer.app/Contents/MacOS/tools/InstallationDeployer" --install
  76.             else   
  77.                 if [ -e $install_dir/AutoUpdate/"Sophos Installer.app/Contents/MacOS/Sophos Installer" ]; then
  78.                     ${LOGGER} "Installing Sophos Anti-Virus 9"
  79.                     $install_dir/AutoUpdate/"Sophos Installer.app/Contents/MacOS/Sophos Installer" --install
  80.                 fi
  81.             fi
  82.         fi
  83.     fi
  84. fi
  85.  
  86. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement