Skip to content

Instantly share code, notes, and snippets.

@apizz
Last active June 8, 2018 04:12
Show Gist options
  • Save apizz/3c03220724582b44ad4f137ac6c8c3be to your computer and use it in GitHub Desktop.
Save apizz/3c03220724582b44ad4f137ac6c8c3be to your computer and use it in GitHub Desktop.
Run managed Apple software update download & install with munki
#!/bin/sh
MUNKI="/usr/local/munki/managedsoftwareupdate"
MUNKI_CACHE=$($MUNKI --show-config | /usr/bin/awk -F "'" '/ManagedInstallDir/{print $2}')
APPLESU_FILE="${MUNKI_CACHE}AppleUpdates.plist"
# Verify munki is installed
if [ ! -f "$MUNKI" ]; then
/bin/echo "Munki not installed. Exiting."
exit 1
else
# Run Apple SU check
/bin/echo "Running Apple software update check ..."
$MUNKI --applesuspkgsonly
fi
# Install available Apple software updates that don't require logout or restart, if they exist
if [ -f "$APPLESU_FILE" ]; then
/bin/echo "Apple software updates exist. Attempting to install ..."
$MUNKI --auto
else
/bin/echo "No Apple software updates exist. Done."
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment