Posted on 05-11-2016 09:23 AM
Greetings all,
I'm attempting to kick off an upgrade of OS 10.11, and the way I'm going about seems to allow me to do it automatically, if I can just get a script to pass 2 keystrokes to kick off the installer. I'm wondering if any one has tried this/figured out if this is possible, I been trying, and I can't quite get over the hump.
I've created a package in Composer that installs the "Install OS X El Capitan.app" into the tmp folder. I found that if I call this Unix Executable:
/private/tmp/Install OS X El Capitan.app/Contents/Resources/startosinstall
like this:
sudo /private/tmp/Install OS X El Capitan.app/Contents/Resources/startosinstall --applicationpath /private/tmp/Install OS X El Capitan.app --volume /
it will kick off the installer, and upgrade a 10.10 system.
My hang up is that after running my command the Terminal is prompted for the license agreement, where you have to type "a" and then the "return" key.
I've tried scripting this (osascript command, a shell script, and executable AppleScript), but I'll confess I only ever script out of necessity and that isn't too often.
I think that an executable shell script with everything in it would do the trick, but I'm wondering if any more savvy folks out there could help me get there a bit quicker.
Any assistance would be greatly appreciated.
Many thanks!
Solved! Go to Solution.
Posted on 05-11-2016 10:40 AM
Posted on 05-11-2016 11:35 AM
@bpavlov Thanks for the link. I wasn't aware of this new startosinstall command in 10.11. That's good information. Seems the --nointeraction
flag is actually the key to making this work unattended.
Posted on 05-11-2016 09:28 AM
What you're looking for is called an 'expect' script. Do a search here for expect script examples for some ideas on how to use them. I don't use expect scripts, or very rarely, as they tend to be tricky and at times unreliable, but it may do what you're after.
Of course, you should probably look into JAMF's documentation on installing OS upgrades or search here for other workflows that don't involve needing to pass any keys to a command line, as they may work better for you.
Posted on 05-11-2016 10:14 AM
@DBI_Support COSXIP might work for this.
Posted on 05-11-2016 10:40 AM
Posted on 05-11-2016 11:35 AM
@bpavlov Thanks for the link. I wasn't aware of this new startosinstall command in 10.11. That's good information. Seems the --nointeraction
flag is actually the key to making this work unattended.
Posted on 05-12-2016 08:29 AM
@bpavlov Thanks for the link, this is what I was looking for! @mm2270 Thank you for finding the flag I needed!
So I was able to get it to run as expected:
sudo /private/tmp/Install OS X El Capitan.app/Contents/Resources/startosinstall --applicationpath /private/tmp/Install OS X El Capitan.app --volume / --nointeraction
I've tested it successfully!
Thanks all for the help!
Posted on 05-13-2016 06:13 AM
As I stated above this works just fine. The only thing is that the policy stays at "remaining (pending)" instead of going to"completed", because the system restarts once the command triggers the update to run.
Any thoughts on how to get this to close out cleanly and get it show as complete?
I'm just trying to help out my Desktop Support team, so they know that all went well.
Many thanks!
Posted on 05-13-2016 07:02 AM
File a bug with Apple that startosinstall should not initiate a restart, but rather prompt that one is required.
This would allow tools like Casper to do any needed housekeeping/cleanup/record-keeping, and then initiate the restart.
(Others have filed bugs along these lines, but Apple does not yet seem to "get" the need)
There are alternate methods of installing El Capitan, perhaps another method will work better for you. Here's one:
https://derflounder.wordpress.com/2015/11/23/providing-os-x-upgrades-via-caspers-self-service/
Posted on 05-13-2016 07:22 AM
While I do agree with @gregneagle about submitting a report to Apple to have them change the behavior, or perhaps add an additional flag that allows for an interactive "reboot" prompt if needed, in the interim, take a look through this thread: https://jamfnation.jamfsoftware.com/discussion.html?id=18702
While the focus on that thread is for a very different scenario, the same principle can be used. Essentially, have a script run as part of the policy that creates a LaunchDaemon with a delayed start time. When it runs it will call your script or command line to run the OS installation. When done properly, this "completes" the policy and allows it to submit a policy log, and about ~1 minute later the OS installation kicks in. You'll get your "Complete" entry in the policy log back in the JSS as you'd expect to.
You would however, need to ensure that the LaunchDaemon doesn't run again a second time after the install and reboot into the upgraded OS. Maybe have the script look for a file or flag of some kind that only gets written when the policy kicks off (i.e. something in the Run Command field in the policy) and if it sees its there already, remove the launchd job and script instead of running the job.
Posted on 05-13-2016 10:55 AM
Hey @mm2270, I haven't run into this issue with Yosemite. Has something changed in El Capitan?
First, I load the installer into Casper Admin, which is automatically recognized and repackaged for the JSS.
Then, I set up a policy to cache the installer and update inventory.
Then, I set up another policy to run the installer as soon as it finds the cached installer. This second policy is a Self Service item now, but it has a "Reboot Immediately" flag. This could easily be turned into a non-selectable policy that runs silently.
Posted on 09-08-2016 07:39 PM
I'm starting to explore this with macOS Sierra.
The automatic reboot is a killer!!!
IDK if this is the right forum but i wanted to share a technique I plan on using with macOS Sierra.
I created some automation by making a PKG that that puts the installer in the /Applications/ folder then with a post install script i did the following.
This is still a rough draft but this way I know exactly when it finishes and do other actions with scripting later.
Please share your thoughts!
#!/bin/bash
echo 'A' | "/Applications/Install macOS Sierra.app/Contents/Resources/startosinstall" --nointeraction --rebootdelay 300 --volume / --applicationpath "/Applications/Install macOS Sierra.app" &
echo testing
sleep 5
installRunning=`ps aux | grep osinstallersetupd | grep -v grep | awk '{ print $3 }'`
while [ "$installRunning" != "0.0" ] ; do
echo still running
sleep 5
installRunning=`ps aux | grep osinstallersetupd | grep -v grep | awk '{ print $3 }'`
done
echo done
Posted on 09-09-2016 07:19 AM
It may be easier to use createOSXInstallPkg for OS upgrades, as opposed to using Install macOS Sierra.app
and startosinstall
.
For more information on using createOSXinstallPkg-generated installers, I have a post on how I'm providing OS upgrades via Self Service available via the link below:
https://derflounder.wordpress.com/2015/11/23/providing-os-x-upgrades-via-caspers-self-service/
Posted on 09-09-2016 07:45 AM
@rtrouton i'm using that workflow for an upgrade from Yosemite to El Cap right now. Many thanks to you. From that post it appeared that Yosemite would be the last OS that createOSXInstallPkg would work for. That Sierra would require startosinstall. Did I misinterpret?
Posted on 09-09-2016 07:57 AM
It's a recent change, but createOSXInstallPkg
can now generate installers for macOS Sierra which can upgrade Macs currently running El Capitan:
https://github.com/munki/createOSXinstallPkg/commit/a3236fad0460d25c98957cb6ff76318c44537891