/[vps]/baselayout-vserver/branches/baselayout-1_12/sbin/rc
Gentoo

Diff of /baselayout-vserver/branches/baselayout-1_12/sbin/rc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 435 Revision 436
4 4
5trap ":" INT QUIT TSTP 5trap ":" INT QUIT TSTP
6source /sbin/functions.sh 6source /sbin/functions.sh
7# Only source this when this is a livecd booting ... 7# Only source this when this is a livecd booting ...
8[ -f /sbin/livecd-functions.sh ] && source /sbin/livecd-functions.sh 8[ -f /sbin/livecd-functions.sh ] && source /sbin/livecd-functions.sh
9# Silly users
10[[ -f /etc/conf.d/rc-extra ]] && source /etc/conf.d/rc-extra
9umask 022 11umask 022
10 12
11# Quick test to see if we can be interactive or not 13# Quick test to see if we can be interactive or not
12if [[ ${RC_INTERACTIVE:-yes} == "yes" ]] ; then 14if [[ ${RC_INTERACTIVE:-yes} == "yes" ]] ; then
13 if tty -s && stty -a | grep -q " icanon" ; then 15 if tty -s && stty -a | grep -q " icanon" ; then
184 [ -c /dev/console ] && dev_console=1 || dev_console=0 186 [ -c /dev/console ] && dev_console=1 || dev_console=0
185 187
186 # Set the console loglevel to 1 for a cleaner boot 188 # Set the console loglevel to 1 for a cleaner boot
187 # the logger should anyhow dump the ring-0 buffer at start to the 189 # the logger should anyhow dump the ring-0 buffer at start to the
188 # logs, and that with dmesg can be used to check for problems 190 # logs, and that with dmesg can be used to check for problems
189 /bin/dmesg -n 1 191 ${RC_DMESG_LEVEL+/bin/dmesg -n ${RC_DMESG_LEVEL}}
190 192
191 echo 193 echo
192 echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}" 194 echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}"
193 echo -e " Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2" 195 echo -e " Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2"
194 echo 196 echo
354 fi 356 fi
355 357
356 # Start logging console output since we have all /dev stuff setup 358 # Start logging console output since we have all /dev stuff setup
357 bootlog start 359 bootlog start
358 360
359 # Start RAID/LVM/EVMS/DM volumes for /usr, /var, etc.
360 for x in ${RC_VOLUME_ORDER} ; do
361 start_addon "${x}"
362 done
363
364 # We set the forced softlevel from the kernel command line
365 # It needs to be run right after proc is mounted for the
366 # boot runlevel
367 setup_defaultlevels
368
369 # $BOOT can be used by rc-scripts to test if it is the first time
370 # the 'boot' runlevel is executed. Now also needed by some stuff in
371 # the 'sysinit' runlevel ...
372 export BOOT="yes"
373
374 start_critical_service() { 361 start_critical_service() {
362 local service="$1"
375 ( 363 (
376 local retval= 364 local retval=
377 local service="$1"
378 # Needed for some addons like dm-crypt that starts in critical services 365 # Needed for some addons like dm-crypt that starts in critical services
379 local myservice="$1" 366 local myservice="${service}"
380 367
381 profiling name "/etc/init.d/${service} start" 368 profiling name "/etc/init.d/${service} start"
382 369 splash "svc_start" "${service}"
370
383 source "/etc/init.d/${service}" 371 source "/etc/init.d/${service}"
384 retval=$? 372 retval=$?
385 if [[ ${retval} -ne 0 ]] ; then 373 if [[ ${retval} -ne 0 ]] ; then
386 eerror "Failed to source /etc/init.d/${service}" 374 eerror "Failed to source /etc/init.d/${service}"
387 return "${retval}" 375 return "${retval}"
391 [[ -e ${conf} ]] && source "${conf}" 379 [[ -e ${conf} ]] && source "${conf}"
392 conf="$(add_suffix /etc/rc.conf)" 380 conf="$(add_suffix /etc/rc.conf)"
393 [[ -e ${conf} ]] && source "${conf}" 381 [[ -e ${conf} ]] && source "${conf}"
394 382
395 start 383 start
396 retval=$?
397 [[ ${retval} -ne 0 ]] && eerror "Failed to start /etc/init.d/${service}"
398
399 return "${retval}"
400 ) 384 )
385
386 if [[ $? == "0" ]] ; then
387 splash "svc_started" "${service}" "0"
388 return 0
389 fi
390
391 eerror "Failed to start /etc/init.d/${service}"
392 splash "critical" &>/dev/null &
393 echo
394 eerror "One or more critical startup scripts failed to start!"
395 eerror "Please correct this, and reboot ..."
396 echo; echo
397 /sbin/sulogin ${CONSOLE}
398 einfo "Unmounting filesystems"
399 /bin/mount -a -o remount,ro &>/dev/null
400 einfo "Rebooting"
401 /sbin/reboot -f
401 } 402 }
403
404 # $BOOT can be used by rc-scripts to test if it is the first time
405 # the 'boot' runlevel is executed. Now also needed by some stuff in
406 # the 'sysinit' runlevel ...
407 export BOOT="yes"
408
409 # We set the forced softlevel from the kernel command line
410 # It needs to be run right after proc is mounted for the
411 # boot runlevel
412 setup_defaultlevels
402 413
403 # We first try to find a locally defined list of critical services 414 # We first try to find a locally defined list of critical services
404 # for a particular runlevel. If we cannot find it, we use the 415 # for a particular runlevel. If we cannot find it, we use the
405 # defaults. 416 # defaults.
406 get_critical_services 417 get_critical_services
407 418
408 splash "rc_init" "${argv1}" 419 splash "rc_init" "${argv1}"
409 420
421 # Start checkroot and modules before we load volumes
410 export START_CRITICAL="yes" 422 export START_CRITICAL="yes"
411 423 for x in checkroot modules ; do
424 [[ " ${CRITICAL_SERVICES} " != *" ${x} "* ]] && continue
425 start_critical_service "${x}"
426 done
427
412 # We do not want to break compatibility, so we do not fully integrate 428 # We do not want to break compatibility, so we do not fully integrate
413 # these into /sbin/rc, but rather start them by hand ... 429 # these into /sbin/rc, but rather start them by hand ...
414 for x in ${CRITICAL_SERVICES} 430 for x in ${CRITICAL_SERVICES} ; do
415 do 431 [[ ${x} == "checkroot" || ${x} == "modules" ]] && continue
416 splash "svc_start" "${x}"
417 if ! start_critical_service "${x}" ; then 432 start_critical_service "${x}"
418 splash "critical" &>/dev/null &
419
420 echo
421 eerror "One or more critical startup scripts failed to start!"
422 eerror "Please correct this, and reboot ..."
423 echo; echo
424 einfo "Halting"
425 /sbin/halt -f
426 fi
427
428 splash "svc_started" "${x}" "0"
429 done 433 done
430 434
431 unset START_CRITICAL 435 unset START_CRITICAL
432 436
433 # /var/log should be writable now, so starting saving the boot output 437 # /var/log should be writable now, so starting saving the boot output
434 bootlog sync 438 bootlog sync
435
436 # have to run this after /var/run is mounted rw #85304
437 if [ -x /sbin/irqbalance -a "$(get_KV)" -ge "$(KV_to_int '2.5.0')" ]
438 then
439 ebegin "Starting irqbalance"
440 /sbin/irqbalance
441 eend $?
442 fi
443 439
444 # Check that $svcdir exists ... 440 # Check that $svcdir exists ...
445 check_statedir "${svcdir}" 441 check_statedir "${svcdir}"
446 442
447 # Should we use tmpfs/ramfs/ramdisk for caching dependency and 443 # Should we use tmpfs/ramfs/ramdisk for caching dependency and
675 && ! -e /etc/runlevels/"${DEFAULTLEVEL}"/"${x}" ]] ; then 671 && ! -e /etc/runlevels/"${DEFAULTLEVEL}"/"${x}" ]] ; then
676 myscripts="${myscripts} ${x}" 672 myscripts="${myscripts} ${x}"
677 mark_service_coldplugged "${x}" 673 mark_service_coldplugged "${x}"
678 fi 674 fi
679 done 675 done
676 if [[ -n ${myscripts} ]] ; then
680 einfo "Device initiated services:${HILITE}${myscripts}${NORMAL}" 677 einfo "Device initiated services:${HILITE}${myscripts}${NORMAL}"
678 fi
681 rm -rf /dev/.rcboot 679 rm -rf /dev/.rcboot
682 fi 680 fi
683 fi 681 fi
684 682
685 for x in ${mylevels} 683 for x in ${mylevels}

Legend:
Removed from v.435  
changed lines
  Added in v.436

  ViewVC Help
Powered by ViewVC 1.1.20