diff options
Diffstat (limited to 'rc.d/rc')
-rwxr-xr-x | rc.d/rc | 66 |
1 files changed, 56 insertions, 10 deletions
@@ -25,6 +25,24 @@ runlevel=$2 previous=$1 export runlevel previous +# Get first argument. Set new runlevel to this argument. +if [ "$argv1" != "" ] ; then + newrunlevel="$argv1" +else + newrunlevel="$runlevel" +fi + +if [ "$previous" = "N" ];then + if [ -e /var/run/failsafe ];then + rm -f /var/run/failsafe + if [ -x /sbin/askrunlevel ];then + /sbin/askrunlevel --interactive && ASKRUNLEVEL=no + else + init 1 #jump to init 1 if not aksrunlevel. + fi + fi +fi + . /etc/init.d/functions export CONSOLETYPE @@ -37,10 +55,14 @@ UPSTART= # See if we want to be in user confirmation mode if [ "$previous" = "N" ]; then if [ "$do_confirm" = "yes" ]; then - echo $"Entering interactive startup" + gprintf "Entering interactive startup\n" else - echo $"Entering non-interactive startup" + gprintf "Entering non-interactive startup\n" fi +elif [[ "$newrunlevel" = "0" || "$newrunlevel" = "6" ]]; then + [ -x /etc/rc.d/init.d/dm -a -f /var/lock/subsys/dm ] && /etc/init.d/dm stop 2> /dev/null + chvt 1 + exec &> /dev/console fi # Get first argument. Set new runlevel to this argument. @@ -52,26 +74,44 @@ fi # Set language, vc settings once to avoid doing it for every init script # through functions if [ -z "${NOLOCALE:-}" ] && [ -f /etc/sysconfig/i18n ] ; then - . /etc/profile.d/lang.sh 2>/dev/null + . /etc/profile.d/10lang.sh 2>/dev/null export LANGSH_SOURCED=1 fi +initsplash +[[ "$newrunlevel" = "0" || "$newrunlevel" = "6" ]] && [ "$splash_mode" = "plymouth" ] && rc_splash start $newrunlevel + +nopinit=`grep nopinit /proc/cmdline` + +rc_mode=K +export rc_mode + # First, run the KILL scripts. -for i in /etc/rc$runlevel.d/K* ; do +if [ -z "$nopinit" ]; then + /sbin/prcsys K /etc/rc$runlevel.d/ +else + for i in /etc/rc$runlevel.d/K* ; do # Check if the subsystem is already up. subsys=${i#/etc/rc$runlevel.d/K??} [ -f /var/lock/subsys/$subsys ] || [ -f /var/lock/subsys/$subsys.init ] || continue check_runlevel "$i" || continue + update_boot_stage "$subsys" # Bring the subsystem down. [ -n "$UPSTART" ] && initctl emit --quiet stopping JOB=$subsys - $i stop + action "Stopping %s: " $subsys $i stop [ -n "$UPSTART" ] && initctl emit --quiet stopped JOB=$subsys -done + done +fi + +rc_mode=S -# Now run the START scripts. -for i in /etc/rc$runlevel.d/S* ; do +if [ -z "$nopinit" ] && [ "$do_confirm" != "yes" -a "$runlevel" != "0" -a "$runlevel" != "1" -a "$runlevel" != "6" ]; then + /sbin/prcsys S /etc/rc$runlevel.d/ +else + # Now run the START scripts. + for i in /etc/rc$runlevel.d/S* ; do # Check if the subsystem is already up. subsys=${i#/etc/rc$runlevel.d/S??} @@ -97,8 +137,14 @@ for i in /etc/rc$runlevel.d/S* ; do export LC_ALL=C exec $i start fi - $i start + action "Starting %s: " $subsys $i start [ -n "$UPSTART" ] && initctl emit --quiet started JOB=$subsys -done + + done +fi + +if [[ "$newrunlevel" != "0" && "$newrunlevel" != "6" && "$newrunlevel" != "S" && "$newrunlevel" != "5" ]]; then + rc_splash stop +fi [ "$do_confirm" = "yes" ] && rm -f /var/run/confirm exit 0 |