mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-12 02:02:16 +10:00
Upgrade OSX application package built-in Java JRE to version 1.8.0_321-b07
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# This is a specialized randomizer function
|
||||
# that will randomize when AU will be triggered
|
||||
# for sceduled updates for a Mac
|
||||
rand(){
|
||||
local max_value="$1"
|
||||
n=$RANDOM
|
||||
var=$[ 1 + $n % $max_value ]
|
||||
retValue=$var
|
||||
}
|
||||
|
||||
# Make the appropriate Changes to plist file post-AU if the com.oracle.java.Java-Updater.plist is changed
|
||||
#Get the stored value of preferences
|
||||
HTHOUR=`defaults read /Library/Preferences/com.oracle.java.Helper-Tool HTHour 2> /dev/null`
|
||||
HTMINUTE=`defaults read /Library/Preferences/com.oracle.java.Helper-Tool HTMinute 2> /dev/null`
|
||||
HTWEEKDAY=`defaults read /Library/Preferences/com.oracle.java.Helper-Tool HTWeekday 2> /dev/null`
|
||||
# Constants
|
||||
LAUNCHD_PLIST_SRC=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Resources/com.oracle.java.Java-Updater.plist
|
||||
LAUNCHD_PLIST_DEST=/Library/LaunchAgents/
|
||||
LAUNCHD_PLIST_NAME=com.oracle.java.Java-Updater.plist
|
||||
# Commands
|
||||
PLISTBUDDY=/usr/libexec/PListBuddy
|
||||
SED=`which sed`
|
||||
CHMOD=`which chmod`
|
||||
LAUNCHCTL=`which launchctl`
|
||||
|
||||
# Values
|
||||
HOUR_VALUE=`date +%H`
|
||||
MINUTE_VALUE=`date +%M`
|
||||
|
||||
# If defaults are already set then over-write with defaults. Else Randomize
|
||||
if [ -z "${HTHOUR}" ] || [ -z "${HTMINUTE}" ] || [ -z "${HTWEEKDAY}" ]; then
|
||||
rand 7
|
||||
${SED} -i "" -e "s/2/${retValue}/g" -e "s/00/${MINUTE_VALUE}/g" -e "s/09/${HOUR_VALUE}/g" "${LAUNCHD_PLIST_SRC}"
|
||||
else
|
||||
${PLISTBUDDY} -c "Set :StartCalendarInterval:Hour '${HTHOUR}'" "${LAUNCHD_PLIST_SRC}"
|
||||
${PLISTBUDDY} -c "Set :StartCalendarInterval:Minute '${HTMINUTE}'" "${LAUNCHD_PLIST_SRC}"
|
||||
${PLISTBUDDY} -c "Set :StartCalendarInterval:Weekday '${HTWEEKDAY}'" "${LAUNCHD_PLIST_SRC}"
|
||||
fi
|
||||
${CHMOD} 644 "${LAUNCHD_PLIST_SRC}"
|
||||
${LAUNCHCTL} unload "${LAUNCHD_PLIST_DEST}/${LAUNCHD_PLIST_NAME}"
|
||||
${LAUNCHCTL} load "${LAUNCHD_PLIST_DEST}/${LAUNCHD_PLIST_NAME}"
|
||||
Reference in New Issue
Block a user