diff --git a/EA-checkOSInstallerVersion.py b/EA-checkOSInstallerVersion.py
new file mode 100755
index 0000000..30a2b6e
--- /dev/null
+++ b/EA-checkOSInstallerVersion.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+import plistlib
+import os.path
+
+installInfo = "/Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallInfo.plist"
+
+present = os.path.isfile(installInfo)
+if present == True:
+ plist = plistlib.readPlist(installInfo)
+ version = plist["System Image Info"]["version"]
+ print '%s' % version
+else:
+ print 'Installer Not Present'
\ No newline at end of file
diff --git a/README.md b/README.md
index 8952fcb..f820b3d 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Requirements:
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: March 10th, 2017
___
@@ -24,11 +24,17 @@ This script has been tested on OS X 10.11.5 upgrading to macOS Sierra 10.12.2 wi
**Configuring the Script**
-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.
+When you open the script you will find some user variables defined on lines 57-72. 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 variable on line 58.
+**Checking if macOS Sierra Installer is Already Present**
+
+I've now added a Extension Attribute to this repo which can be used to check and see if your existing clients already have a copy of "Install macOS Sierra.app" in their Applications folder. If they do, it will report the version they have. This information can be used to scope out your cached package so you don't have to re-deploy to machines that already have it.
+
+If you use this EA, you will want to use version 1.7 (or later) from the release tab so it knows to look in the /Applications/ folder location as well.
+
**Stagging macOS Sierra 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 /Users/Shared/. 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.
diff --git a/macOS10.12Upgrade.sh b/macOS10.12Upgrade.sh
index 7016968..80ab51e 100644
--- a/macOS10.12Upgrade.sh
+++ b/macOS10.12Upgrade.sh
@@ -46,7 +46,7 @@
# Written by: Joshua Roskos | Professional Services Engineer | Jamf
#
# Created On: January 5th, 2017
-# Updated On: March 9th, 2017
+# Updated On: March 10th, 2017
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -54,6 +54,9 @@
# USER VARIABLES
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+##Installer Path (Location of Install macOS Sierra.app)
+installerPath="/Users/Shared/Install\ macOS\ Sierra.app"
+
##Enter 0 for Full Screen, 1 for Utility window (screenshots available on GitHub)
userDialog=0
@@ -68,10 +71,6 @@ description="
This process will take approximately 5-10 minutes.
Once completed your computer will reboot and begin the upgrade."
-##Icon to be used for userDialog
-##Default is macOS Sierra Installer logo which is included in the staged installer package
-icon=/Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/InstallAssistant.icns
-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# SYSTEM CHECKS
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -102,6 +101,24 @@ else
/bin/echo "Disk Check: ERROR - ${freeSpace%.*}GB Free Space Detected"
fi
+##Check where Installer is Located
+##Need to add check if cached package - check waiting room
+installerPath2=$( echo $installerPath | sed 's/\\//g' )
+if [[ -d "$installerPath" ]]; then
+ echo "Cached Package Present"
+ setPath="$installerPath"
+else
+ echo "Cached Package Not Present"
+ echo "Verifying Installer is in Applications folder..."
+ if [[ -d "/Applications/Install macOS Sierra.app" ]]; then
+ echo "Installer Found"
+ setPath="/Applications/Install\ macOS\ Sierra.app"
+ else
+ echo "Installer Not Found...Unable to Complete upgrade."
+ echo "Exiting..."
+ exit 0
+fi
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# CREATE FIRST BOOT SCRIPT
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -112,7 +129,8 @@ fi
## First Run Script to remove the installer.
## Clean up files
-/bin/rm -fdr /Users/Shared/Install\ macOS\ Sierra.app
+/bin/rm -fdr $installerPath
+/bin/rm -fdr /Applications/Install\ macOS\ Sierra.app
/bin/sleep 2
/usr/local/jamf/bin/jamf recon
@@ -152,23 +170,27 @@ exit 0" > /usr/local/jamfps/finishOSInstall.sh
# APPLICATION
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+##Icon to be used for userDialog
+##Default is macOS Sierra Installer logo which is included in the staged installer package
+icon=$setPath/Contents/Resources/InstallAssistant.icns
+
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 $!)
- 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 $!)
- fi
+ ##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 $!)
+ 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 $!)
+ 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 &
- /bin/sleep 3
+ $setPath/Contents/Resources/startosinstall --volume / --applicationpath $setPath --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.