3 # fstab: lists filesystems, this file is not changed from it's usual
4 # format, and is used as such
6 # rc.sysinit: done once at start time. responsible for performing any
7 # necessary early system initialization. This reads rc.conf for some
10 #PATH=/sbin:/usr/sbin:/bin:/usr/bin
12 . /etc/rc.d/functions.rc
15 # * load any kernel modules needed
17 # TODO check for /etc/fstab
18 # write one if missing?
20 # need to mount sys because fsck might use it
21 # try to mount them directly if they fail from fstab?
22 # TODO bail to emergency shell if these fail?
23 # TODO set NOVIRTFS='/var/run' and the like to skip some of these?
25 status_begin mounting virtual filesystems
26 mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev
27 mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev
28 mountpoint -q /var/run || mount -t tmpfs run /var/run -o mode=0755,nosuid,nodev
29 mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid
30 mkdir /dev/pts /dev/shm
31 mountpoint -q /dev/pts || mount -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec
32 mountpoint -q /dev/shm || mount -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
33 # and make sure they all passed
34 mountpoint -q /proc &&
36 mountpoint -q /var/run &&
38 mountpoint -q /dev/pts &&
39 mountpoint -q /dev/shm
42 #status_begin mounting virtual filesystems
49 status_begin Setting hostname
50 hostname ${HOSTNAME:=$(uname -s)}
53 # TODO should probably bail out if the /sys mount fails
55 # TODO decide if the loopback network interface should be done here or later
56 # I think later, it's not actually necessary
60 status_begin loading sysctl.conf
66 if [ -x /bin/mdev ] && [ ! is_true "$USE_UDEVD" ]; then
67 echo /bin/mdev > /proc/sys/kernel/hotplug
68 elif [ -x /lib/udev/udevd ]; then
70 ## begin voodoo scripting from lfs-initscripts
73 # udev will handle hotplugs
74 echo > /proc/sys/kernel/hotplug
77 # this should probably be moved to inittab or started via
78 # something that could monitor it
79 status_starting udevd daemon
80 /lib/udev/udevd --daemon
83 # Now traverse /sys in order to "coldplug" devices that have
84 # already been discovered
85 # this is going to fail if sys isn't mounted
86 status_begin populating udevadm triggers
87 udevadm trigger --action=add --type=subsystems &&
88 udevadm trigger --action=add --type=devices &&
89 udevadm trigger --action=change --type=devices
92 # Now wait for udevd to process the uevents we triggered
93 # if ! is_true "$OMIT_UDEV_SETTLE"; then
95 # quoted here so 'for' doesn't confuse syntax highlighting
96 status_begin 'waiting for udevadm to settle'
101 # If any LVM based partitions are on the system, ensure they
102 # are activated so they can be used.
103 # if [ -x /sbin/vgchange ]; then /sbin/vgchange -a y >/dev/null; fi
108 ## end voodoo scripting
116 # * fsck and mount filesystems
118 #status_starting fsck of /
119 #mount -o remount,ro /
121 # TODO actually check the return value
122 status_begin remounting root filesystem rw
123 mount -o remount,rw /
126 # mount any remaining filesystems
127 status_begin mounting remaining filesystems
128 mount -a -t noproc,sysfs,devtmpfs,devpts
135 # * do any boot time /tmp cleanup or similar
137 # * do any utmp/wtmp initialization needed
142 # * configure the console
144 # * set timezone and clock
146 status_begin setting system clock from hardware clock