16 Jun Let Users Upgrade macOS With Ivanti’s Self-service Portal Workspaces
In many instances, going through a non-data destructive OS upgrade is preferred over a full wipe and erase provisioning process. Furthermore, due to the time it takes to upgrade, more and more people are opting to make the upgrade available via a self-service portal; allowing the user to elect when to perform the upgrade.
While Ivanti offers admins the ability to fully provision a machine from scratch, you may find it more beneficial to reserve that process for a new machine build or for a full machine repair.
If you’re simply in need of upgrading the operating system to the next version, take advantage of a non-destructive OS upgrade using Apple’s builtin command-line utility called startosinstall.
Startosinstall is built directly into the macOS Installer and simple needs a few command-line arguments to kick off the process. Therefore, by using a simple script to download and kickoff the startosinstall command line, you can create an optionally-published package to Ivanti’s Workspaces — allowing an end-user to decide when to initiate the process. And, because the script pre-downloads the installer, the upgrade can commence when the user clicks Install.
To assist you in understanding the script I’ve written below, I’ve provided the arguments for startosinstall. However, please take note that these options changed in 10.12.4 – so if you’re deploying a different version, check the man page for startosinstall for the version specific arguments.
Usage: startosinstall --applicationpath <install macOS.app path> Arguments --applicationpath, a path to copy of the OS installer application to start the install with. --license, prints the user license agreement only. --agreetolicense, agree to license the license you printed with --license. --rebootdelay, how long to delay the reboot at the end of preparing. This delay is in seconds and has a maximum of 300 (5 minutes). --pidtosignal, Specify a PID to which to send SIGUSR1 upon completion of the prepare phase. To bypass "rebootdelay" send SIGUSR1 back to startosinstall. --usage, prints this message. Example: startosinstall --applicationpath "/Applications/Install macOS.app"
- Download the macOS installer from the Mac App Store
- Compress the installer
- Place the installer on your HTTP file share
- If desired, download the logo and screenshots for the OS
Step 1 – Create a macOS Upgrade Script
- Open a text editor on a Mac (BareBones, TextWrangler, Xcode).
- Copy the script below into a blank file within your editor:
#!/bin/sh # macOSUpgradeScript.sh # Created by Bennett Norton on 5/15/17. #File to copy #change this to match your hosted path, it needs to be http filePath="http://training.nine41.com/SoftwareDist/macOSSierra" fileName="Install macOS Sierra.zip" #Location to copy file to #change this to match your destination path destinationLocation="/Library/Application Support/LANDesk/sdcache" #Check to see if destination exists and if not, create it if [ ! -d "$destinationLocation" ]; then echo "Location doesn't exist. Creating directory" mkdir $destinationLocation echo "$destinationLocation created" fi #Download and execute command #You shouldn't need to make any changes here #-noinstall ensure the package does not get executed #-package is the source url path #-destdir is the destination url path /Library/Application\ Support/LANDesk/bin/sdclient -noinstall -package "$filePath"/"$fileName" -destdir "$destinationLocation" #Unzip the installer ditto -xk "$destinationLocation"/"$fileName" "$destinationLocation" #Run the upgrade command-line utility "$destinationLocation"/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "$destinationLocation"/Install\ macOS\ Sierra.app --nointeraction
- Change the filePath variable to match your HTTP file share.
- Change the fileName variable to match your OS installer.
- Change the destinationLocation variable if desired.
- Adjust the upgrade command-line text after destination location to match your installer.
- Save your script (ex. macOSUpgradeScript.sh).
- Set execute permissions on your script in Terminal with the command “chmod 755 /path/to/your/script.sh” (ex. ~/Documents/macOSUpgradeScript.sh).
- Copy the script to your file server (ex. smb://training.nine41.com/SoftwareDist/macOSSierra).
Step 2 – Create a macOS Upgrade Package
- Open the Ivanti Management Console from either a Remote Console or the Core Server.
- Go to Tools > Distribution > Distribution Packages.
- Select My Packages from the menu tree.
- Press the New button (green circle with the white plus symbol).
- Select Macintosh > Macintosh Agent.
- Label the package (ex. macOS Sierra Upgrade).
- Enter an appropriate description.
- Set the Primary File path to http://training.nine41.com/SoftwareDist/macOSUpgradeScript.sh or to your equivalent file share location.
- Click on Additional Settings under Metadata in the menu tree.
- Enter Apple as the Vendor.
- Set the download time to 20.
- Set the install time to 35.
- Click on the Logo menu tree item and add in the macOS Sierra logo.
- Add any additional metadata.
- Click Save.
Step 3 – Create an Optional Upgrade Task for Workspaces
- Right-click on the newly created package and select Create Scheduled Task(s).
- Label the task (ex. BN macOS Sierra Upgrade).
- Click on the Targets menu tree item.
- Add your macOS device(s).
- Select the Scheduled Task menu option.
- Select to Start Now.
- Press the Save button.
Step 4 – User to Upgrade When Desired
- User launches Ivanti Workspaces from the menu bar.
- Authenticates if prompted.
- Clicks on the user icon for Self Service then selects Software Catalog.
- Clicks the All Tags button.
- Clicks the Install button on the macOS Sierra Upgrade tile.