#!/sbin/bash # prepare /etc/rc.local to reboot. # # also flags for read-write boot, and rc.local will remove the flag if necessary die() { echo $* exit 1 } install_file() { SRC="$1" DST="$2" OWN="$3" PERM="$4" /sbin/cp -p -r "$SRC" "$DST" /sbin/chown -R "$OWN" "$DST" /sbin/chmod -R "$PERM" "$DST" } echo " * Making sure next boot is read-write " echo > /OSBoot/.readwrite echo > /OSBoot/.patchstick-readwrite mount -t hfs -r /dev/disk0s4 /Scratch mount -uw /Scratch install_file /stuff/usb/autodiskmount.plist /Scratch/Scratch/Library/Preferences/SystemConfiguration/autodiskmount.plist 0:0 644 install_file /stuff/usb/rc.local /Scratch/Scratch/private/etc/rc.local 0:0 755 echo "done." umount /Scratch