From daa03dfff6fce6eaddc49d7208fb49b384617f74 Mon Sep 17 00:00:00 2001 From: Joshua Roskos Date: Fri, 8 Sep 2017 16:20:43 -0700 Subject: [PATCH] v2.2 - Added Caffeinate (Issue #20) - Fixed Download macOS Sierra GUI Icon (Issue #28) - Fixed Pre-Check of Large Drives (Issue #30) --- README.md | 2 +- macOS10.12Upgrade.sh => macOSUpgrade.sh | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) rename macOS10.12Upgrade.sh => macOSUpgrade.sh (94%) diff --git a/README.md b/README.md index 5ffdea2..6868d0c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ___ 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. -This script has been tested on OS X 10.11.5 upgrading to macOS Sierra 10.12.5 without issue. 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.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. * Note: Authenticated login is broken with 10.12.4+. See https://github.com/kc9wwh/macOSUpgrade/issues/13 diff --git a/macOS10.12Upgrade.sh b/macOSUpgrade.sh similarity index 94% rename from macOS10.12Upgrade.sh rename to macOSUpgrade.sh index e3f54a0..87f4310 100644 --- a/macOS10.12Upgrade.sh +++ b/macOSUpgrade.sh @@ -47,7 +47,7 @@ # Written by: Joshua Roskos | Professional Services Engineer | Jamf # # Created On: January 5th, 2017 -# Updated On: May 25th, 2017 +# Updated On: September 8th, 2017 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -107,17 +107,17 @@ 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 $6}' | cut -c 2- ) else - freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' ) + freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $6}' | cut -c 2- ) fi -if [[ ${freeSpace%.*} -ge 15 ]]; then +if [[ ${freeSpace%.*} -ge 15000000000 ]]; then spaceStatus="OK" - /bin/echo "Disk Check: OK - ${freeSpace%.*}GB Free Space Detected" + /bin/echo "Disk Check: OK - ${freeSpace%.*} Bytes Free Space Detected" else spaceStatus="ERROR" - /bin/echo "Disk Check: ERROR - ${freeSpace%.*}GB Free Space Detected" + /bin/echo "Disk Check: ERROR - ${freeSpace%.*} Bytes Free Space Detected" fi ##Check for existing Sierra installer @@ -141,7 +141,7 @@ fi if [ $downloadSierra = "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 "$icon" -iconSize 100 + -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 @@ -201,6 +201,10 @@ EOF # APPLICATION # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +##Caffeinate +/usr/bin/caffeinate -dis & +caffeinatePID=$(echo $!) + if [[ ${pwrStatus} == "OK" ]] && [[ ${spaceStatus} == "OK" ]]; then ##Launch jamfHelper if [[ ${userDialog} == 0 ]]; then @@ -230,4 +234,7 @@ else fi +##Kill Caffeinate +kill ${caffeinatePID} + exit 0