The rc Scripts
The init process launches the /etc/rc.boot and /etc/rc shell scripts to start the system. Both rc scripts (and all startup items) source the /etc/rc.common script, which sets the initial environment, defines some useful functions, and loads the /etc/hostconfig file. /etc/hostconfig controls which system services need to be started and defines such things as the AppleTalk hostname. Example 2-2 is an excerpt from the hostconfig file.
SSHSERVER=-YES- WEBSERVER=-YES- APPLETALK_HOSTNAME=*427269616e204a6570736f6ed57320436f6d7075746572*
This excerpt shows that sshd and httpd will be started on “Brian Jepson’s Computer” (the decoded AppleTalk hostname) at startup. The AppleTalk hostname is encoded as a sequence of hexadecimal bytes (for example, 42=B, 72=r, 69=i, 61=a, and 6e=n).
After rc.boot has loaded in values from /etc/rc.common, it determines whether the system is booting from a CD. Next, rc.boot tests to see whether the system is booting in single-user mode. If the system is neither in single-user mode nor booting from a CD, then rc.boot performs a check of the filesystem (fsck). If the fsck fails, then rc.boot tries an fsck -y, which assumes a “Yes” answer to all the questions that fsck asks. If that fails, the system reboots (and may end up trying an fsck -y over and over again).
Tip
If you find yourself in an fsck loop, you should boot from the Mac OS X installation CD. You can boot from a CD by holding down the C key ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access