Sierra Installation through Self Service

mcsoellner
New Contributor III

Hey everyone,

I am trying to put the installer for Sierra on Self Service. What is the best way to do this/ how did you do it?

12 REPLIES 12

cbrewer
Valued Contributor II

Uploading the installer and using it directly stopped working around 10.12.4. Try using a script.

https://github.com/kc9wwh/macOSUpgrade

hkabik
Valued Contributor

https://babodee.wordpress.com/2017/03/14/another-method-for-macos-upgrades-via-the-jss-using-self-service/

jwojda
Valued Contributor II

I'm using the babodee one @hkabik mentioned. It is working on 10.12.6 too.

teknikal35
New Contributor III

the normal 2 stage 1/ osx cache process and 2/ deployment using self service still works for me

mark_mahabir
Valued Contributor

Can confirm that the method that @cbrewer mentioned works well for us.

mcsoellner
New Contributor III

@cbrewer & @mark.mahabir I tried the script on a mac that had 10.11 and let it sit over night. I came back the next day and there was no change; it was stuck on the wait for 5-10 minutes for the computer to reboot.

tnielsen
Valued Contributor

I have a question in regards to the script. https://github.com/kc9wwh/macOSUpgrade/blob/master/macOSUpgrade.sh

Under the user variables, there's a section to link to a policy that will download the installer if it's missing. How do you get the name of a policy to pass with Jamf Pro? As in, how do I FIND the name of a policy that the script would understand?

Secondly, I had no idea we could do this in scripts.... That could be very powerful and allow me to create policies that daisy chain off one another...

mm2270
Legendary Contributor III

@tnielsen If you're referring to $6 in the script, that isn't for the name of the policy. Use the policy ID or a custom trigger to call it. For example, say your "OSX-Sierra-Cache" policy has a custom trigger called "cache-Sierra" Enter that and the command that ends up being run is something like /usr/local/bin/jamf policy -trigger cache-Sierra As long as the machine is properly in scope, the script will call that policy and cache the installer, and then move on to the rest of the install.

tnielsen
Valued Contributor

Yes I am referring to $6. Can you tell me if this line of thought is accurate?

  1. I create a policy that is set to execute upon a custom trigger, called "cache-Sierra". The policy is scoped to all computers for simplicity.
  2. Computer "X" runs a script that executes a: jamf policy -event cache-Sierra command.
  3. Computer "X" then runs the policy.

Is that an accurate line of thinking or am I missing anything?

Thank you @mm2270

mm2270
Legendary Contributor III

Yes, that is essentially it. And to go a step further, in the above script that installs Sierra, it can call that policy with /usr/local/bin/jamf policy -trigger cache-Sierra so it will run that policy, complete it, then continue running the rest of the policy that installs Sierra.

Keep in mind though that that is only provided as a method for correcting anomalies. The Sierra installer should be cached using a separate regular policy on eligible devices or devices enrolled in your upgrade plan, so when they run the "Upgrade to Sierra" policy from Self Service, it just works.

tcandela
Valued Contributor II

@cbrewer I use the https://github.com/kc9wwh/macOSUpgrade also to install High Sierra via Self Service, but is there anyway to remove the popup that notifies the user that the OS has to be downloaded and the user has to click OK??? I don't want them to have to click anything, just download it, going straight to the custom event.

I probably would think just remove the 3 lines of code above

Run policy to cache installer

here is that section of code in the script

##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 "$macOSname installer with $version was already present, continuing..." fi

mlitton
New Contributor II

I have tried the macOSUpgrade but it has not worked in my tests. I have stripped out everything to make it really simple (and maybe easier to see where the problem is)

I have a package that places 'Install macOS Sierra.app' (10.12.6) in the applications folder

That package is cached on a machine

A smart group is made of 'Computers with Install macOS Sierra' cached

Then I have a policy that installs the cached package and then runs the script.

I get the dialog boxes for about 5 minutes then nothing ... it goes back to self service

Does this script look correct? Any assistance would be greatly appreciated.

#!/bin/bash


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# USER VARIABLES
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

##Enter 0 for Full Screen, 1 for Utility window (screenshots available on GitHub)
userDialog=0

#Specify path to OS installer. Use Parameter 4 in the JSS, or specify here
#Example: /Applications/Install macOS High Sierra.app
OSInstaller="/Applications/Install macOS Sierra.app"


#Title of OS
#Example: macOS High Sierra
macOSname=`echo "$OSInstaller" |sed 's/^/Applications/Install (.*).app$/1/'`


##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 15-20 minutes.
Once completed your computer will reboot and begin the upgrade.
The actual upgrade can take up to 30 minutes."

##Icon to be used for userDialog
##Default is macOS Installer logo which is included in the staged installer package
icon="$OSInstaller/Contents/Resources/InstallAssistant.icns"


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# APPLICATION
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

##Caffeinate
/usr/bin/caffeinate -dis &
caffeinatePID=$(echo $!)


##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..."
    consoleUser=`ls -l /dev/console | cut -d " " -f4`
    effectiveUserID=$(/usr/bin/id -u "$consoleUser")
    /bin/launchctl asuser "$effectiveUserID" sudo -u "$consoleUser" /usr/bin/open /Applications/Install macOS Sierra.app
    /bin/sleep 5
    /bin/launchctl asuser "$effectiveUserID" sudo -u "$consoleUser" osascript -e 'quit app "Install macOS Sierra"'
    /Applications/Install macOS Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --nointeraction --pidtosignal $jamfHelperPID &
    /bin/sleep 3


##Kill Caffeinate
kill ${caffeinatePID}

exit 0