3 # /etc/rc.d/rc.sysinit - run once at boot time
5 # Taken in part from Miquel van Smoorenburg's bcheckrc.
9 PATH=/bin:/sbin:/usr/bin:/usr/sbin
12 # Read network config data.
13 if [ -f /etc/sysconfig/network ]; then
14 . /etc/sysconfig/network
20 # Read system config data.
21 if [ -f /etc/sysconfig/system ]; then
22 . /etc/sysconfig/system
24 RUN_SULOGIN_ON_ERR=yes
28 echo "Activating swap partitions"
33 echo hostname: `hostname`
35 # Set the NIS domain name
36 if [ -n "$NISDOMAIN" ]; then
42 if [ -f /fsckoptions ]; then
43 fsckoptions=`cat /fsckoptions`
48 if [ ! -f /fastboot ]; then
49 echo "Checking root filesystems."
50 fsck -V -a $fsckoptions /
54 # A return of 2 or higher means there were serious problems.
55 if [ $rc -gt 1 ]; then
58 echo "*** An error occurred during the file system check."
59 echo "*** Dropping you to a shell; the system will reboot"
60 echo "*** when you leave the shell."
62 PS1="(Repair filesystem) \#"; export PS1
63 if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
69 echo "Unmounting file systems"
71 mount -n -o remount,ro /
72 echo "Automatic reboot in progress."
74 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
75 echo "Checking root filesystem quotas"
80 if [ -x /sbin/quotaon ]; then
81 echo "Turning on user and group quotas for root filesystem"
87 mount -t proc /proc /proc
88 if grep -i nopnp /proc/cmdline >/dev/null ; then
95 if [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
96 if [ -n "$PNP" ]; then
97 echo "Setting up ISA PNP devices"
98 /sbin/isapnp /etc/isapnp/isapnp.conf
100 echo "Skipping ISA PNP configuration at users request"
104 # Remount the root filesystem read-write.
105 echo "Remounting root filesystem in read-write mode."
106 mount -n -o remount,rw /
111 # Enter root and /proc into mtab.
115 if [ -f /proc/ksyms ]; then
121 # Set up kernel version-dependent symlinks.
122 rm -f /lib/modules/preferred
123 if [ -n "$USEMODULES" ]; then
124 ktag="`cat /proc/version`"
125 mtag=`grep -l "$ktag" /lib/modules/*/.rhkmvtag` 2> /dev/null
126 if [ -n "$mtag" ]; then
127 mver=`echo $mtag | sed -e 's,/lib/modules/,,' -e 's,/.rhkmvtag,,' -e 's,[ ].*$,,'`
128 ln -sf /lib/modules/$mver /lib/modules/preferred
129 ln -sf /boot/System.map-$mver /boot/System.map
130 ln -sf /boot/module-info-$mver /boot/module-info
134 if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then
135 # Get ready for kerneld if module support in the kernel
136 echo -n "Finding module dependencies... "
137 if [ -e /lib/modules/preferred ]; then
146 if ! grep -i nomodules /proc/cmdline >/dev/null ; then
147 if [ -n "$USEMODULES" ]; then
148 if grep -s "alias sound" /etc/conf.modules > /dev/null ; then
150 if grep -s "alias midi" /etc/conf.modules > /dev/null ; then
157 if [ -f /proc/sys/kernel/modprobe ]; then
158 # /proc/sys/kernel/modprobe indicates built-in kmod instead
159 echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
163 if [ -f /proc/mdstat -a -f /etc/raidtab -a -x /sbin/raidadd ]; then
164 echo "Starting up RAID devices."
174 # A non-zero return means there were problems.
175 if [ $rc -gt 0 ]; then
178 echo "*** An error occurred during the RAID startup"
179 echo "*** Dropping you to a shell; the system will reboot"
180 echo "*** when you leave the shell."
182 PS1="(RAID Repair) \#"; export PS1
183 if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
189 echo "Unmounting file systems"
191 mount -n -o remount,ro /
192 echo "Automatic reboot in progress."
198 if [ ! -f /fastboot ]; then
199 echo "Checking filesystems."
200 fsck -R -A -V -a $fsckoptions
204 # A return of 2 or higher means there were serious problems.
205 if [ $rc -gt 1 ]; then
208 echo "*** An error occurred during the file system check."
209 echo "*** Dropping you to a shell; the system will reboot"
210 echo "*** when you leave the shell."
212 PS1="(Repair filesystem) \#"; export PS1
213 if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
219 echo "Unmounting file systems"
221 mount -n -o remount,ro /
222 echo "Automatic reboot in progress."
224 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
225 echo "Checking filesystem quotas"
226 /sbin/quotacheck -v -R -a
230 # Mount all other filesystems (except for NFS and /proc, which is already
231 # mounted). Contrary to standard usage,
232 # filesystems are NOT unmounted in single user mode.
233 echo "Mounting local filesystems."
234 mount -a -t nonfs,proc
236 # set the console font
237 if [ -x /sbin/setsysfont ]; then
241 if [ -x /sbin/quotaon ]; then
242 echo "Turning on user and group quotas for local filesystems"
247 rm -f /etc/mtab~ /fastboot /fsckoptions
250 # Delete UUCP lock files.
253 # Delete stale subsystem files.
254 rm -f /var/lock/subsys/*
256 # Delete stale pid files
258 rm -f /var/spool/postoffice/.pid.*
263 # Delete Postgres sockets
264 rm -f /tmp/.s.PGSQL.*
266 # Set the system clock.
267 echo -n "Setting clock"
271 if [ -f /etc/sysconfig/clock ]; then
272 . /etc/sysconfig/clock
274 # convert old style clock config to new values
275 if [ "${CLOCKMODE}" = "GMT" ]; then
277 elif [ "${CLOCKMODE}" = "ARC" ]; then
282 if [ -x /sbin/hwclock ]; then
283 CLOCKFLAGS="--hctosys"
292 CLOCKFLAGS="$CLOCKFLAGS -u";
299 CLOCKFLAGS="$CLOCKFLAGS -A";
309 # Right, now turn on swap in case we swap to files.
310 echo "Enabling swap space."
311 swapon -a 2>&1 | grep -v "busy"
313 # Initialize the serial ports.
314 if [ -f /etc/rc.d/rc.serial ]; then
315 . /etc/rc.d/rc.serial
318 # Load modules (for backward compatibility with VARs)
319 if [ -f /etc/rc.d/rc.modules ]; then
323 # If a SCSI tape has been detected, load the st module unconditionally
324 # since many SCSI tapes don't deal well with st being loaded and unloaded
325 if [ -f /proc/scsi/scsi ] && cat /proc/scsi/scsi | grep -q 'Type: Sequential-Access' 2>/dev/null ; then
326 if cat /proc/devices | grep -qv ' 9 st' ; then
327 if [ -n "$USEMODULES" ] ; then
328 # Try to load the module. If it fails, ignore it...
329 modprobe st 2>/dev/null
334 # Now that we have all of our basic modules loaded and the kernel going,
335 # let's dump the syslog ring somewhere so we can find it later
336 dmesg > /var/log/dmesg
337 chmod 640 /var/log/dmesg
339 # Feed entropy into the entropy pool
340 /etc/rc.d/init.d/random start