3 # /etc/rc.d/rc.sysinit - run once at boot time
5 # Taken in part from Miquel van Smoorenburg's bcheckrc.
6 # Changes: Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
10 PATH=/bin:/sbin:/usr/bin:/usr/sbin
14 . /etc/rc.d/init.d/functions
16 # Read network config data.
17 if [ -f /etc/sysconfig/network ]; then
18 . /etc/sysconfig/network
24 # Read system config data.
25 if [ -f /etc/sysconfig/system ]; then
26 . /etc/sysconfig/system
28 RUN_SULOGIN_ON_ERR=yes
37 # Set console loglevel
38 /sbin/loglevel $CONSOLE_LOGLEVEL
41 run_cmd "Activating swap partitions" swapon -a
44 run_cmd "Host: ${HOSTNAME}" hostname ${HOSTNAME}
46 # Set the NIS domain name
47 if [ -n "$NISDOMAIN" ]; then
48 run_cmd "NIS Domain: ${NISDOMAIN}" domainname $NISDOMAIN
53 if [ -f /fsckoptions ]; then
54 fsckoptions=`cat /fsckoptions`
59 if [ -f /forcefsck ]; then
60 fsckoptions="-f $fsckoptions"
64 if [ ! -f /fastboot ]; then
65 show "Checking root filesystems."; started
66 initlog -c "fsck -T -a $fsckoptions /"
70 # A return of 2 or higher means there were serious problems.
71 if [ $rc -gt 1 ]; then
74 echo "*** An error occurred during the file system check."
75 echo "*** Dropping you to a shell; the system will reboot"
76 echo "*** when you leave the shell."
78 PS1="(Repair filesystem) \#"; export PS1
79 if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
85 run_cmd "Unmounting file systems" umount -a
86 mount -n -o remount,ro /
87 run_cmd "Automatic reboot in progress." reboot
88 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
93 if [ -x /sbin/quotaon ]; then
94 run_cmd "Turning on quotas on root filesystem" /sbin/quotaon /
99 mount -t proc /proc /proc
100 if grep -i nopnp /proc/cmdline >/dev/null ; then
107 if [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
108 if [ -n "$PNP" ] && [ "$RUN_ISAPNP" == "yes" ]; then
109 run_cmd "Setting up ISA PNP devices"/sbin/isapnp /etc/isapnp/isapnp.conf
111 show "Skipping ISA PNP configuration"; ok
115 # Remount the root filesystem read-write.
116 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
118 # Update quotas if fsck was run on /.
119 if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
120 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -v /
123 # /etc/nologin when starting system
124 if [ "$DELAY_LOGIN" == "yes" ] && [ ! -f /etc/nologin ]; then
125 show "Enabling Delay Login"; busy
127 echo "[EN] System bootup in progress - please wait" >> /etc/nologin
128 echo "[PL] Startowanie systemu w toku - proszê czekaæ" >> /etc/nologin
130 chmod 644 /etc/nologin
131 cp -fp /etc/nologin /etc/nologin.boot
139 # Enter root and /proc into mtab.
143 if ! grep -i nomodules /proc/cmdline >/dev/null && [ -f /proc/ksyms ]; then
149 # Set up kernel version-dependent symlinks.
150 rm -f /lib/modules/preferred
151 if [ -n "$USEMODULES" ]; then
152 ktag="`cat /proc/version`"
153 mtag="`grep -l "$ktag" /lib/modules/*/.rhkmvtag 2> /dev/null`"
154 if [ -n "$mtag" ]; then
155 mver="`echo $mtag | sed -e 's,/lib/modules/,,' -e 's,/.rhkmvtag,,' -e 's,[ ].*$,,'`"
156 ln -sf /lib/modules/$mver /lib/modules/preferred
157 ln -sf /boot/System.map-$mver /boot/System.map
158 ln -sf /boot/module-info-$mver /boot/module-info
162 if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then
163 # Get ready for kerneld if module support in the kernel
164 if [ -e /lib/modules/preferred ]; then
165 run_cmd "Finding module dependencies" depmod -a preferred
167 run_cmd "Finding module dependencies" depmod -a
172 if (! grep -i nomodules /proc/cmdline >/dev/null) && [ "$LOAD_SOUND" == "yes" ]; then
173 if [ -n "$USEMODULES" ]; then
174 if grep -s "alias sound" /etc/modules.conf > /dev/null ; then
175 run_cmd "Loading sound module" modprobe sound
176 if grep -s "alias midi" /etc/conf.modules > /dev/null ; then
177 run_cmd "Loading midi module" modprobe midi
183 if [ -f /proc/sys/kernel/modprobe ]; then
184 # /proc/sys/kernel/modprobe indicates built-in kmod instead
185 echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
189 if [ -f /proc/mdstat -a -f /etc/raidtab -a -x /sbin/raidstart ]; then
190 show "Starting up RAID devices."; started
191 initlog -c "raidstart -a"
195 # A non-zero return means there were problems.
196 if [ $rc -gt 0 ]; then
199 echo "*** An error occurred during the RAID startup"
200 echo "*** Dropping you to a shell; the system will reboot"
201 echo "*** when you leave the shell."
203 PS1="(RAID Repair) \#"; export PS1
204 if [ "$RUN_SULOGIN_ON_ERR" == "yes"]; then
210 run_cmd "Unmounting file systems" umount -a
211 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
212 run_cmd "Automatic reboot in progress" reboot
217 if [ ! -f /fastboot ]; then
218 show "Checking filesystems."; started
219 initlog -c "fsck -T -R -A -a $fsckoptions"
223 # A return of 2 or higher means there were serious problems.
224 if [ $rc -gt 1 ]; then
227 echo "*** An error occurred during the file system check."
228 echo "*** Dropping you to a shell; the system will reboot"
229 echo "*** when you leave the shell."
231 PS1="(Repair filesystem) \#"; export PS1
232 if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
238 run_cmd "Unmounting file systems" umount -a
239 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
240 run_cmd "Automatic reboot in progress." reboot
241 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
242 run_cmd "Checking filesystem quotas"/sbin/quotacheck -v -R -a
246 # Mount all other filesystems (except for NFS and /proc, which is already
247 # mounted). Contrary to standard usage,
248 # filesystems are NOT unmounted in single user mode.
249 run_cmd "Mounting local filesystems." mount -a -t nonfs,smbfs,ncpfs,proc
251 # set the console font
252 if [ -x /sbin/setsysfont ]; then
253 show "Loading default system font"; busy
254 if (/sbin/setsysfont > /dev/null 2>&1); then deltext; ok; else deltext; fail; fi
257 if [ -x /sbin/quotaon ]; then
258 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -a
261 # Clean out /etc & /var/{run/*,log/{b,w}tmpx}}.
262 rm -f /etc/mtab~ /fastboot /fsckoptions /forcefsck
265 chown root.utmpx /var/run/utmpx
266 chmod 0664 /var/run/utmpx /var/log/wtmpx
269 if [ "$CLEAN_TMP" == "yes" ]; then
273 # Delete UUCP lock files.
276 # Delete stale subsystem files.
277 rm -f /var/lock/subsys/*
279 # Delete stale pid files
281 rm -f /var/spool/postoffice/.pid.*
286 # Delete Postgres sockets
287 rm -f /tmp/.s.PGSQL.*
289 # Set the system clock.
290 show "Setting clock"; busy
294 if [ -f /etc/sysconfig/clock ]; then
295 . /etc/sysconfig/clock
297 # convert old style clock config to new values
298 if [ "${CLOCKMODE}" = "GMT" ]; then
300 elif [ "${CLOCKMODE}" = "ARC" ]; then
305 if [ -x /sbin/hwclock ]; then
306 CLOCKFLAGS="--hctosys"
315 CLOCKFLAGS="$CLOCKFLAGS -u";
322 CLOCKFLAGS="$CLOCKFLAGS -A";
328 if ($CLOCK $CLOCKFLAGS); then deltext; ok; else deltext; fail; fi
330 show "Date set to `date`"; ok
332 # Right, now turn on swap in case we swap to files.
333 show "Enabling swap space"; busy
334 if [ "`LANG=C swapon -a 2>&1 | grep -v "busy"`" == "" ]; then
340 # Initialize the serial ports.
341 if [ -f /etc/rc.d/rc.serial ]; then
342 . /etc/rc.d/rc.serial
345 # If a SCSI tape has been detected, load the st module unconditionally
346 # since many SCSI tapes don't deal well with st being loaded and unloaded
347 if [ -f /proc/scsi/scsi ] && cat /proc/scsi/scsi | grep -q 'Type: Sequential-Access' 2>/dev/null ; then
348 if cat /proc/devices | grep -qv ' 9 st' ; then
349 if [ -n "$USEMODULES" ] ; then
350 # Try to load the module. If it fails, ignore it...
351 insmod -p st >/dev/null 2>&1 && modprobe st >/dev/null 2>&1
356 # there could be a new kernel version. reinit /etc/psdevtab, to be sure.
358 #if [ -x /bin/ps ]; then
359 #show "Rebuilding /etc/psdevtab database"; busy
360 #if (ps > /dev/null 2>&1); then deltext; ok; else deltext; fail; fi
363 if [ -x /sbin/ldconfig ]; then
364 run_cmd "Setting up /etc/ld.so.cache" /sbin/ldconfig -X
367 if ([ -f /proc/sys/kernel/panic ] && [ "$PANIC_REBOOT_TIME" -gt "0" ] 2>/dev/null); then
368 show "Sending val. $PANIC_REBOOT_TIME to /proc/sys/kernel/panic"; busy
369 if (echo $PANIC_REBOOT_TIME > /proc/sys/kernel/panic); then deltext; ok; else deltext; fail; fi
372 # Now that we have all of our basic modules loaded and the kernel going,
373 # let's dump the syslog ring somewhere so we can find it later
374 dmesg > /var/log/dmesg
375 chmod 640 /var/log/dmesg
377 # Feed entropy into the entropy pool
378 /etc/rc.d/init.d/random start