]> git.pld-linux.org Git - projects/rc-scripts.git/blame - rc.d/rc.sysinit
- simplicity and verboseness wins: let try-restart inform if service is not running
[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
2fce16f9 374 _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null)
cc10e704 375
790968dd 376 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_PASSNO" != 0 ]; then
cc10e704
JR
377 show "Checking root filesystem"; started
378 initlog -c "fsck -C -T -a $fsckoptions /"
379
380 rc=$?
381
382 # A return of 4 or higher means there were serious problems.
383 if [ $rc -gt 3 ]; then
384 [ -e /proc/splash ] && echo "verbose" > /proc/splash
385 # don't use '\n' in nls macro !
386 echo
387 echo
388 nls "*** An error occurred during the file system check."
389 nls "*** Dropping you to a shell; the system will reboot"
390 nls "*** when you leave the shell."
391 echo
392
526b7c62 393 PS1="`nls '(Repair filesystem)# '`"; export PS1
cc10e704 394 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 395 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
cc10e704
JR
396 /sbin/sulogin
397 else
398 /bin/sh
399 fi
cee18a41 400
cc10e704
JR
401 run_cmd "Unmounting file systems" umount -a
402 mount -n -o remount,ro /
403 run_cmd "Automatic reboot in progress" reboot
404 # A return of 2 or 3 means that filesystem was repaired but we need
405 # to reboot.
406 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
407 [ -e /proc/splash ] && echo "verbose" > /proc/splash
408 echo
409 nls "*** Filesystem was repaired but system needs to be"
410 nls "*** rebooted before mounting it."
411 nls "*** REBOOTING ***"
412 echo
413
414 run_cmd "Unmounting file systems" umount -a
415 mount -n -o remount,ro /
416 run_cmd "Automatic reboot in progress" reboot
417 elif [ "$rc" = "1" ]; then
418 _RUN_QUOTACHECK=1
cb4d1aa7 419 fi
cb4d1aa7 420 fi
7742e157 421
5e6dfc29 422 # Check for arguments
07ea1da7 423 if strstr "$cmdline" nopnp; then
cc10e704
JR
424 PNP=
425 else
426 PNP=yes
427 fi
7742e157 428
cc10e704
JR
429 # set up pnp and kernel pnp
430 if [ -n "$PNP" ]; then
277e5f53 431 if ! is_no "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
5e6dfc29
JR
432 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
433 fi
277e5f53 434 if ! is_no "$RUN_KERNELPNP"; then
5e6dfc29
JR
435 /sbin/modprobe -k isa-pnp 2> /dev/null
436 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
437 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
438 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
439 fi
cc10e704 440 fi
b68f99e5 441 fi
7742e157 442
cc10e704 443 # Remount the root filesystem read-write
f1296be4 444 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
cee18a41 445
cc10e704
JR
446 # Update quotas if fsck was run on /
447 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
448 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
449 fi
aa362992 450
5475bb0f
ER
451 # Clean up SELinux labels
452 if [ -n "$SELINUX" ]; then
453 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache ; do
454 [ -r $file ] && restorecon $file >/dev/null 2>&1
455 done
456 fi
652dbae5 457
6b496866 458 if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then
dd23d50d
ER
459 # XXX, this must be probably done after random is initialized from /var/run/random-seed
460 show "Starting disk encryption using the RNG:"
461 init_crypto 1 && ok || fail
462 fi
652dbae5
ER
463else
464 # Start logging console output since we have all /dev stuff setup
465 if [ "$RC_BOOTLOG" ]; then
466 /sbin/blogd -q
467 fi
677fdd75 468fi
5e6dfc29 469
cb4d1aa7 470# Remove stale backups
7158cab8 471rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~
cb4d1aa7 472
ef05209d
JR
473# Remove /etc/nologin when starting system
474[ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
475
277e5f53 476if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
ef05209d
JR
477 show "Enabling Delay Login"; busy
478 echo > /etc/nologin
479 nls "System bootup in progress - please wait" >> /etc/nologin
480 echo >> /etc/nologin
481 chmod 644 /etc/nologin
482 cp -fp /etc/nologin /etc/nologin.boot
483 ok
484fi
485
486# The root filesystem is now read-write, so we can now log via
487# syslog() directly...
488if [ -n "$IN_INITLOG" ]; then
489 IN_INITLOG=""
490fi
491
cc10e704 492if ! is_yes "$VSERVER"; then
220df3e7
JR
493 # Clear mtab
494 :>/etc/mtab
495 [ -f /etc/cryptomtab ] && :>/etc/cryptomtab
496
cc10e704
JR
497 # Enter root, /proc, /sys, devfs and other into mtab.
498 mount -f /
499 mount -f /proc
500 [ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
501 [ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
7d45bad6 502
29be11b0 503 if grep -q sysfs /proc/mounts 2>/dev/null; then
cc10e704 504 mount -f -t sysfs sysfs /sys
29be11b0 505 if grep -q securityfs /proc/mounts 2>/dev/null ; then
defac991
AM
506 mount -f -t securityfs securityfs /sys/kernel/security
507 fi
cc10e704 508 fi
ad084d91 509
29be11b0 510 if grep -q selinuxfs /proc/mounts 2>/dev/null; then
cc10e704
JR
511 mount -f -t selinuxfs selinuxfs /selinux
512 fi
cb4d1aa7 513
29be11b0 514 if grep -q cpuset /proc/mounts 2>/dev/null; then
2d495b7f 515 mount -f -t cpuset none /dev/cpuset
cc10e704 516 fi
fd6887dc 517
cc10e704
JR
518 if [ ! -f /proc/modules ]; then
519 USEMODULES=
07ea1da7 520 elif ! strstr "$cmdline" nomodules; then
cc10e704
JR
521 USEMODULES=y
522 else
523 USEMODULES=
4cc4301b 524 fi
de1fc6ce 525
0b38e7f1 526 uname_r=$(uname -r)
cc10e704
JR
527 # Adjust symlinks as necessary in /boot to keep system services from
528 # spewing messages about mismatched System maps and so on.
277e5f53 529 if ! is_no "$SET_SLINKS"; then
c14f9857
ER
530 if [ -L /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
531 ln -s -f System.map-$uname_r /boot/System.map
cc10e704 532 fi
c14f9857
ER
533 if [ ! -e /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
534 ln -s -f System.map-$uname_r /boot/System.map
cc10e704 535 fi
418c0cf3 536 fi
7742e157 537
cc10e704
JR
538 # Run depmod if RUN_DEPMOD != "no" and:
539 # a) user requested or RUN_DEPMOD="";
540 # b) modules.dep is missing
cc10e704
JR
541 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
542 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
543 run_cmd "Finding module dependencies" depmod -a
0b38e7f1 544 elif [ "$RUN_DEPMOD" = "ifmissing" ] && [ ! -f /lib/modules/$uname_r/modules.dep ]; then
cc10e704
JR
545 run_cmd "Finding module dependencies" depmod -A
546 fi
aa362992 547 fi
0b38e7f1 548 unset uname_r
5bb58804 549
cc10e704
JR
550 if [ -f /proc/sys/kernel/modprobe ]; then
551 if [ -n "$USEMODULES" ]; then
552 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
cc10e704
JR
553 else
554 # We used to set this to NULL, but that causes
555 # 'failed to exec' messages"
556 sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
cc10e704 557 fi
cb4d1aa7 558 fi
cb4d1aa7 559
cc10e704
JR
560 # Load usb storage here, to match most other things
561 if [ -n "$needusbstorage" ]; then
562 modprobe -k usb-storage >/dev/null 2>&1
563 fi
cb4d1aa7 564
cc10e704 565 # Load firewire devices
07ea1da7 566 if ! strstr "$cmdline" nofirewire; then
cc10e704
JR
567 aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }')
568 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
5e6dfc29
JR
569 for alias in $aliases ; do
570 [ "$alias" = "off" ] && continue
571 run_cmd "$(nls 'Initializing firewire controller') ($alias)" /sbin/modprobe $alias
572 done
573 LC_ALL=C grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && /sbin/modprobe -s sbp2 > /dev/null 2>&1
cc10e704 574 fi
5e6dfc29
JR
575 fi
576
cc10e704 577 # Load sound modules if they need persistent DMA buffers
4056c2bf
ER
578 if [ $(kernelverser) = "002006" ]; then
579 MODULES_CONF=/etc/modprobe.conf
580 elif [ -r /etc/modules.conf ]; then
581 MODULES_CONF=/etc/modules.conf
582 else
583 MODULES_CONF=/etc/conf.modules
584 fi
585
cc10e704
JR
586 if grep -q "^options sound dmabuf=1" "$MODULES_CONF" 2>/dev/null ; then
587 RETURN=0
588 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
589 if [ -n "$alias" -a "$alias" != "off" ] ; then
590 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
591 RETURN=$?
592 fi
593 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound-slot-0[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
594 if [ -n "$alias" -a "$alias" != "off" ] ; then
595 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
596 RETURN=$?
f47acf6f
JR
597 fi
598 fi
472fa41e 599
cc10e704 600 # Load modules
3aabb390 601 load_kernel_modules
7742e157 602
e62309d9 603 if [ -x /sbin/multipath ]; then
2607b4f4
ER
604 # first make nodes that were discarded due (possible) new /dev mount
605 /sbin/dmsetup mknodes
e62309d9 606 run_cmd "Activating dm-multipath" /sbin/multipath -v 0
094b84e1 607 /sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p'
e62309d9
ER
608 fi
609
3a4304f3
AM
610 if [ -x /sbin/dmraid ]; then
611 run_cmd "Activating ATARAID devices" /sbin/dmraid -ay
612 fi
613
cc10e704
JR
614 # Find and activate volume groups:
615 # EVMS
616 if [ -x /sbin/evms_activate ]; then
cc10e704 617 if [ "$(kernelverser)" -lt "002006" ]; then
5e6dfc29
JR
618 # Linux 2.4 core modules
619 modprobe -s -k evms > /dev/null 2>&1
620 modprobe -s -k evms_passthru > /dev/null 2>&1
621 modprobe -s -k ldev_mgr > /dev/null 2>&1
622 modprobe -s -k dos_part > /dev/null 2>&1
cc10e704 623 else
5e6dfc29
JR
624 # Linux 2.6 core module
625 modprobe -s -k evmscore > /dev/null 2>&1
d6749722 626 fi
5e6dfc29 627
cc10e704
JR
628 is_yes "$EVMS_GUID_PTABLE" && modprobe -s -k gpt_part >/dev/null 2>&1
629 is_yes "$EVMS_LVM" && modprobe -s -k lvm_vge >/dev/null 2>&1
630 is_yes "$EVMS_AIX" && modprobe -s -k AIXlvm_vge >/dev/null 2>&1
631 is_yes "$EVMS_OS2" && modprobe -s -k os2lvm_vge >/dev/null 2>&1
632 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
633 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
634 # Link nodes for compatibility with LVM
24fec6e3
ER
635 if [ "$(echo /dev/evms/lvm/*)" != '/dev/evms/lvm/*' ] ; then
636 ln -s /dev/evms/lvm/* /dev
de1fc6ce 637 fi
cc10e704
JR
638 fi
639 fi
49c61c56 640
cc10e704
JR
641 # LVM (keep in sync with LVM starting after RAID run!)
642 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
643 lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk '{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version: ",""); gsub(/\..*/,"");print $1; exit}')
644 if [ "$lvmversion" = "1" ] ; then
645 modprobe -s -k lvm-mod >/dev/null 2>&1
646 lvmignorelock=""
647 elif [ "$lvmversion" = "2" ] ; then
648 modprobe -s -k dm-mod >/dev/null 2>&1
649 lvmignorelock="--ignorelockingfailure"
650 else
5e6dfc29
JR
651 modprobe -s -k lvm-mod >/dev/null 2>&1
652 # device mapper (2.5+ and patched 2.4)
653 modprobe -s -k dm-mod >/dev/null 2>&1
654 lvmignorelock=""
cc10e704 655 fi
5e6dfc29 656
2607b4f4 657 run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelock
cc10e704 658 run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmignorelock
2607b4f4 659 [ "$lvmversion" = "2" ] && /sbin/vgmknodes
cc10e704
JR
660 fi
661
662 # Add raid devices
663 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ] || [ -f /etc/raidtab ]; then
cc10e704
JR
664 modprobe -s md >/dev/null 2>&1
665 if [ -f /proc/mdstat ]; then
5e6dfc29
JR
666 goraidtab=1
667 golvm=0
668 rc=0
669 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
670 if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null); then
0fe527f8 671 run_cmd "Starting up RAID devices" /sbin/mdadm --assemble --scan --auto=yes
5e6dfc29
JR
672 rc=$?
673 [ "$rc" -eq 0 ] && goraidtab=0 && golvm=1
cc10e704 674 fi
5e6dfc29
JR
675 fi
676
677 if [ -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
49c61c56 678 for i in $(awk '!/^#/ && /raiddev/{print $2}' /etc/raidtab 2>/dev/null); do
5e6dfc29
JR
679 golvm=1
680 RAIDDEV=$(basename $i)
681 RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat 2>/dev/null)
682 show "Starting up RAID device %s" $RAIDDEV
683 busy
684 if [ -z "$RAIDSTAT" ]; then
685 # Try raidstart first...if that fails then
686 # fall back to raid0run and if that fails too
687 # fall back to raidadd, raidrun.
688 RESULT=1
689 if [ -x /sbin/raidstart ]; then
690 /sbin/raidstart $i
691 RESULT=$?
692 fi
693 if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
694 /sbin/raid0run $i
695 RESULT=$?
696 fi
697 if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x /sbin/raidrun ]; then
698 /sbin/raidadd $i
699 /sbin/raidrun $i
700 RESULT=$?
701 fi
702 if [ $RESULT -gt 0 ]; then
703 rc=1
704 fail
705 else
706 ok
707 fi
708 else
709 ok
710 fi
711 done
712 fi
713
714 # A non-zero return means there were problems
715 if [ $rc -gt 0 ]; then
716 [ -e /proc/splash ] && echo "verbose" > /proc/splash
717 show "Starting up RAID devices"; fail
718 echo
719 echo
720 nls "*** An error occurred during the RAID startup."
721 nls "*** Dropping you to a shell; the system will reboot"
722 nls "*** when you leave the shell."
723 echo
724
725 PS1="$(nls '(RAID Repair)# ')"; export PS1
726 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 727 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
5e6dfc29 728 /sbin/sulogin
cc10e704 729 else
5e6dfc29 730 /bin/sh
cc10e704 731 fi
12de71be 732
5e6dfc29
JR
733 run_cmd "Unmounting file systems" umount -a
734 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
735 run_cmd "Automatic reboot in progress" reboot
cc10e704 736 fi
5e6dfc29
JR
737 # LVM on RAID (keep in sync with LVM setting few lines above)
738 if [ "$golvm" -eq "1" ]; then
739 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
2607b4f4 740 run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelock
5e6dfc29 741 run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmignorelock
2607b4f4 742 [ "$lvmversion" = "2" ] && /sbin/vgmknodes
5e6dfc29 743 fi
cc10e704 744 fi
5e6dfc29 745 show "Starting up RAID devices"; ok
2619a5cf 746 fi
12de71be 747 fi
7742e157 748
cc10e704
JR
749 _RUN_QUOTACHECK=0
750 # Check filesystems
07ea1da7 751 if [ -z "$fastboot" ] && ! strstr "$cmdline" nofsck; then
cc10e704
JR
752 rc_splash "fsck start"
753 show "Checking filesystems"; started
790968dd 754 initlog -c "fsck -C -T -R -A -a -P $fsckoptions"
cc10e704
JR
755
756 rc=$?
757
758 # A return of 2 or higher means there were serious problems
759 if [ $rc -gt 1 ]; then
760 [ -e /proc/splash ] && echo "verbose" > /proc/splash
761 echo
762 echo
763 nls "*** An error occurred during the file system check."
764 nls "*** Dropping you to a shell; the system will reboot"
765 nls "*** when you leave the shell."
766 echo
767
768 PS1="$(nls '(Repair filesystem)# ')"; export PS1
769 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 770 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
cc10e704
JR
771 /sbin/sulogin
772 else
773 /bin/sh
774 fi
7742e157 775
cc10e704
JR
776 run_cmd "Unmounting file systems" umount -a
777 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
778 run_cmd "Automatic reboot in progress" reboot
779 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
780 _RUN_QUOTACHECK=1
781 fi
782 rc_splash "fsck stop"
7742e157 783 fi
7742e157 784
cc10e704
JR
785 # Mount all other filesystems (except for NFS and /proc, which is already
786 # mounted). Contrary to standard usage,
787 # filesystems are NOT unmounted in single user mode.
788
438bf720 789 run_cmd "Mounting local filesystems" mount -a -t nonfs,nfs4,smbfs,ncpfs,proc,cifs -O no_netdev
cc10e704 790
9a0a016d
ER
791 # now we have /usr mounted, recheck if we have gettext and tput available.
792 if is_no "$TPUT"; then
793 GETTEXT=
794 TPUT=
04342743 795 rc_gettext_init
9a0a016d
ER
796 fi
797
cc10e704
JR
798 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
799 # before mount - that's where the password is entered.
800 # mount is buggy - when remounting loopback filesystem, loop=XXX
801 # option is removed from /etc/mtab
802 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
803 show "Checking encrypted filesystems"; started
fea9b6da 804 LOOPLIST="$(LC_ALL=C awk '
cc10e704
JR
805 FILENAME=="/proc/mounts" {
806 TAB[$2]=$1;
807 }
808 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
809 if ($2 in TAB){print TAB[$2];}
810 }
811 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
812 if ($2 in TAB){print TAB[$2];}
813 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
814 cmd="mount " $2 " -o remount," $4;
815 system(cmd);
816 }
817 ' /proc/mounts /etc/fstab)"
818 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
819 rc=$?
820
821 # A return of 2 or higher means there were serious problems.
822 if [ $rc -gt 1 ]; then
823 [ -e /proc/splash ] && echo "verbose" > /proc/splash
824 echo
825 echo
826 nls "*** An error occurred during the file system check."
827 nls "*** Dropping you to a shell; the system will reboot"
828 nls "*** when you leave the shell."
829 echo
830
bf14fcab 831 PS1="$(nls '(Repair filesystem)# ')"; export PS1
cc10e704 832 [ "$SELINUX" = "1" ] && disable_selinux
277e5f53 833 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
cc10e704
JR
834 /sbin/sulogin
835 else
836 /bin/sh
837 fi
6fa97a5d 838
cc10e704
JR
839 run_cmd "Unmounting file systems" umount -a
840 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
841 run_cmd "Automatic reboot in progress" reboot
842 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
843 _RUN_QUOTACHECK=1
844 fi
5e6dfc29 845
cc10e704
JR
846 show "Remounting encrypted filesystems back in rw mode"; busy
847 awk '
848 FILENAME=="/proc/mounts" {
849 TAB[$2]=$1;
850 }
851 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
852 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
853 cmd="mount " $2 " -o remount," $4;
854 system(cmd);
855 }
856 ' /proc/mounts /etc/fstab
857 ok
858 fi
6e16ab8f 859
9a0a016d 860 # /var/log should be writable now, so start saving the boot output
652dbae5
ER
861 if [ "$RC_BOOTLOG" ]; then
862 echo > /var/log/boot.msg
863 killall -IO blogd
864 fi
cb4d1aa7 865
1aaf8c92
JR
866 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
867 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
868 fi
cb4d1aa7 869
1aaf8c92
JR
870 # Turn on quota
871 if [ -x /sbin/quotaon ]; then
872 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
873 fi
677fdd75 874
1aaf8c92
JR
875 # Turn on process accounting
876 if [ -x /etc/rc.d/rc.acct ]; then
877 /etc/rc.d/rc.acct start
878 fi
cb4d1aa7 879
cc10e704 880 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
bc05b297 881 if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc ]; then
cc10e704
JR
882 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
883 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
884 fi
0bbfed6f 885 fi
0bbfed6f 886
cc10e704
JR
887 # Initialize the serial ports
888 if [ -f /etc/rc.d/rc.serial ]; then
889 . /etc/rc.d/rc.serial
890 fi
201c98b9 891
277e5f53 892 if [ -f /proc/sys/kernel/panic -a -n "$PANIC_REBOOT_TIME" -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
cc10e704
JR
893 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
894 if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME >/dev/null 2>&1); then ok; else fail; fi
895 fi
201c98b9 896
cc10e704
JR
897 # ... and here finish configuring parameters
898 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
ef05209d 899else
fea9b6da 900 # /var/log should be writable now, so start saving the boot output
652dbae5
ER
901 if [ "$RC_BOOTLOG" ]; then
902 echo > /var/log/boot.msg
903 killall -IO blogd
904 fi
905
ef05209d 906 clean_vserver_mtab
cc10e704 907fi
adec827a 908
652dbae5 909
1aaf8c92
JR
910[ -n "$SELINUX" ] && [ -f /.autorelabel ] && relabel_selinux
911
6239bd5c 912# Clean up /.
cb4d1aa7
JR
913rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff
914
915# Clean up /var
cb4d1aa7 916for afile in /var/lock/* /var/run/*; do
fea9b6da 917 bafile=${afile##*/}
cb4d1aa7 918 if [ -d "$afile" ]; then
38b419e3 919 case $bafile in
fea9b6da
ER
920 news|sudo|mon|cvs)
921 ;;
922 *)
923 rm -rf $afile/*
924 ;;
38b419e3 925 esac
cb4d1aa7 926 else
5e6dfc29 927 [ "$bafile" != "hwprofile" ] && rm -f $afile 2> /dev/null
cb4d1aa7
JR
928 fi
929done
e0cba078 930# Delete stale files
4eb58d70
AM
931rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
932 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
933rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
5e6dfc29
JR
934 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
935 /tmp/scrollkeeper-* /tmp/ssh-*
45955ed4 936
201c98b9 937{
6b4a354c 938# Clean up utmp/wtmp
fea9b6da 939if ! is_no "$NEED_XFILES"; then
6b4a354c
AM
940 :>/var/run/utmpx
941 touch /var/log/wtmpx
afa9b748 942 chown root:utmp /var/run/utmpx /var/log/wtmpx
19b0557d 943 chmod 0664 /var/run/utmpx /var/log/wtmpx
054a52c9
JR
944else
945 :>/var/run/utmp
946 touch /var/log/wtmp
afa9b748 947 chown root:utmp /var/run/utmp /var/log/wtmp
19b0557d 948 chmod 0664 /var/run/utmp /var/log/wtmp
6b4a354c 949fi
7e04fe0e 950
7e04fe0e 951# Clean /tmp
fcf89189 952if is_yes "$CLEAN_TMP"; then
fea9b6da 953 # XXX LC_ALL needed here
cb4d1aa7 954 rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
7e04fe0e 955fi
7742e157 956
e6c8dd44
AM
957# System protected dirs
958mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
959chown root:root /tmp/.ICE-unix
677fdd75 960[ -n "$SELINUX" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
e6c8dd44 961
1aaf8c92 962if ! is_yes "$VSERVER"; then
fea9b6da 963 run_cmd "Enabling swap space" /bin/true
1aaf8c92
JR
964 # Right, now turn on swap in case we swap to files
965 swapon -a >/dev/null 2>&1
7742e157 966
0d60cc3e
JR
967 # If a SCSI tape has been detected, load the st module unconditionally
968 # since many SCSI tapes don't deal well with st being loaded and unloaded
969 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
970 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
971 if [ -n "$USEMODULES" ] ; then
972 # Try to load the module. If it fails, ignore it...
973 insmod -p st >/dev/null 2>&1 && modprobe -s st >/dev/null 2>&1
974 fi
7742e157
AF
975 fi
976 fi
7742e157 977
cc10e704
JR
978 # Now that we have all of our basic modules loaded and the kernel going,
979 # let's dump the syslog ring somewhere so we can find it later
980 dmesg -s 131072 > /var/log/dmesg
981 i=5
982 while [ $i -ge 0 ]; do
983 if [ -f /var/log/dmesg.$i ]; then
5e6dfc29
JR
984 chmod 0600 /var/log/dmesg.$i
985 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
cc10e704
JR
986 fi
987 i=$(($i-1))
988 done
989 cp -f /var/log/dmesg /var/log/dmesg.0
990 chmod 0600 /var/log/dmesg /var/log/dmesg.0
991fi
7742e157 992
de1fc6ce 993kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
6b4a354c 994} &
385dc542
ER
995
996# extra check if the background process we just spawned is still running,
997# as in case of vserver bootup it finishes quite instantly.
998if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
7c341db5 999 /sbin/getkey -c 5 i && touch /var/run/confirm
6b4a354c
AM
1000fi
1001wait
de1fc6ce 1002echo
8192b17e
JR
1003
1004# This must be last line !
cc10e704 1005# vi:syntax=sh
This page took 0.266874 seconds and 4 git commands to generate.