diff -Nur -x '*.orig' -x '*.rej' e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith mezzanine_patched_e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith --- e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith 2005-11-20 21:28:10.000000000 -0700 +++ mezzanine_patched_e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith 2007-03-22 15:42:41.000000000 -0600 @@ -3,6 +3,25 @@ # Customisation of the RedHat rc script, which allows services to return # a value of 99, indicating "disabled" +# Check whether file $1 is a backup or rpm-generated file and should be ignored +is_ignored_file() { + case "$1" in + *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave) + return 0 + ;; + esac + return 1 +} + +# check a file to be a correct runlevel script +check_runlevel () +{ + # Check if the file exists at all. + [ -x "$1" ] || return 1 + is_ignored_file "$1" && return 1 + return 0 +} + # Now find out what the current and what the previous runlevel are. argv1="$1" set `/sbin/runlevel` @@ -62,67 +81,38 @@ # Log that something succeeded success() { - if [ -z "${IN_INITLOG:-}" ]; then - initlog $INITLOG_ARGS -n $0 -s "$1" -e 1 - else - # silly hack to avoid EPIPE killing rc.sysinit - trap "" SIGPIPE - echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 - trap - SIGPIPE - fi [ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_success return 0 } # Log that something failed failure() { - rc=$? - if [ -z "${IN_INITLOG:-}" ]; then - initlog $INITLOG_ARGS -n $0 -s "$1" -e 2 - else - trap "" SIGPIPE - echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 2" >&21 - trap - SIGPIPE - fi + local rc=$? [ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_failure return $rc } # Log a warning warning() { - rc=$? - if [ -z "${IN_INITLOG:-}" ]; then - initlog $INITLOG_ARGS -n $0 -s "$1" -e 1 - else - trap "" SIGPIPE - echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 - trap - SIGPIPE - fi + local rc=$? [ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_warning return $rc } # Log that something passed, but is disabled in this configuration disabled() { - rc=$? - if [ -z "$IN_INITLOG" ]; then - initlog $INITLOG_ARGS -n $0 -s "$1" -e 1 - else - trap "" SIGPIPE - echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 - trap - SIGPIPE - fi + local rc=$? [ "$BOOTUP" != "verbose" ] && echo_disabled return $rc } # Run some action. Log its output. action() { - STRING=$1 + local STRING=$1 echo -n "$STRING " shift - initlog $INITLOG_ARGS -c "$*" - ret=$? + "$@" + local ret=$? case $ret in 0) success $"$STRING" ;; 99) disabled $"$STRING" @@ -133,105 +123,68 @@ return $ret } - # See if we want to be in user confirmation mode if [ "$previous" = "N" ]; then - if grep -i confirm /proc/cmdline >/dev/null || [ -f /var/run/confirm ] ; then - rm -f /var/run/confirm - CONFIRM=yes - echo $"Entering interactive startup" - else - CONFIRM= - echo $"Entering non-interactive startup" - fi + if [ -f /var/run/confirm ]; then + echo $"Entering interactive startup" + else + echo $"Entering non-interactive startup" + fi fi -export CONFIRM - # Get first argument. Set new runlevel to this argument. [ -n "$argv1" ] && runlevel="$argv1" # Is there an rc directory for this new runlevel? -if [ -d /etc/rc$runlevel.d ]; then - # First, run the KILL scripts. - for i in /etc/rc$runlevel.d/K*; do - # Check if the script is there. - [ ! -f $i ] && continue - - # Don't run [KS]??foo.{rpmsave,rpmorig} scripts - [ "${i%.rpmsave}" != "${i}" ] && continue - [ "${i%.rpmorig}" != "${i}" ] && continue - [ "${i%.rpmnew}" != "${i}" ] && continue - - # 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 - - # Bring the subsystem down. - if egrep -q "(killproc |action )" $i ; then - $i stop - else - action $"Stopping $subsys: " $i stop - fi - done - - # Now run the START scripts. - for i in /etc/rc$runlevel.d/S*; do - # Check if the script is there. - [ ! -f $i ] && continue - - # Don't run [KS]??foo.{rpmsave,rpmorig} scripts - [ "${i%.rpmsave}" != "${i}" ] && continue - [ "${i%.rpmorig}" != "${i}" ] && continue - [ "${i%.rpmnew}" != "${i}" ] && continue - - # Check if the subsystem is already up. - subsys=${i#/etc/rc$runlevel.d/S??} - [ -f /var/lock/subsys/$subsys ] || \ - [ -f /var/lock/subsys/${subsys}.init ] && continue +[ -d /etc/rc$runlevel.d ] || exit 0 + +# First, run the KILL scripts. +for i in /etc/rc$runlevel.d/K* ; do + check_runlevel "$i" || continue + + # Check if the subsystem is already up. + subsys=${i#/etc/rc$runlevel.d/K??} + [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \ + || continue + + # Bring the subsystem down. + if LC_ALL=C egrep -q "^..*init.d/functions" $i ; then + $i stop + else + action $"Stopping $subsys: " $i stop + fi +done + +# Now run the START scripts. +for i in /etc/rc$runlevel.d/S* ; do + check_runlevel "$i" || continue + + # Check if the subsystem is already up. + subsys=${i#/etc/rc$runlevel.d/S??} + [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \ + && continue - # If we're in confirmation mode, get user confirmation - [ -n "$CONFIRM" ] && - { - confirm $subsys - case $? in - 0) - : - ;; - 2) - CONFIRM= - ;; - *) - continue - ;; - esac - } - - # Bring the subsystem up. - if egrep -q "(daemon |action )" $i ; then - if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then - unset LANG - unset LC_ALL - unset TEXTDOMAIN - unset TEXTDOMAINDIR - exec $i start - else - $i start - fi - else - if [ "$subsys" = "halt" -o "$subsys" = "reboot" -o "$subsys" = "single" -o "$subsys" = "local" ]; then - if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then - unset LANG - unset LC_ALL - unset TEXTDOMAIN - unset TEXTDOMAINDIR - exec $i start - fi - $i start - else - action $"Starting $subsys: " $i start - fi - fi - done + # If we're in confirmation mode, get user confirmation + if [ -f /var/run/confirm ]; then + confirm $subsys + test $? = 1 && continue + fi + + update_boot_stage "$subsys" + # Bring the subsystem up. + if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then + export LC_ALL=C + exec $i start + fi + if LC_ALL=C egrep -q "^..*init.d/functions" $i \ + || [ "$subsys" = "single" -o "$subsys" = "local" ]; then + $i start + else + action $"Starting $subsys: " $i start + fi +done +rm -f /var/run/confirm +if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --quit fi +