From 7e45c7be7be7ce22d23a1d371f6e628b51e5b257 Mon Sep 17 00:00:00 2001 From: Patrick Gallagher Date: Thu, 21 Sep 2017 06:17:00 -0400 Subject: [PATCH] Make OS agnostic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed instances of “macOS Sierra” to $macOSname, which is specified with $7 in the JSS. --- macOSUpgrade.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/macOSUpgrade.sh b/macOSUpgrade.sh index 87f4310..b74cf1a 100644 --- a/macOSUpgrade.sh +++ b/macOSUpgrade.sh @@ -31,7 +31,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script was designed to be used in a Self Service policy to ensure specific -# requirements have been met before proceeding with an inplace upgrade to macOS Sierra, +# requirements have been met before proceeding with an inplace upgrade of the macOS, # as well as to address changes Apple has made to the ability to complete macOS upgrades # silently. # @@ -47,7 +47,7 @@ # Written by: Joshua Roskos | Professional Services Engineer | Jamf # # Created On: January 5th, 2017 -# Updated On: September 8th, 2017 +# Updated On: September 16th, 2017 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -59,13 +59,13 @@ userDialog=0 ##Title to be used for userDialog (only applies to Utility Window) -title="macOS Sierra Upgrade" +title="$7 Upgrade" ##Heading to be used for userDialog -heading="Please wait as we prepare your computer for macOS Sierra..." +heading="Please wait as we prepare your computer for $macOSname..." #Specify path to OS installer. Use Parameter 4 in the JSS, or specify here -#Example: /Applications/Install macOS Sierra.app +#Example: /Applications/Install macOS High Sierra.app OSInstaller="$4" ##Version of OS. Use Parameter 5 in the JSS, or specify here. @@ -77,17 +77,21 @@ version="$5" #Example: download-sierra-install download_trigger="$6" +#Title of OS +#Example: macOS High Sierra +macOSname="$7" + ##Title to be used for userDialog description=" This process will take approximately 5-10 minutes. Once completed your computer will reboot and begin the upgrade." -#Description to be used prior to downloading Sierra -dldescription="We need to download macOS Sierra to your computer, this will \ +#Description to be used prior to downloading the OS installer +dldescription="We need to download $macOSname to your computer, this will \ take several minutes." ##Icon to be used for userDialog -##Default is macOS Sierra Installer logo which is included in the staged installer package +##Default is macOS Installer logo which is included in the staged installer package icon="$OSInstaller/Contents/Resources/InstallAssistant.icns" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -120,32 +124,32 @@ else /bin/echo "Disk Check: ERROR - ${freeSpace%.*} Bytes Free Space Detected" fi -##Check for existing Sierra installer +##Check for existing OS installer if [ -e "$OSInstaller" ]; then /bin/echo "$OSInstaller found, checking version." OSVersion=`/usr/libexec/PlistBuddy -c 'Print :"System Image Info":version' "$OSInstaller/Contents/SharedSupport/InstallInfo.plist"` /bin/echo "OSVersion is $OSVersion" if [ $OSVersion = $version ]; then - downloadSierra="No" + downloadOS="No" else - downloadSierra="Yes" + downloadOS="Yes" ##Delete old version. /bin/echo "Installer found, but old. Deleting..." /bin/rm -rf "$OSInstaller" fi else - downloadSierra="Yes" + downloadOS="Yes" fi -##Download Sierra if needed -if [ $downloadSierra = "Yes" ]; then +##Download OS installer if needed +if [ $downloadOS = "Yes" ]; then /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper \ -windowType utility -title "$title" -alignHeading center -alignDescription left -description "$dldescription" \ -button1 Ok -defaultButton 1 -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/SidebarDownloadsFolder.icns" -iconSize 100 ##Run policy to cache installer /usr/local/jamf/bin/jamf policy -event $download_trigger else - /bin/echo "macOS Sierra installer with $version was already present, continuing..." + /bin/echo "$macOSname installer with $version was already present, continuing..." fi # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -202,7 +206,7 @@ EOF # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ##Caffeinate -/usr/bin/caffeinate -dis & +/usr/bin/caffeinate -dis & caffeinatePID=$(echo $!) if [[ ${pwrStatus} == "OK" ]] && [[ ${spaceStatus} == "OK" ]]; then @@ -228,8 +232,8 @@ else /bin/rm -f /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist /bin/echo "Launching jamfHelper Dialog (Requirements Not Met)..." - /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "Requirements Not Met" -description "We were unable to prepare your computer for macOS Sierra. Please ensure you are connected to power and that you have at least 15GB of Free Space. - + /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "Requirements Not Met" -description "We were unable to prepare your computer for $macOSname. Please ensure you are connected to power and that you have at least 15GB of Free Space. + If you continue to experience this issue, please contact the IT Support Center." -iconSize 100 -button1 "OK" -defaultButton 1 fi