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