Last active
August 29, 2015 14:05
-
-
Save rtrouton/4ec16b2ee07870fcf758 to your computer and use it in GitHub Desktop.
Postinstall script for Sophos Enterprise Anti-Virus for Mac OS X 9.x installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOGGER="/usr/bin/logger" | |
FILE_DATE=`date +%Y%m%d%H%M%S` | |
# Determine working directory | |
install_dir=`dirname $0` | |
# Location of Sophos keychain file | |
sophos_keychain="$3/Library/Sophos Anti-Virus/Sophos.keychain" | |
# Install Sophos Anti-Virus | |
/usr/sbin/installer -dumplog -verbose -pkg "$install_dir/Sophos Anti-Virus.mpkg" -target "$3" | |
# Remove existing Sophos autoupdate configuration file | |
/bin/mv "/Library/Preferences/com.sophos.sau.plist" /tmp/com.sophos.sau."$FILE_DATE".plist | |
# Remove and replace existing Sophos keychain file | |
if [[ -f "$sophos_keychain" ]]; then | |
mv "$sophos_keychain" /tmp/Sophos-"$FILE_DATE".keychain | |
cp "$install_dir/Sophos.keychain" "$sophos_keychain" | |
fi | |
# Write Sophos autoupdate configuration file | |
# | |
# Note: Plist file here is only an example. You will | |
# need to provide your own plist settings between the | |
# following lines: | |
# | |
# /bin/cat > "/Library/Sophos Anti-Virus/com.sophos.sau.plist" << 'SOPHOS_CONFIG' | |
# | |
# ....plist data goes here.... | |
# | |
# SOPHOS_CONFIG | |
# | |
/bin/cat > "/Library/Preferences/com.sophos.sau.plist" << 'SOPHOS_CONFIG' | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>LastUpdated</key> | |
<string>September 1, 2014 11:19:09 PM EDT</string> | |
<key>PrimaryServerProxy</key> | |
<integer>0</integer> | |
<key>PrimaryServerProxyPort</key> | |
<integer>0</integer> | |
<key>PrimaryServerProxyURL</key> | |
<string></string> | |
<key>PrimaryServerType</key> | |
<integer>2</integer> | |
<key>PrimaryServerURL</key> | |
<string>smb://sophos_enterprise_server_name_goes_here/SophosUpdate/CIDs/S000/ESCOSX</string> | |
<key>SecondaryServer</key> | |
<true/> | |
<key>SecondaryServerProxy</key> | |
<integer>0</integer> | |
<key>SecondaryServerProxyPort</key> | |
<integer>0</integer> | |
<key>SecondaryServerProxyURL</key> | |
<string></string> | |
<key>SecondaryServerType</key> | |
<integer>0</integer> | |
<key>SecondaryServerURL</key> | |
<string></string> | |
<key>UpdateFrequency</key> | |
<integer>1</integer> | |
<key>UpdateInterval</key> | |
<integer>10</integer> | |
<key>UpdateLogIntoFile</key> | |
<true/> | |
<key>UpdateLogIntoSyslog</key> | |
<false/> | |
<key>UpdateOnConnection</key> | |
<false/> | |
<key>UpdateUnits</key> | |
<integer>1</integer> | |
</dict> | |
</plist> | |
SOPHOS_CONFIG | |
# Force Sophos to reload its configuration | |
/bin/launchctl unload /Library/LaunchDaemons/com.sophos.configuration.plist | |
/bin/launchctl load /Library/LaunchDaemons/com.sophos.configuration.plist | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment