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