aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2008-04-25 16:55:17 -0400
committerBill Nottingham <notting@redhat.com>2008-04-25 16:55:17 -0400
commitd78b58c6fb9110d78f8750b4d3779a401d2ebf92 (patch)
tree96d50eab0a42fb770d24cf6ca1883a13eca62ce7
parent89388cd39edcc42ae355ff854f14649822591263 (diff)
downloadinitscripts-d78b58c6fb9110d78f8750b4d3779a401d2ebf92.tar
initscripts-d78b58c6fb9110d78f8750b4d3779a401d2ebf92.tar.gz
initscripts-d78b58c6fb9110d78f8750b4d3779a401d2ebf92.tar.bz2
initscripts-d78b58c6fb9110d78f8750b4d3779a401d2ebf92.tar.xz
initscripts-d78b58c6fb9110d78f8750b4d3779a401d2ebf92.zip
Only run telinit for the default runlevel if we exit sanely (#444001, #444050)
-rw-r--r--event.d/rcS20
-rw-r--r--event.d/rcS-sulogin13
2 files changed, 20 insertions, 13 deletions
diff --git a/event.d/rcS b/event.d/rcS
index 619e1e6d..b01ddc57 100644
--- a/event.d/rcS
+++ b/event.d/rcS
@@ -17,13 +17,15 @@ script
runlevel --reboot || true
end script
post-stop script
- runlevel=$(/bin/awk -F ':' '$3 == "initdefault" { print $2 }' /etc/inittab)
- [ -z "$runlevel" ] && runlevel="3"
- for t in $(cat /proc/cmdline); do
- case $t in
- -s|single|S|s) runlevel="S" ;;
- [1-9]) runlevel="$t" ;;
- esac
- done
- exec telinit $runlevel
+ if [ "$UPSTART_EVENT" == "startup" ]; then
+ runlevel=$(/bin/awk -F ':' '$3 == "initdefault" { print $2 }' /etc/inittab)
+ [ -z "$runlevel" ] && runlevel="3"
+ for t in $(cat /proc/cmdline); do
+ case $t in
+ -s|single|S|s) runlevel="S" ;;
+ [1-9]) runlevel="$t" ;;
+ esac
+ done
+ exec telinit $runlevel
+ fi
end script
diff --git a/event.d/rcS-sulogin b/event.d/rcS-sulogin
index d74620db..c7866b93 100644
--- a/event.d/rcS-sulogin
+++ b/event.d/rcS-sulogin
@@ -10,10 +10,15 @@ stop on runlevel
console owner
script
runlevel --set S >/dev/null || true
- /bin/bash || true
+ exec /bin/bash
end script
post-stop script
- runlevel=$(/bin/awk -F ':' '$3 == "initdefault" { print $2 }' /etc/inittab)
- [ -z "$runlevel" ] && runlevel="3"
- exec telinit $runlevel
+ echo $* > /tmp/sulogin.$$
+ set >> /tmp/sulogin.$$
+ if [ "$1" = "S" ]; then
+ runlevel=$(/bin/awk -F ':' '$3 == "initdefault" { print $2 }' /etc/inittab)
+ [ -z "$runlevel" ] && runlevel="3"
+ exec telinit $runlevel
+ fi
end script
+