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