Skip to content

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
Pre-Release! Not Fully Tested!

Consolidated installer paths to variable.
Added use of Extension Attribute to check if machine already has copy
of installer.
Added logic to support EA.
First Boot script will try to remove both file locations.
  • Loading branch information
Joshua Roskos committed Mar 10, 2017
1 parent ab96979 commit fa98ccc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 22 deletions.
14 changes: 14 additions & 0 deletions 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 '<result>%s</result>' % version
else:
print '<result>Installer Not Present</result>'
12 changes: 9 additions & 3 deletions README.md
Expand Up @@ -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

___

Expand All @@ -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.
Expand Down
60 changes: 41 additions & 19 deletions macOS10.12Upgrade.sh
Expand Up @@ -46,14 +46,17 @@
# Written by: Joshua Roskos | Professional Services Engineer | Jamf
#
# Created On: January 5th, 2017
# Updated On: March 9th, 2017
# Updated On: March 10th, 2017
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 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

Expand All @@ -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
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Expand Down Expand Up @@ -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
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit fa98ccc

Please sign in to comment.