0

I'm working at a University and we are restoring our Macs using Apples ars which works great. The process is to manually go to the computer - reboot it in recovery mode and then run the ars command to sync the image from the server.

Is it possible to do this via shell script? I imagine the steps to be roughly:

  1. Set a OSX flag that reboots into the recovery mode.
  2. Execute a shell script that runs the asr (Maybe via LaunchDaemon?)
  3. Reset the flag to boot from the normal boot volume
  4. Reboot

Unfortunately I did not find information how to manually reboot into recovery mode or launch an automatic script from the recovery partition.

Do you have any idea how this could work?

Thanks for your help!

  • 2
    do you have netboot capabilities? i don't know how editable/controllable recovery mode is -- i don't even think they have a full set of commands in terminal. – neuralstatic Dec 9 '14 at 19:38
  • Look into NetInstall / Casper suite / DeployStudio and last but not least Munki ! – Asmus Jan 22 '15 at 21:30
  • @venicejeff That's true, its a really downgraded linux - but the most important commands are available e.g. asr. – Thomas Fankhauser Jan 26 '15 at 10:18
1

To set the flag to boot in safe mode is the easiest: sudo nvram boot-args="-x"

The I guess we have to do something with;

rc.boot figures out the type of boot (Multi-User, Safe, CD-ROM, Network etc.). In case of a network boot (the sysctl variable kern.netboot will be set to 1 in which case), it runs /etc/rc.netboot with a start argument.

and this;

/etc/rc finally launches /sbin/SystemStarter to handle startup items from locations such as /System/Library/StartupItems and /Library/StartupItems. A StartupItem is a program, usually a shell script, whose name matches the folder name. The folder contains a property list file containing key-value pairs such as Description, Provides, Requires, OrderPreference, start/stop messages etc. You can run SystemStarter -n -D as root to have the program print debugging and dependency information (without actually running anything).

ref: http://osxbook.com/book/bonus/ancient/whatismacosx/arch_startup.html

  • Thanks for this reference - so you suggest to patch the recovery partition with a StartupItem that starts the syncing and then simply restarts by setting the nvram args? – Thomas Fankhauser Jan 26 '15 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .