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 # setup media type dependent parameters
105 if [ -f /etc/rc.d/rc.media ]; then
109 # Remount the root filesystem read-write.
110 echo "Remounting root filesystem in read-write mode."
111 mount -n -o remount,rw /
116 # Enter root and /proc into mtab.
120 if [ -f /proc/ksyms ]; then
126 # Set up kernel version-dependent symlinks.
127 rm -f /lib/modules/preferred
128 if [ -n "$USEMODULES" ]; then
129 ktag="`cat /proc/version`"
130 mtag=`grep -l "$ktag" /lib/modules/*/.rhkmvtag` 2> /dev/null
131 if [ -n "$mtag" ]; then
132 mver=`echo $mtag | sed -e 's,/lib/modules/,,' -e 's,/.rhkmvtag,,' -e 's,[ ].*$,,'`
133 ln -sf /lib/modules/$mver /lib/modules/preferred
134 ln -sf /boot/System.map-$mver /boot/System.map
135 ln -sf /boot/module-info-$mver /boot/module-info
139 if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then
140 # Get ready for kerneld if module support in the kernel
141 echo -n "Finding module dependencies... "
142 if [ -e /lib/modules/preferred ]; then
151 if ! grep -i nomodules /proc/cmdline >/dev/null ; then
152 if [ -n "$USEMODULES" ]; then
153 if grep -s "alias sound" /etc/conf.modules > /dev/null ; then
155 if grep -s "alias midi" /etc/conf.modules > /dev/null ; then
162 if [ -f /proc/sys/kernel/modprobe ]; then
163 # /proc/sys/kernel/modprobe indicates built-in kmod instead
164 echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
168 if [ -f /proc/mdstat -a -f /etc/raidtab -a -x /sbin/raidadd ]; then
169 echo "Starting up RAID devices."
179 # A non-zero return means there were problems.
180 if [ $rc -gt 0 ]; then
183 echo "*** An error occurred during the RAID startup"
184 echo "*** Dropping you to a shell; the system will reboot"
185 echo "*** when you leave the shell."
187 PS1="(RAID Repair) \#"; export PS1
188 if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
194 echo "Unmounting file systems"
196 mount -n -o remount,ro /
197 echo "Automatic reboot in progress."
203 if [ ! -f /fastboot ]; then
204 echo "Checking filesystems."
205 fsck -R -A -V -a $fsckoptions
209 # A return of 2 or higher means there were serious problems.
210 if [ $rc -gt 1 ]; then
213 echo "*** An error occurred during the file system check."
214 echo "*** Dropping you to a shell; the system will reboot"
215 echo "*** when you leave the shell."
217 PS1="(Repair filesystem) \#"; export PS1
218 if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
224 echo "Unmounting file systems"
226 mount -n -o remount,ro /
227 echo "Automatic reboot in progress."
229 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
230 echo "Checking filesystem quotas"
231 /sbin/quotacheck -v -R -a
235 # Mount all other filesystems (except for NFS and /proc, which is already
236 # mounted). Contrary to standard usage,
237 # filesystems are NOT unmounted in single user mode.
238 echo "Mounting local filesystems."
239 mount -a -t nonfs,proc
241 # set the console font
242 if [ -x /sbin/setsysfont ]; then
246 if [ -x /sbin/quotaon ]; then
247 echo "Turning on user and group quotas for local filesystems"
252 rm -f /etc/mtab~ /fastboot /fsckoptions
255 # Delete UUCP lock files.
258 # Delete stale subsystem files.
259 rm -f /var/lock/subsys/*
261 # Delete stale pid files
263 rm -f /var/spool/postoffice/.pid.*
268 # Delete Postgres sockets
269 rm -f /tmp/.s.PGSQL.*
271 # Set the system clock.
272 echo -n "Setting clock"
276 if [ -f /etc/sysconfig/clock ]; then
277 . /etc/sysconfig/clock
279 # convert old style clock config to new values
280 if [ "${CLOCKMODE}" = "GMT" ]; then
282 elif [ "${CLOCKMODE}" = "ARC" ]; then
287 if [ -x /sbin/hwclock ]; then
288 CLOCKFLAGS="--hctosys"
297 CLOCKFLAGS="$CLOCKFLAGS -u";
304 CLOCKFLAGS="$CLOCKFLAGS -A";
314 # Right, now turn on swap in case we swap to files.
315 echo "Enabling swap space."
316 swapon -a 2>&1 | grep -v "busy"
318 # Initialize the serial ports.
319 if [ -f /etc/rc.d/rc.serial ]; then
320 . /etc/rc.d/rc.serial
323 # Load modules (for backward compatibility with VARs)
324 if [ -f /etc/rc.d/rc.modules ]; then
328 # If a SCSI tape has been detected, load the st module unconditionally
329 # since many SCSI tapes don't deal well with st being loaded and unloaded
330 if [ -f /proc/scsi/scsi ] && cat /proc/scsi/scsi | grep -q 'Type: Sequential-Access' 2>/dev/null ; then
331 if cat /proc/devices | grep -qv ' 9 st' ; then
332 if [ -n "$USEMODULES" ] ; then
333 # Try to load the module. If it fails, ignore it...
334 modprobe st 2>/dev/null
339 # Now that we have all of our basic modules loaded and the kernel going,
340 # let's dump the syslog ring somewhere so we can find it later
341 dmesg > /var/log/dmesg
342 chmod 640 /var/log/dmesg
344 # Feed entropy into the entropy pool
345 /etc/rc.d/init.d/random start