aboutsummaryrefslogtreecommitdiffstats
path: root/event.d/rcS-sulogin
diff options
context:
space:
mode:
Diffstat (limited to 'event.d/rcS-sulogin')
-rw-r--r--event.d/rcS-sulogin21
1 files changed, 21 insertions, 0 deletions
diff --git a/event.d/rcS-sulogin b/event.d/rcS-sulogin
new file mode 100644
index 00000000..59a0b4d3
--- /dev/null
+++ b/event.d/rcS-sulogin
@@ -0,0 +1,21 @@
+# rcS-sulogin - "single-user" runlevel compatibility
+#
+# This task runs /bin/bash during "single-user" mode,
+# then continues to the default runlevel.
+
+start on runlevel S
+
+stop on runlevel
+
+console owner
+script
+ runlevel --set S >/dev/null || true
+ exec /bin/bash
+end script
+post-stop script
+ if [ "$1" = "S" ]; then
+ runlevel=$(/bin/awk -F ':' '$3 == "initdefault" { print $2 }' /etc/inittab)
+ [ -z "$runlevel" ] && runlevel="3"
+ exec telinit $runlevel
+ fi
+end script