From 8a971b0a262a4b85fd4ce938b4ed462f7f93d679 Mon Sep 17 00:00:00 2001 From: Joshua Roskos Date: Wed, 5 Apr 2017 10:29:35 -0500 Subject: [PATCH] v1.7 **Please be aware of Issue #12** Fixed Issue #8 Fixed Issue #9 Fixed Issue #10 --- README.md | 6 ++-- macOS10.12Upgrade.sh | 82 ++++++++++++++++++++++---------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 8952fcb..fa975be 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ This script was designed to be used in a Self Service policy to ensure specific Requirements: * Jamf Pro -* macOS Sierra Installer must be staged in /Users/Shared/ +* Latest Version of macOS Sierra Installer Written by: Joshua Roskos | Professional Services Engineer | Jamf -Created On: January 5th, 2017 | Updated On: March 9th, 2017 +Created On: January 5th, 2017 | Updated On: April 5th, 2017 ___ @@ -26,7 +26,7 @@ This script has been tested on OS X 10.11.5 upgrading to macOS Sierra 10.12.2 wi When you open the script you will find some user variables defined on lines 57-73. 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. -Also, if you decide not to stage the macOS Sierra Installer in /Users/Shared/, you will need to update the paths on lines 73, 115 and 170. +Also, if you decide not to stage the macOS Sierra Installer in /Users/Shared/, you will need to update the paths on lines 73, 114 and 171. **Stagging macOS Sierra Installer** diff --git a/macOS10.12Upgrade.sh b/macOS10.12Upgrade.sh index 7016968..9e56323 100644 --- a/macOS10.12Upgrade.sh +++ b/macOS10.12Upgrade.sh @@ -36,8 +36,7 @@ # silently. # # REQUIREMENTS: -# - Jamf Pro -# - macOS Sierra Installer must be staged in /Users/Shared/ +# - Jamf Pro # # # For more information, visit https://github.com/kc9wwh/macOSUpgrade @@ -46,7 +45,7 @@ # Written by: Joshua Roskos | Professional Services Engineer | Jamf # # Created On: January 5th, 2017 -# Updated On: March 9th, 2017 +# Updated On: April 5th, 2017 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -79,27 +78,27 @@ icon=/Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/InstallAssistan ##Check if device is on battery or ac power pwrAdapter=$( /usr/bin/pmset -g ps ) if [[ ${pwrAdapter} == *"AC Power"* ]]; then - pwrStatus="OK" - /bin/echo "Power Check: OK - AC Power Detected" + pwrStatus="OK" + /bin/echo "Power Check: OK - AC Power Detected" else - pwrStatus="ERROR" - /bin/echo "Power Check: ERROR - No AC Power Detected" + pwrStatus="ERROR" + /bin/echo "Power Check: ERROR - No AC Power Detected" fi ##Check if free space > 15GB osMinor=$( /usr/bin/sw_vers -productVersion | awk -F. {'print $2'} ) if [[ $osMinor -ge 12 ]]; then - freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $4}' ) + freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $4}' ) else - freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' ) + freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' ) fi if [[ ${freeSpace%.*} -ge 15 ]]; then - spaceStatus="OK" - /bin/echo "Disk Check: OK - ${freeSpace%.*}GB Free Space Detected" + spaceStatus="OK" + /bin/echo "Disk Check: OK - ${freeSpace%.*}GB Free Space Detected" else - spaceStatus="ERROR" - /bin/echo "Disk Check: ERROR - ${freeSpace%.*}GB Free Space Detected" + spaceStatus="ERROR" + /bin/echo "Disk Check: ERROR - ${freeSpace%.*}GB Free Space Detected" fi # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -110,16 +109,13 @@ fi /bin/echo "#!/bin/bash ## First Run Script to remove the installer. - ## Clean up files /bin/rm -fdr /Users/Shared/Install\ macOS\ Sierra.app /bin/sleep 2 +## Update Device Inventory /usr/local/jamf/bin/jamf recon - ## Remove LaunchDaemon -/bin/launchctl unload -w /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist /bin/rm -f /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist - exit 0" > /usr/local/jamfps/finishOSInstall.sh /usr/sbin/chown root:admin /usr/local/jamfps/finishOSInstall.sh @@ -129,20 +125,24 @@ exit 0" > /usr/local/jamfps/finishOSInstall.sh # LAUNCH DAEMON # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -/bin/echo " +cat << EOF > /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist + - Label - com.jamfps.cleanupOSInstall - ProgramArguments - - /usr/local/jamfps/finishOSInstall.sh - - RunAtLoad - + Label + com.jamfps.cleanupOSInstall + ProgramArguments + + /bin/bash + -c + /usr/local/jamfps/finishOSInstall.sh + + RunAtLoad + -" > /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist + +EOF ##Set the permission on the file just made. /usr/sbin/chown root:wheel /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist @@ -155,25 +155,25 @@ exit 0" > /usr/local/jamfps/finishOSInstall.sh if [[ ${pwrStatus} == "OK" ]] && [[ ${spaceStatus} == "OK" ]]; then ##Launch jamfHelper if [[ ${userDialog} == 0 ]]; then - /bin/echo "Launching jamfHelper as FullScreen..." - /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -title "" -icon "$icon" -heading "$heading" -description "$description" & - jamfHelperPID=$(echo $!) + /bin/echo "Launching jamfHelper as FullScreen..." + /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -title "" -icon "$icon" -heading "$heading" -description "$description" & + jamfHelperPID=$(echo $!) fi if [[ ${userDialog} == 1 ]]; then - /bin/echo "Launching jamfHelper as Utility Window..." - /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "$heading" -description "$description" -iconSize 100 & - jamfHelperPID=$(echo $!) + /bin/echo "Launching jamfHelper as Utility Window..." + /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "$heading" -description "$description" -iconSize 100 & + jamfHelperPID=$(echo $!) fi - ##Begin Upgrade - /bin/echo "Launching startosinstall..." - /Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --volume / --applicationpath /Users/Shared/Install\ macOS\ Sierra.app --nointeraction --pidtosignal $jamfHelperPID & + ##Begin Upgrade + /bin/echo "Launching startosinstall..." + /Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath /Users/Shared/Install\ macOS\ Sierra.app --nointeraction --pidtosignal $jamfHelperPID & /bin/sleep 3 else - /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. - - If you continue to experience this issue, please contact the IT Support Center." -iconSize 100 -button1 "OK" -defaultButton 1 + /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. + + If you continue to experience this issue, please contact the IT Support Center." -iconSize 100 -button1 "OK" -defaultButton 1 fi -exit 0 +exit 0 \ No newline at end of file