diff --git a/README.md b/README.md index 938482f..a21b932 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# macOS Sierra Self Service Upgrade Process +# macOS Self Service Upgrade Process ###### Workflow for doing an in-place upgrade without user interaction. ___ -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, as well as to address changes Apple has made to the ability to complete macOS upgrades silently. +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, as well as to address changes Apple has made to the ability to complete macOS upgrades silently. Requirements: * Jamf Pro @@ -13,9 +13,9 @@ ___ **Why is this needed?** -Starting with macOS Sierra, Apple has begun enforcing the way in which you can silently call for the OS upgrade process to happen in the background. Because of this change, many common ways that have been used and worked in the past no longer do. This script was created to adhear to Apple's requirements of the startosinstall binary. +Starting with macOS Sierra, Apple has begun enforcing the way in which you can silently call for the OS upgrade process to happen in the background. Because of this change, many common ways that have been used and worked in the past no longer do. This script was created to adhere to Apple's requirements of the startosinstall binary. -This script has been tested on OS X 10.11.5 upgrading to macOS Sierra 10.12.5 and 10.126 without issue (as well as the latest High Sierra betas). If the machine is FileVault encrypted, it will complete the authenticated restart to the OS Installer and automatically perform the upgrade with no user interaction. Upon completion the machine will again reboot to the macOS Sierra Login Window. +This script has been tested on OS X 10.11.5 upgrading to macOS Sierra 10.12.5 and 10.12.6 without issue (as well as the latest High Sierra GM-RC1). If the machine is FileVault encrypted, it will complete the authenticated restart to the OS Installer and automatically perform the upgrade with no user interaction. Upon completion the machine will again reboot to the macOS Sierra Login Window. * Note: Authenticated login is broken with 10.12.4+. See https://github.com/kc9wwh/macOSUpgrade/issues/13 @@ -25,9 +25,9 @@ This script has been tested on OS X 10.11.5 upgrading to macOS Sierra 10.12.5 an When you open the script you will find some user variables defined on lines 59-91. Here you can specify the message that is displayed to the end user while the script is running and preparing the computer to upgrade to macOS Sierra, as well as the variables used to determine the version and path for the macOS Installer. Also, don't forget to setup a policy with a custom trigger specified as defined in the user variables. -**Staging macOS Sierra Installer** +**Staging the macOS Installer** -In order for this script to work, you will have to have a copy of the macOS Sierra Installer that is available from the Mac App Store located in /Applications. One of the easiest ways to achieve this is to package the installer with composer as seen below and deploy the package via Jamf Pro. +In order for this script to work, you will have to have a copy of the macOS Installer that is available from the Mac App Store located in /Applications. One of the easiest ways to achieve this is to package the installer with composer as seen below and deploy the package via Jamf Pro. ![alt text](/imgs/composer.png) diff --git a/macOSUpgrade.sh b/macOSUpgrade.sh index 87f4310..fc14fb8 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: October 17th, 2017 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -58,14 +58,8 @@ ##Enter 0 for Full Screen, 1 for Utility window (screenshots available on GitHub) userDialog=0 -##Title to be used for userDialog (only applies to Utility Window) -title="macOS Sierra Upgrade" - -##Heading to be used for userDialog -heading="Please wait as we prepare your computer for macOS Sierra..." - #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 +71,27 @@ version="$5" #Example: download-sierra-install download_trigger="$6" +#Title of OS +#Example: macOS High Sierra +macOSname=`echo "$OSInstaller" |sed 's/^\/Applications\/Install \(.*\)\.app$/\1/'` + +##Title to be used for userDialog (only applies to Utility Window) +title="$macOSname Upgrade" + +##Heading to be used for userDialog +heading="Please wait as we prepare your computer for $macOSname..." + ##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