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