#!/bin/bash
# Only for Mac OS 10.7
if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -eq 7 ]; then
# Set the UUID for the ByHost File Naming
MAC_UUID=`system_profiler SPHardwareDataType | grep "Hardware UUID" | awk '{print $3}'`
if [ `echo $MAC_UUID | cut -c 1-24` == "00000000-0000-1000-8000-" ]; then
MAC_UUID=`echo $MAC_UUID | cut -c 25-36`
fi
# Set the "Enable applet plug-in and Web Start Applications" setting in Java Prefs
echo "UUID for ByHost file naming set to $MAC_UUID"
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
chown $3 /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$MAC_UUID.plist
echo "Java web plug-in enabled"
fi
if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -eq 7 ]; then
# Set the UUID for the ByHost File Naming
MAC_UUID=`system_profiler SPHardwareDataType | grep "Hardware UUID" | awk '{print $3}'`
if [ `echo $MAC_UUID | cut -c 1-24` == "00000000-0000-1000-8000-" ]; then
MAC_UUID=`echo $MAC_UUID | cut -c 25-36`
fi
# Set the "Enable applet plug-in and Web Start Applications" setting in Java Prefs
echo "UUID for ByHost file naming set to $MAC_UUID"
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
chown $3 /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$MAC_UUID.plist
echo "Java web plug-in enabled"
fi
# Only for Mac OS 10.7
if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -eq 7 ]; then
# Set the UUID for the ByHost File Naming
MAC_UUID=`system_profiler SPHardwareDataType | grep "Hardware UUID" | awk '{print $3}'`
if [ `echo $MAC_UUID | cut -c 1-24` == "00000000-0000-1000-8000-" ]; then
MAC_UUID=`echo $MAC_UUID | cut -c 25-36`
fi
# Set the "Enable applet plug-in and Web Start Applications" setting in Java Prefs
echo "UUID for ByHost file naming set to $MAC_UUID"
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
chown $3 /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$MAC_UUID.plist
echo "Java web plug-in enabled"
fi
if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -eq 7 ]; then
# Set the UUID for the ByHost File Naming
MAC_UUID=`system_profiler SPHardwareDataType | grep "Hardware UUID" | awk '{print $3}'`
if [ `echo $MAC_UUID | cut -c 1-24` == "00000000-0000-1000-8000-" ]; then
MAC_UUID=`echo $MAC_UUID | cut -c 25-36`
fi
# Set the "Enable applet plug-in and Web Start Applications" setting in Java Prefs
echo "UUID for ByHost file naming set to $MAC_UUID"
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
chown $3 /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$MAC_UUID.plist
echo "Java web plug-in enabled"
fi