From 3d26e95eabe40a21534f32787820460df7e3d170 Mon Sep 17 00:00:00 2001 From: Joshua Roskos Date: Thu, 9 Mar 2017 13:27:47 -0600 Subject: [PATCH] v1.5 Added creation of LaunchDaemon and First Run script to come back after reboot and delete the installer from the computer. --- README.md | 4 ++-- macOS10.12Upgrade.sh | 47 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2839a0a..140329a 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: February 14th, 2017 +Created On: January 5th, 2017 | Updated On: March 9th, 2017 ___ @@ -26,7 +26,7 @@ This script has been tested on OS X 10.11.5 upgrading to macOS Sierra 10.12.2 wi 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. -Also, if you decide not to stage the macOS Sierra Installer in /Users/Shared/, you will need to update the paths on lines 73 and 124. +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 169. **Stagging macOS Sierra Installer** diff --git a/macOS10.12Upgrade.sh b/macOS10.12Upgrade.sh index 048fe4c..8a45354 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: February 14th, 2017 +# Updated On: March 9th, 2017 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -102,6 +102,51 @@ else /bin/echo "Disk Check: ERROR - ${freeSpace%.*}GB Free Space Detected" fi +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# CREATE FIRST BOOT SCRIPT +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +/bin/mkdir /usr/local/jamfps + +/bin/echo "#!/bin/bash +## First Run Script to remove the installer. + +## Clean up files +/bin/rm -fdr /Users/Shared/Install\ macOS\ Sierra.app +/bin/sleep 2 + +## Remove LaunchDaemon +/bin/launchctl unload -w /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist +/bin/rm -f /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist + +exit 0" > /usr/local/jamfps/finishOSInstall.sh + +/usr/sbin/chown root:admin /usr/local/jamfps/finishOSInstall.sh +/bin/chmod 755 /usr/local/jamfps/finishOSInstall.sh + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# LAUNCH DAEMON +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +/bin/echo " + + + + Label + com.jamfps.cleanupOSInstall + ProgramArguments + + /usr/local/jamfps/finishOSInstall.sh + + RunAtLoad + + +" > /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist + +##Set the permission on the file just made. +/usr/sbin/chown root:wheel /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist +/bin/chmod 644 /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # APPLICATION # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #