Skip to content

Instantly share code, notes, and snippets.

@neilmartin83
Last active March 4, 2022 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilmartin83/c1042dab3790b2fab9ddf5847a5c6c52 to your computer and use it in GitHub Desktop.
Save neilmartin83/c1042dab3790b2fab9ddf5847a5c6c52 to your computer and use it in GitHub Desktop.
#!/bin/bash
availableupdates=`softwareupdate -l | grep "recommended" | sed "s/\*//g" | sed "s/$/,/g"`
jamfHelper='/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper'
title="UEL IT Services Message"
icon="/System/Library/CoreServices/Software Update.app/Contents/Resources/SoftwareUpdate.icns"
heading1="Software updates are available for your computer. "
description1="Do you want to install them now?
You can continue to use your computer during the installation.
You may be asked to restart it when the installation is complete.
"
function promptUser()
{
promptResult=""
promptResult=`"${jamfHelper}" -windowType hud -icon "$icon" -title "$title" -heading "$heading1" -alignHeading center -description "$availableupdates
$description1" -button1 "OK" -button2 "Cancel" -defaultButton "1"`
}
promptUser
if [[ $promptResult = 2 ]]
then
echo "User clicked Cancel"
exit 0
elif [[ $promptResult = 0 ]]
then
echo "user clicked OK"
jamf policy -event DeployAppleSoftwareUpdates
exit 0
else
echo "I don't know what's going on"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment