]> git.pld-linux.org Git - projects/rc-scripts.git/blame - rc.d/rc.sysinit
- remount rootfs rw only if no option 'ro' in fstab
[projects/rc-scripts.git] / rc.d / rc.sysinit
CommitLineData
12de71be 1#!/bin/sh
7742e157
AF
2#
3# /etc/rc.d/rc.sysinit - run once at boot time
ec8b15cb 4# $Id$
7742e157
AF
5#
6# Taken in part from Miquel van Smoorenburg's bcheckrc.
7#
8
b6509675
AM
9# reasonable start values for bootsplash progress.
10export progress=0
11export sscripts=45
12export kscripts=45
13
38198f50 14# NLS
de1fc6ce 15if [ -r /etc/sysconfig/i18n ]; then
38198f50
AM
16 . /etc/sysconfig/i18n
17 [ -n "$LANG" ] && export LANG || unset LANG
18 [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
19 [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
20 [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
21 [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
22 [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
23 [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
24 [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL
25 [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
26 [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
27fi
28
418c0cf3 29# Read network config data
de1fc6ce 30if [ -r /etc/sysconfig/network ]; then
1b228409 31 . /etc/sysconfig/network
7742e157 32else
1b228409 33 NETWORKING=no
34 HOSTNAME=localhost
7742e157
AF
35fi
36
277e5f53 37CONSOLE_LOGLEVEL=1
45e88cd0 38
e298d489
JR
39# Read functions
40. /etc/rc.d/init.d/functions
41
483f1dda
ER
42disable_selinux() {
43 typeset _d selinuxfs _t _r
44
45 while read _d selinuxfs _t _r; do
46 [ "$_t" = "selinuxfs" ] && break
47 done </proc/mounts
48 echo "*** Warning -- SELinux is active"
49 echo "*** Disabling security enforcement for system recovery."
50 echo "*** Run 'setenforce 1' to reenable."
51 echo "0" > $selinuxfs/enforce
52}
53
54relabel_selinux() {
55 typeset _d selinuxfs _t _r
56
57 while read _d selinuxfs _t _r; do
58 [ "$_t" = "selinuxfs" ] && break
59 done </proc/mounts
60 echo "
61 *** Warning -- SELinux relabel is required. ***
62 *** Disabling security enforcement. ***
63 *** Relabeling could take a very long time, ***
64 *** depending on file system size. ***
65 "
66 echo "0" > $selinuxfs/enforce
67 /sbin/fixfiles -F relabel > /dev/null 2>&1
68 rm -f /.autorelabel
69 echo "*** Enabling security enforcement. ***"
70 echo $SELINUX > $selinuxfs/enforce
71}
72
73# Remove duplicate entries from mtab (for vserver guest use only)
74clean_vserver_mtab() {
75 :>/etc/mtab.clean
76 while read device mountpoint line; do
77 grep -qs "$mountpoint" /etc/mtab.clean || \
78 echo "$device $mountpoint $line" >> /etc/mtab.clean
79 done < /etc/mtab
80 cat /etc/mtab.clean > /etc/mtab
81 rm -f /etc/mtab.clean
82}
83
3aabb390
ER
84# Loads modules from /etc/modules, /etc/modules.X.Y and /etc/modules.X.Y.Z
85load_kernel_modules() {
86 {
87 local _x _y v _z
88 read _x _y v _z
89 old_IFS=$IFS
90 IFS='.'
91 set -- $v
92 IFS=$old_IFS
93 kernel="$1.$2"
94 kerneleq="$1.$2.$3"
95 } < /proc/version
96
97 local module
98 # Loop over every line in modules file
99 ( \
100 egrep -hv '^(#|[[:blank:]]*$)' /etc/modules /etc/modules.$kernel /etc/modules.$kerneleq 2>/dev/null
101 echo '' # make sure there is a LF at the end
102 ) | while read module args; do
103 [ -z "$module" ] && continue
104 modprobe -s $module -- $args
105 done
106}
483f1dda 107
48e500cd
ER
108# boot logging to /var/log/boot.msg. install showconsole package to get it.
109if [ -x /sbin/blogd ] && ! is_no "$RC_BOOTLOG"; then
110 RC_BOOTLOG=1
111else
112 RC_BOOTLOG=
113fi
114
5163449d 115if ! is_yes "$VSERVER" ; then
a1ad6ea5
ER
116 # we need /proc mounted before everything
117 mount -n -o gid=17 -t proc /proc /proc
118
b0290bbb
ER
119 # Only read this once.
120 cmdline=$(cat /proc/cmdline)
121
5163449d
JR
122 # sysfs is also needed before any other things (under kernel > 2.5)
123 if grep -q sysfs /proc/filesystems 2>/dev/null ; then
124 mount -n -o gid=17 -t sysfs sysfs /sys
125 if [ "$(kernelver)" -ge "002006014" ] && \
126 grep -q securityfs /proc/filesystems 2>/dev/null ; then
127 mount -n -o gid=17 -t securityfs securityfs /sys/kernel/security
128 fi
defac991 129 fi
e298d489 130
5163449d
JR
131 # selinux
132 if grep -q selinuxfs /proc/filesystems 2>/dev/null && ! grep -q selinuxfs /proc/mounts 2>/dev/null; then
133 mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
134 fi
e298d489 135
ffe19b59 136 # PLD Linux LiveCD support
01b60fd3
JR
137 if [ -x /etc/rc.d/rc.live ]; then
138 /etc/rc.d/rc.live
139 fi
e298d489 140
01b60fd3
JR
141 # Choose Hardware profile
142 if [ -f /etc/sysconfig/hwprof ]; then
143 . /etc/sysconfig/hwprof
144 if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then
145 mount -n / -o rw,remount
146 /sbin/hwprofile -qf
147 mount -n / -o ro,remount
148 fi
5e6dfc29 149 fi
e298d489 150
01b60fd3
JR
151 # Disable splash when requested
152 [ -e /proc/splash ] && is_no "$BOOT_SPLASH" && echo "0" > /proc/splash
5b0f5a94 153
c5e74817
ER
154 # Check SELinux status
155 selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts 2> /dev/null)
156 SELINUX=
157 if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
158 if [ -r $selinuxfs/enforce ] ; then
159 SELINUX=$(cat $selinuxfs/enforce)
160 else
161 # assume enforcing if you can't read it
162 SELINUX=1
163 fi
5e6dfc29 164 fi
677fdd75 165
c5e74817
ER
166 if [ -x /sbin/restorecon ] && LC_ALL=C fgrep -q " /dev " /proc/mounts 2>/dev/null ; then
167 /sbin/restorecon -R /dev 2>/dev/null
168 fi
677fdd75
AM
169
170
7e16b45e
ER
171 [ -z "${CONSOLETYPE}" ] && CONSOLETYPE="$(/sbin/consoletype)"
172
c5e74817
ER
173 if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then
174 /sbin/setsysfont
175 fi
12c4fb70 176fi
5b0f5a94 177
652dbae5 178
458f14b7 179# Print welcome message
503bfc80 180nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)"
8a917f32 181if ! is_no "$RC_PROMPT"; then
503bfc80 182 nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
6b4a354c 183 echo
6b4a354c 184fi
201c98b9 185
cc10e704 186# Set the hostname
499b251c
JR
187if [ -z "${HOSTNAME}" ]; then
188 show "$(nls 'Host:') $(hostname)" ; ok
189else
190 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
191fi
6956336c 192
cc10e704
JR
193# Set the NIS domain name
194if [ -n "$NISDOMAIN" ]; then
195 run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
196else
197 domainname ""
4289a4ff
AM
198fi
199
cc10e704
JR
200if ! is_yes "$VSERVER"; then
201 # Set console loglevel
202 if [ -n "$CONSOLE_LOGLEVEL" ]; then
203 /bin/dmesg -n $CONSOLE_LOGLEVEL
204 fi
6bf50269 205
348aacfc
TP
206 if ! is_no "$START_UDEV"; then
207 [ -x /sbin/start_udev ] && /sbin/start_udev
208 fi
5e6dfc29 209
6a8f0f05 210 # Unmount the initrd, if necessary
426e1497 211 if grep -q /initrd /proc/mounts 2>/dev/null && ! grep -q /initrd/loopfs /proc/mounts 2>/dev/null; then
426e1497 212 umount /initrd/dev 2>/dev/null
6a8f0f05
ER
213 umount /initrd
214 /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
215 fi
216
33c6207a
ER
217 # Start logging console output since we have all /dev stuff setup
218 if [ "$RC_BOOTLOG" ]; then
0868c9a6 219 /sbin/blogd
33c6207a
ER
220 fi
221
cc10e704 222 # cpuset support (mounted unconditionally, shouldn't be a problem)
5bae5434 223 if grep -q cgroup /proc/filesystems 2>/dev/null ; then
5708fcc4 224 mount -n -t cgroup none /dev/cpuset -ocpuset,noprefix
5bae5434
JR
225 [ $? -eq 0 ] && echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent
226 elif grep -q cpuset /proc/filesystems 2>/dev/null ; then
5e6dfc29 227 mount -n -t cpuset none /dev/cpuset
cc10e704 228 fi
201c98b9 229
cc10e704
JR
230 # Configure Linux kernel (initial configuration, some required modules still
231 # may be missing).
232 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
201c98b9 233
cc10e704
JR
234 # Set the system clock.
235 ARC=0
236 SRM=0
237 UTC=0
201c98b9 238
cc10e704
JR
239 if [ -f /etc/sysconfig/clock ]; then
240 . /etc/sysconfig/clock
201c98b9 241
cc10e704
JR
242 # convert old style clock config to new values
243 if [ "${CLOCKMODE}" = "GMT" ]; then
244 UTC=true
245 elif [ "${CLOCKMODE}" = "ARC" ]; then
246 ARC=true
247 fi
248 fi
201c98b9 249
cc10e704
JR
250 if grep "system serial" /proc/cpuinfo 2>/dev/null | grep -q MILO 2>/dev/null ; then
251 ARC=true
252 fi
cb4d1aa7 253
cc10e704
JR
254 CLOCKDEF=""
255 CLOCKFLAGS="--hctosys"
cb4d1aa7 256
cc10e704
JR
257 if is_yes "$UTC" ; then
258 CLOCKFLAGS="$CLOCKFLAGS --utc"
259 CLOCKDEF="$CLOCKDEF (utc)"
260 else
261 CLOCKFLAGS="$CLOCKFLAGS --localtime"
262 CLOCKDEF="$CLOCKDEF (local)"
263 fi
201c98b9 264
cc10e704
JR
265 if is_yes "$ARC" ; then
266 CLOCKFLAGS="$CLOCKFLAGS -A"
267 CLOCKDEF="$CLOCKDEF (arc)"
0bbfed6f 268 fi
e4b0481f 269
cc10e704
JR
270 if is_yes "$SRM" ; then
271 CLOCKFLAGS="$CLOCKFLAGS -S"
272 CLOCKDEF="$CLOCKDEF (srm)"
273 fi
7742e157 274
cc10e704 275 # Check if timezone definition is available
bc05b297 276 if [ -e /etc/localtime -a -e /dev/rtc ] ; then
cc10e704
JR
277 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
278 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
279 fi
280 else
281 TIME_SETUP_DELAYED=yes
282 fi
7742e157 283
6b496866 284 if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then
dd23d50d
ER
285 # XXX might need modules dep
286 # Device mapper & related initialization
287 if ! fgrep -q device-mapper /proc/devices; then
288 modprobe dm-mod
289 fi
290
291 # but should do this before swapon?
292 . /etc/rc.d/init.d/cryptsetup
8710c4b5 293 show "Starting disk encryption"
dd23d50d
ER
294 init_crypto 0 && ok || fail
295 fi
296
cc10e704
JR
297 # Start up swapping
298 run_cmd "Activating swap partitions" swapon -a -e
299
300 # Initialize USB controllers
301 usb=0
07ea1da7 302 if ! strstr "$cmdline" "nousb" && ! grep -q "/proc/bus/usb" /proc/mounts 2>/dev/null ; then
86711d93 303 aliases=$(/sbin/modprobe -c | awk '/^alias[\t ]+usb-controller/ { print $3 }')
cc10e704 304 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
a6a4a758 305 /sbin/modprobe -s -k usbcore
cc10e704
JR
306 for alias in $aliases ; do
307 [ "$alias" = "off" ] && continue
a6a4a758 308 run_cmd "$(nls 'Initializing USB controller') ($alias)" /sbin/modprobe -s $alias
cc10e704
JR
309 done
310 [ $? -eq 0 -a -n "$aliases" ] && usb=1
311 fi
312 if grep -iq "usb" /proc/devices 2>/dev/null ; then
313 usb=1
314 fi
315 fi
7742e157 316
cc10e704 317 if [ "$usb" = "1" -a ! -f /proc/bus/usb/devices ]; then
a40bbbec 318 run_cmd "Mounting USB filesystem" mount -n -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb
b3965b3d 319 fi
b3965b3d 320
cc10e704
JR
321 needusbstorage=
322 if [ "$usb" = "1" ]; then
323 needusbstorage=$(LC_ALL=C cat /proc/bus/usb/devices 2>/dev/null|grep -e "^I.*Cls=08" 2>/dev/null)
324 if [ "$(kernelverser)" -lt "002006" ]; then
5e6dfc29
JR
325 LC_ALL=C grep -q 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe hid 2> /dev/null
326 mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null)
327 kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null)
328 if [ -n "$kbdoutput" ]; then
329 run_cmd "Initializing USB keyboard" modprobe keybdev
330 fi
331 if [ -n "$mouseoutput" ]; then
332 run_cmd "Initializing USB mouse" modprobe mousedev
333 fi
cc10e704
JR
334 fi
335 fi
b3965b3d 336
cc10e704 337 # Setup hdparm thing (if exists and is needed)
07ea1da7 338 if ! strstr "$cmdline" nohdparm; then
cc10e704 339 [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
ebd1845b 340 fi
b3965b3d 341
07ea1da7 342 if [ -f /fastboot ] || strstr "$cmdline" "fastboot"; then
cc10e704
JR
343 fastboot=yes
344 else
345 fastboot=
346 fi
03f9cfee 347
cc10e704
JR
348 if [ -f /fsckoptions ]; then
349 fsckoptions=$(cat /fsckoptions)
350 else
351 fsckoptions=''
352 fi
cb4d1aa7 353
cc10e704
JR
354 if [ -f /forcefsck ]; then
355 fsckoptions="-f $fsckoptions"
790968dd
ER
356 else
357 # Obey the fs_passno setting for / (see fstab(5))
358 # - find the / entry
6fe4e4eb
ER
359 # - make sure we have at least 6 fields
360 _ROOTFS_PASSNO=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $6}' /etc/fstab)
cc10e704 361 fi
7742e157 362
cc10e704 363 _RUN_QUOTACHECK=0
dc12b33c 364 _ROOTFS_DEVICE=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $1}' /etc/fstab)
2fce16f9 365 _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null)
cc10e704 366
dc12b33c 367 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_PASSNO" != 0 -a -e $_ROOTFS_DEVICE ]; then
cc10e704
JR
368 show "Checking root filesystem"; started
369 initlog -c "fsck -C -T -a $fsckoptions /"
370
371 rc=$?
372
373 # A return of 4 or higher means there were serious problems.
374 if [ $rc -gt 3 ]; then
375 [ -e /proc/splash ] && echo "verbose" > /proc/splash
376 # don't use '\n' in nls macro !
377 echo
378 echo
379 nls "*** An error occurred during the file system check."
380 nls "*** Dropping you to a shell; the system will reboot"
381 nls "*** when you leave the shell."
382 echo
383
526b7c62 384 PS1="`nls '(Repair filesystem)# '`"; export PS1
cc10e704 385 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 386 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
cc10e704
JR
387 /sbin/sulogin
388 else
389 /bin/sh
390 fi
cee18a41 391
cc10e704
JR
392 run_cmd "Unmounting file systems" umount -a
393 mount -n -o remount,ro /
394 run_cmd "Automatic reboot in progress" reboot
395 # A return of 2 or 3 means that filesystem was repaired but we need
396 # to reboot.
397 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
398 [ -e /proc/splash ] && echo "verbose" > /proc/splash
399 echo
400 nls "*** Filesystem was repaired but system needs to be"
401 nls "*** rebooted before mounting it."
402 nls "*** REBOOTING ***"
403 echo
404
405 run_cmd "Unmounting file systems" umount -a
406 mount -n -o remount,ro /
407 run_cmd "Automatic reboot in progress" reboot
408 elif [ "$rc" = "1" ]; then
409 _RUN_QUOTACHECK=1
cb4d1aa7 410 fi
cb4d1aa7 411 fi
7742e157 412
5e6dfc29 413 # Check for arguments
07ea1da7 414 if strstr "$cmdline" nopnp; then
cc10e704
JR
415 PNP=
416 else
417 PNP=yes
418 fi
7742e157 419
cc10e704
JR
420 # set up pnp and kernel pnp
421 if [ -n "$PNP" ]; then
277e5f53 422 if ! is_no "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
5e6dfc29
JR
423 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
424 fi
277e5f53 425 if ! is_no "$RUN_KERNELPNP"; then
5e6dfc29
JR
426 /sbin/modprobe -k isa-pnp 2> /dev/null
427 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
428 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
429 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
430 fi
cc10e704 431 fi
b68f99e5 432 fi
7742e157 433
47e385fd 434 _ROOTFS_RO=$(awk '($1 !~ /^#/ && $2 == "/" && ($4 == "ro" || $4 ~ /,ro$// || $4 ~ /^ro,/ || $4 ~ /,ro,/ ) && NF >= 6) { print "ro" }' /etc/fstab)
cc10e704 435 # Remount the root filesystem read-write
47e385fd 436 if [ "x$_ROOTFS_RO" == "x" ] ; then
437 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
438 fi
cee18a41 439
cc10e704
JR
440 # Update quotas if fsck was run on /
441 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
442 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
443 fi
aa362992 444
5475bb0f
ER
445 # Clean up SELinux labels
446 if [ -n "$SELINUX" ]; then
447 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache ; do
448 [ -r $file ] && restorecon $file >/dev/null 2>&1
449 done
450 fi
652dbae5 451
6b496866 452 if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then
dd23d50d 453 # XXX, this must be probably done after random is initialized from /var/run/random-seed
1b05bb8a 454 show "Starting disk encryption using the RNG"
dd23d50d
ER
455 init_crypto 1 && ok || fail
456 fi
652dbae5
ER
457else
458 # Start logging console output since we have all /dev stuff setup
459 if [ "$RC_BOOTLOG" ]; then
460 /sbin/blogd -q
461 fi
677fdd75 462fi
5e6dfc29 463
cb4d1aa7 464# Remove stale backups
47e385fd 465rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~ >/dev/null 2>&1
cb4d1aa7 466
ef05209d
JR
467# Remove /etc/nologin when starting system
468[ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
469
277e5f53 470if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
ef05209d
JR
471 show "Enabling Delay Login"; busy
472 echo > /etc/nologin
473 nls "System bootup in progress - please wait" >> /etc/nologin
474 echo >> /etc/nologin
475 chmod 644 /etc/nologin
476 cp -fp /etc/nologin /etc/nologin.boot
477 ok
478fi
479
480# The root filesystem is now read-write, so we can now log via
481# syslog() directly...
482if [ -n "$IN_INITLOG" ]; then
483 IN_INITLOG=""
484fi
485
cc10e704 486if ! is_yes "$VSERVER"; then
220df3e7
JR
487 # Clear mtab
488 :>/etc/mtab
489 [ -f /etc/cryptomtab ] && :>/etc/cryptomtab
490
34c624e7 491 # Enter root, /proc, /sys and other into mtab.
cc10e704
JR
492 mount -f /
493 mount -f /proc
a40bbbec 494 [ -f /proc/bus/usb/devices ] && mount -f -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb
7d45bad6 495
29be11b0 496 if grep -q sysfs /proc/mounts 2>/dev/null; then
cc10e704 497 mount -f -t sysfs sysfs /sys
29be11b0 498 if grep -q securityfs /proc/mounts 2>/dev/null ; then
defac991
AM
499 mount -f -t securityfs securityfs /sys/kernel/security
500 fi
cc10e704 501 fi
ad084d91 502
29be11b0 503 if grep -q selinuxfs /proc/mounts 2>/dev/null; then
cc10e704
JR
504 mount -f -t selinuxfs selinuxfs /selinux
505 fi
cb4d1aa7 506
29be11b0 507 if grep -q cpuset /proc/mounts 2>/dev/null; then
2d495b7f 508 mount -f -t cpuset none /dev/cpuset
cc10e704 509 fi
fd6887dc 510
cc10e704
JR
511 if [ ! -f /proc/modules ]; then
512 USEMODULES=
07ea1da7 513 elif ! strstr "$cmdline" nomodules; then
cc10e704
JR
514 USEMODULES=y
515 else
516 USEMODULES=
4cc4301b 517 fi
de1fc6ce 518
0b38e7f1 519 uname_r=$(uname -r)
cc10e704
JR
520 # Adjust symlinks as necessary in /boot to keep system services from
521 # spewing messages about mismatched System maps and so on.
277e5f53 522 if ! is_no "$SET_SLINKS"; then
c14f9857
ER
523 if [ -L /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
524 ln -s -f System.map-$uname_r /boot/System.map
cc10e704 525 fi
c14f9857
ER
526 if [ ! -e /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
527 ln -s -f System.map-$uname_r /boot/System.map
cc10e704 528 fi
418c0cf3 529 fi
7742e157 530
cc10e704
JR
531 # Run depmod if RUN_DEPMOD != "no" and:
532 # a) user requested or RUN_DEPMOD="";
533 # b) modules.dep is missing
cc10e704
JR
534 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
535 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
536 run_cmd "Finding module dependencies" depmod -a
0b38e7f1 537 elif [ "$RUN_DEPMOD" = "ifmissing" ] && [ ! -f /lib/modules/$uname_r/modules.dep ]; then
cc10e704
JR
538 run_cmd "Finding module dependencies" depmod -A
539 fi
aa362992 540 fi
0b38e7f1 541 unset uname_r
5bb58804 542
cc10e704
JR
543 if [ -f /proc/sys/kernel/modprobe ]; then
544 if [ -n "$USEMODULES" ]; then
545 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
cc10e704
JR
546 else
547 # We used to set this to NULL, but that causes
548 # 'failed to exec' messages"
549 sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
cc10e704 550 fi
cb4d1aa7 551 fi
cb4d1aa7 552
cc10e704
JR
553 # Load usb storage here, to match most other things
554 if [ -n "$needusbstorage" ]; then
555 modprobe -k usb-storage >/dev/null 2>&1
556 fi
cb4d1aa7 557
cc10e704 558 # Load firewire devices
07ea1da7 559 if ! strstr "$cmdline" nofirewire; then
cc10e704
JR
560 aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }')
561 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
5e6dfc29
JR
562 for alias in $aliases ; do
563 [ "$alias" = "off" ] && continue
564 run_cmd "$(nls 'Initializing firewire controller') ($alias)" /sbin/modprobe $alias
565 done
566 LC_ALL=C grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && /sbin/modprobe -s sbp2 > /dev/null 2>&1
cc10e704 567 fi
5e6dfc29
JR
568 fi
569
cc10e704 570 # Load sound modules if they need persistent DMA buffers
4056c2bf
ER
571 if [ $(kernelverser) = "002006" ]; then
572 MODULES_CONF=/etc/modprobe.conf
573 elif [ -r /etc/modules.conf ]; then
574 MODULES_CONF=/etc/modules.conf
575 else
576 MODULES_CONF=/etc/conf.modules
577 fi
578
cc10e704
JR
579 if grep -q "^options sound dmabuf=1" "$MODULES_CONF" 2>/dev/null ; then
580 RETURN=0
581 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
582 if [ -n "$alias" -a "$alias" != "off" ] ; then
583 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
584 RETURN=$?
585 fi
586 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound-slot-0[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
587 if [ -n "$alias" -a "$alias" != "off" ] ; then
588 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
589 RETURN=$?
f47acf6f
JR
590 fi
591 fi
472fa41e 592
cc10e704 593 # Load modules
3aabb390 594 load_kernel_modules
7742e157 595
e62309d9 596 if [ -x /sbin/multipath ]; then
2607b4f4 597 # first make nodes that were discarded due (possible) new /dev mount
6dbec259 598 modprobe -s dm-mod
2607b4f4 599 /sbin/dmsetup mknodes
7da998bd 600 modprobe -s dm-multipath
e62309d9 601 run_cmd "Activating dm-multipath" /sbin/multipath -v 0
094b84e1 602 /sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p'
e62309d9
ER
603 fi
604
3a4304f3
AM
605 if [ -x /sbin/dmraid ]; then
606 run_cmd "Activating ATARAID devices" /sbin/dmraid -ay
607 fi
608
cc10e704
JR
609 # Find and activate volume groups:
610 # EVMS
611 if [ -x /sbin/evms_activate ]; then
cc10e704 612 if [ "$(kernelverser)" -lt "002006" ]; then
5e6dfc29
JR
613 # Linux 2.4 core modules
614 modprobe -s -k evms > /dev/null 2>&1
615 modprobe -s -k evms_passthru > /dev/null 2>&1
616 modprobe -s -k ldev_mgr > /dev/null 2>&1
617 modprobe -s -k dos_part > /dev/null 2>&1
cc10e704 618 else
5e6dfc29
JR
619 # Linux 2.6 core module
620 modprobe -s -k evmscore > /dev/null 2>&1
d6749722 621 fi
5e6dfc29 622
cc10e704
JR
623 is_yes "$EVMS_GUID_PTABLE" && modprobe -s -k gpt_part >/dev/null 2>&1
624 is_yes "$EVMS_LVM" && modprobe -s -k lvm_vge >/dev/null 2>&1
625 is_yes "$EVMS_AIX" && modprobe -s -k AIXlvm_vge >/dev/null 2>&1
626 is_yes "$EVMS_OS2" && modprobe -s -k os2lvm_vge >/dev/null 2>&1
627 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
628 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
629 # Link nodes for compatibility with LVM
24fec6e3
ER
630 if [ "$(echo /dev/evms/lvm/*)" != '/dev/evms/lvm/*' ] ; then
631 ln -s /dev/evms/lvm/* /dev
de1fc6ce 632 fi
cc10e704
JR
633 fi
634 fi
49c61c56 635
cc10e704
JR
636 # LVM (keep in sync with LVM starting after RAID run!)
637 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
638 lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk '{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version: ",""); gsub(/\..*/,"");print $1; exit}')
639 if [ "$lvmversion" = "1" ] ; then
640 modprobe -s -k lvm-mod >/dev/null 2>&1
641 lvmignorelock=""
642 elif [ "$lvmversion" = "2" ] ; then
643 modprobe -s -k dm-mod >/dev/null 2>&1
644 lvmignorelock="--ignorelockingfailure"
645 else
5e6dfc29
JR
646 modprobe -s -k lvm-mod >/dev/null 2>&1
647 # device mapper (2.5+ and patched 2.4)
648 modprobe -s -k dm-mod >/dev/null 2>&1
649 lvmignorelock=""
cc10e704 650 fi
5e6dfc29 651
2607b4f4 652 run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelock
cc10e704 653 run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmignorelock
fcc79c02
ER
654 if [ "$lvmversion" = "2" ]; then
655 /sbin/vgmknodes
656 # display VG statistics
657 /sbin/vgdisplay -s
658 fi
cc10e704
JR
659 fi
660
661 # Add raid devices
662 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ] || [ -f /etc/raidtab ]; then
cc10e704
JR
663 modprobe -s md >/dev/null 2>&1
664 if [ -f /proc/mdstat ]; then
5e6dfc29
JR
665 goraidtab=1
666 golvm=0
667 rc=0
668 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
669 if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null); then
0fe527f8 670 run_cmd "Starting up RAID devices" /sbin/mdadm --assemble --scan --auto=yes
5e6dfc29
JR
671 rc=$?
672 [ "$rc" -eq 0 ] && goraidtab=0 && golvm=1
cc10e704 673 fi
5e6dfc29
JR
674 fi
675
676 if [ -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
49c61c56 677 for i in $(awk '!/^#/ && /raiddev/{print $2}' /etc/raidtab 2>/dev/null); do
5e6dfc29
JR
678 golvm=1
679 RAIDDEV=$(basename $i)
680 RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat 2>/dev/null)
681 show "Starting up RAID device %s" $RAIDDEV
682 busy
683 if [ -z "$RAIDSTAT" ]; then
684 # Try raidstart first...if that fails then
685 # fall back to raid0run and if that fails too
686 # fall back to raidadd, raidrun.
687 RESULT=1
688 if [ -x /sbin/raidstart ]; then
689 /sbin/raidstart $i
690 RESULT=$?
691 fi
692 if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
693 /sbin/raid0run $i
694 RESULT=$?
695 fi
696 if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x /sbin/raidrun ]; then
697 /sbin/raidadd $i
698 /sbin/raidrun $i
699 RESULT=$?
700 fi
701 if [ $RESULT -gt 0 ]; then
702 rc=1
703 fail
704 else
705 ok
706 fi
707 else
708 ok
709 fi
710 done
711 fi
712
713 # A non-zero return means there were problems
714 if [ $rc -gt 0 ]; then
715 [ -e /proc/splash ] && echo "verbose" > /proc/splash
716 show "Starting up RAID devices"; fail
717 echo
718 echo
719 nls "*** An error occurred during the RAID startup."
720 nls "*** Dropping you to a shell; the system will reboot"
721 nls "*** when you leave the shell."
722 echo
723
724 PS1="$(nls '(RAID Repair)# ')"; export PS1
725 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 726 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
5e6dfc29 727 /sbin/sulogin
cc10e704 728 else
5e6dfc29 729 /bin/sh
cc10e704 730 fi
12de71be 731
5e6dfc29
JR
732 run_cmd "Unmounting file systems" umount -a
733 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
734 run_cmd "Automatic reboot in progress" reboot
cc10e704 735 fi
5e6dfc29
JR
736 # LVM on RAID (keep in sync with LVM setting few lines above)
737 if [ "$golvm" -eq "1" ]; then
738 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
2607b4f4 739 run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelock
5e6dfc29 740 run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmignorelock
2607b4f4 741 [ "$lvmversion" = "2" ] && /sbin/vgmknodes
5e6dfc29 742 fi
cc10e704 743 fi
5e6dfc29 744 show "Starting up RAID devices"; ok
2619a5cf 745 fi
12de71be 746 fi
7742e157 747
cc10e704
JR
748 _RUN_QUOTACHECK=0
749 # Check filesystems
07ea1da7 750 if [ -z "$fastboot" ] && ! strstr "$cmdline" nofsck; then
cc10e704
JR
751 rc_splash "fsck start"
752 show "Checking filesystems"; started
790968dd 753 initlog -c "fsck -C -T -R -A -a -P $fsckoptions"
cc10e704
JR
754
755 rc=$?
756
757 # A return of 2 or higher means there were serious problems
758 if [ $rc -gt 1 ]; then
759 [ -e /proc/splash ] && echo "verbose" > /proc/splash
760 echo
761 echo
762 nls "*** An error occurred during the file system check."
763 nls "*** Dropping you to a shell; the system will reboot"
764 nls "*** when you leave the shell."
765 echo
766
767 PS1="$(nls '(Repair filesystem)# ')"; export PS1
768 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 769 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
cc10e704
JR
770 /sbin/sulogin
771 else
772 /bin/sh
773 fi
7742e157 774
cc10e704
JR
775 run_cmd "Unmounting file systems" umount -a
776 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
777 run_cmd "Automatic reboot in progress" reboot
778 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
779 _RUN_QUOTACHECK=1
780 fi
781 rc_splash "fsck stop"
7742e157 782 fi
7742e157 783
cc10e704
JR
784 # Mount all other filesystems (except for NFS and /proc, which is already
785 # mounted). Contrary to standard usage,
786 # filesystems are NOT unmounted in single user mode.
787
438bf720 788 run_cmd "Mounting local filesystems" mount -a -t nonfs,nfs4,smbfs,ncpfs,proc,cifs -O no_netdev
cc10e704 789
9a0a016d
ER
790 # now we have /usr mounted, recheck if we have gettext and tput available.
791 if is_no "$TPUT"; then
792 GETTEXT=
348aacfc 793 TPUT=
04342743 794 rc_gettext_init
9a0a016d
ER
795 fi
796
cc10e704
JR
797 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
798 # before mount - that's where the password is entered.
799 # mount is buggy - when remounting loopback filesystem, loop=XXX
800 # option is removed from /etc/mtab
801 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
802 show "Checking encrypted filesystems"; started
fea9b6da 803 LOOPLIST="$(LC_ALL=C awk '
cc10e704
JR
804 FILENAME=="/proc/mounts" {
805 TAB[$2]=$1;
806 }
807 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
808 if ($2 in TAB){print TAB[$2];}
809 }
810 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
811 if ($2 in TAB){print TAB[$2];}
812 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
813 cmd="mount " $2 " -o remount," $4;
814 system(cmd);
815 }
816 ' /proc/mounts /etc/fstab)"
817 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
818 rc=$?
819
820 # A return of 2 or higher means there were serious problems.
821 if [ $rc -gt 1 ]; then
822 [ -e /proc/splash ] && echo "verbose" > /proc/splash
823 echo
824 echo
825 nls "*** An error occurred during the file system check."
826 nls "*** Dropping you to a shell; the system will reboot"
827 nls "*** when you leave the shell."
828 echo
829
bf14fcab 830 PS1="$(nls '(Repair filesystem)# ')"; export PS1
cc10e704 831 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 832 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
cc10e704
JR
833 /sbin/sulogin
834 else
835 /bin/sh
836 fi
6fa97a5d 837
cc10e704
JR
838 run_cmd "Unmounting file systems" umount -a
839 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
840 run_cmd "Automatic reboot in progress" reboot
841 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
842 _RUN_QUOTACHECK=1
843 fi
5e6dfc29 844
cc10e704
JR
845 show "Remounting encrypted filesystems back in rw mode"; busy
846 awk '
847 FILENAME=="/proc/mounts" {
848 TAB[$2]=$1;
849 }
850 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
851 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
852 cmd="mount " $2 " -o remount," $4;
853 system(cmd);
854 }
855 ' /proc/mounts /etc/fstab
856 ok
857 fi
6e16ab8f 858
9a0a016d 859 # /var/log should be writable now, so start saving the boot output
652dbae5
ER
860 if [ "$RC_BOOTLOG" ]; then
861 echo > /var/log/boot.msg
862 killall -IO blogd
863 fi
cb4d1aa7 864
1aaf8c92
JR
865 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
866 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
867 fi
cb4d1aa7 868
1aaf8c92
JR
869 # Turn on quota
870 if [ -x /sbin/quotaon ]; then
871 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
872 fi
677fdd75 873
1aaf8c92
JR
874 # Turn on process accounting
875 if [ -x /etc/rc.d/rc.acct ]; then
876 /etc/rc.d/rc.acct start
877 fi
cb4d1aa7 878
cc10e704 879 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
bc05b297 880 if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc ]; then
cc10e704
JR
881 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
882 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
883 fi
0bbfed6f 884 fi
0bbfed6f 885
cc10e704
JR
886 # Initialize the serial ports
887 if [ -f /etc/rc.d/rc.serial ]; then
888 . /etc/rc.d/rc.serial
889 fi
201c98b9 890
277e5f53 891 if [ -f /proc/sys/kernel/panic -a -n "$PANIC_REBOOT_TIME" -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
cc10e704
JR
892 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
893 if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME >/dev/null 2>&1); then ok; else fail; fi
894 fi
201c98b9 895
cc10e704
JR
896 # ... and here finish configuring parameters
897 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
ef05209d 898else
fea9b6da 899 # /var/log should be writable now, so start saving the boot output
652dbae5
ER
900 if [ "$RC_BOOTLOG" ]; then
901 echo > /var/log/boot.msg
902 killall -IO blogd
903 fi
904
ef05209d 905 clean_vserver_mtab
cc10e704 906fi
adec827a 907
652dbae5 908
1aaf8c92
JR
909[ -n "$SELINUX" ] && [ -f /.autorelabel ] && relabel_selinux
910
6239bd5c 911# Clean up /.
47e385fd 912rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff >/dev/null 2>&1
cb4d1aa7
JR
913
914# Clean up /var
5145ce41 915# /usr could be still not mounted if it is on NFS.
cb4d1aa7 916for afile in /var/lock/* /var/run/*; do
fea9b6da 917 bafile=${afile##*/}
cb4d1aa7 918 if [ -d "$afile" ]; then
38b419e3 919 case $bafile in
fea9b6da
ER
920 news|sudo|mon|cvs)
921 ;;
922 *)
91dc9337 923 echo $afile/* | xargs rm -rf
fea9b6da 924 ;;
38b419e3 925 esac
cb4d1aa7 926 else
5e6dfc29 927 [ "$bafile" != "hwprofile" ] && rm -f $afile 2> /dev/null
cb4d1aa7
JR
928 fi
929done
5145ce41 930
e0cba078 931# Delete stale files
4eb58d70
AM
932rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
933 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
934rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
5e6dfc29
JR
935 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
936 /tmp/scrollkeeper-* /tmp/ssh-*
45955ed4 937
201c98b9 938{
6b4a354c 939# Clean up utmp/wtmp
fea9b6da 940if ! is_no "$NEED_XFILES"; then
6b4a354c
AM
941 :>/var/run/utmpx
942 touch /var/log/wtmpx
afa9b748 943 chown root:utmp /var/run/utmpx /var/log/wtmpx
19b0557d 944 chmod 0664 /var/run/utmpx /var/log/wtmpx
054a52c9
JR
945else
946 :>/var/run/utmp
947 touch /var/log/wtmp
afa9b748 948 chown root:utmp /var/run/utmp /var/log/wtmp
19b0557d 949 chmod 0664 /var/run/utmp /var/log/wtmp
6b4a354c 950fi
7e04fe0e 951
7e04fe0e 952# Clean /tmp
fcf89189 953if is_yes "$CLEAN_TMP"; then
fea9b6da 954 # XXX LC_ALL needed here
cb4d1aa7 955 rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
7e04fe0e 956fi
7742e157 957
e6c8dd44
AM
958# System protected dirs
959mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
960chown root:root /tmp/.ICE-unix
677fdd75 961[ -n "$SELINUX" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
e6c8dd44 962
1aaf8c92 963if ! is_yes "$VSERVER"; then
fea9b6da 964 run_cmd "Enabling swap space" /bin/true
1aaf8c92
JR
965 # Right, now turn on swap in case we swap to files
966 swapon -a >/dev/null 2>&1
7742e157 967
0d60cc3e
JR
968 # If a SCSI tape has been detected, load the st module unconditionally
969 # since many SCSI tapes don't deal well with st being loaded and unloaded
970 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
971 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
972 if [ -n "$USEMODULES" ] ; then
973 # Try to load the module. If it fails, ignore it...
974 insmod -p st >/dev/null 2>&1 && modprobe -s st >/dev/null 2>&1
975 fi
7742e157
AF
976 fi
977 fi
7742e157 978
cc10e704
JR
979 # Now that we have all of our basic modules loaded and the kernel going,
980 # let's dump the syslog ring somewhere so we can find it later
c8f4b766 981 dmesg > /var/log/dmesg
cc10e704
JR
982 i=5
983 while [ $i -ge 0 ]; do
984 if [ -f /var/log/dmesg.$i ]; then
5e6dfc29
JR
985 chmod 0600 /var/log/dmesg.$i
986 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
cc10e704
JR
987 fi
988 i=$(($i-1))
989 done
990 cp -f /var/log/dmesg /var/log/dmesg.0
991 chmod 0600 /var/log/dmesg /var/log/dmesg.0
992fi
7742e157 993
de1fc6ce 994kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
6b4a354c 995} &
385dc542
ER
996
997# extra check if the background process we just spawned is still running,
998# as in case of vserver bootup it finishes quite instantly.
999if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
7c341db5 1000 /sbin/getkey -c 5 i && touch /var/run/confirm
6b4a354c
AM
1001fi
1002wait
de1fc6ce 1003echo
This page took 0.346427 seconds and 4 git commands to generate.