From 01fecfecdb440d81435690c63d28909c5edd34de Mon Sep 17 00:00:00 2001 From: Casey Dahlin Date: Wed, 23 Jul 2008 09:48:23 -0400 Subject: Update for Upstart 0.5.0 New job definitions, in a new location, in a new format --- Makefile | 7 ++++--- README-event.d | 26 -------------------------- README-jobs.d | 26 ++++++++++++++++++++++++++ event.d/control-alt-delete | 8 -------- event.d/prefdm | 12 ------------ event.d/rc0 | 25 ------------------------- event.d/rc1 | 29 ----------------------------- event.d/rc2 | 20 -------------------- event.d/rc3 | 20 -------------------- event.d/rc4 | 20 -------------------- event.d/rc5 | 20 -------------------- event.d/rc6 | 23 ----------------------- event.d/rcS | 31 ------------------------------- event.d/rcS-sulogin | 21 --------------------- event.d/serial | 29 ----------------------------- event.d/sulogin | 18 ------------------ event.d/tty1 | 16 ---------------- event.d/tty2 | 16 ---------------- event.d/tty3 | 16 ---------------- event.d/tty4 | 16 ---------------- event.d/tty5 | 16 ---------------- event.d/tty6 | 16 ---------------- jobs.d/control-alt-delete | 8 ++++++++ jobs.d/kickoff-ttys | 15 +++++++++++++++ jobs.d/prefdm | 12 ++++++++++++ jobs.d/rc-multiuser | 19 +++++++++++++++++++ jobs.d/rc0 | 25 +++++++++++++++++++++++++ jobs.d/rc1 | 23 +++++++++++++++++++++++ jobs.d/rc6 | 23 +++++++++++++++++++++++ jobs.d/rcS | 33 +++++++++++++++++++++++++++++++++ jobs.d/rcS-sulogin | 21 +++++++++++++++++++++ jobs.d/serial | 24 ++++++++++++++++++++++++ jobs.d/startfail | 4 ++++ jobs.d/tty | 14 ++++++++++++++ 34 files changed, 251 insertions(+), 401 deletions(-) delete mode 100644 README-event.d create mode 100644 README-jobs.d delete mode 100644 event.d/control-alt-delete delete mode 100644 event.d/prefdm delete mode 100644 event.d/rc0 delete mode 100644 event.d/rc1 delete mode 100644 event.d/rc2 delete mode 100644 event.d/rc3 delete mode 100644 event.d/rc4 delete mode 100644 event.d/rc5 delete mode 100644 event.d/rc6 delete mode 100644 event.d/rcS delete mode 100644 event.d/rcS-sulogin delete mode 100644 event.d/serial delete mode 100644 event.d/sulogin delete mode 100644 event.d/tty1 delete mode 100644 event.d/tty2 delete mode 100644 event.d/tty3 delete mode 100644 event.d/tty4 delete mode 100644 event.d/tty5 delete mode 100644 event.d/tty6 create mode 100644 jobs.d/control-alt-delete create mode 100644 jobs.d/kickoff-ttys create mode 100644 jobs.d/prefdm create mode 100644 jobs.d/rc-multiuser create mode 100644 jobs.d/rc0 create mode 100644 jobs.d/rc1 create mode 100644 jobs.d/rc6 create mode 100644 jobs.d/rcS create mode 100644 jobs.d/rcS-sulogin create mode 100644 jobs.d/serial create mode 100644 jobs.d/startfail create mode 100644 jobs.d/tty diff --git a/Makefile b/Makefile index 93e53c8b..4aab352c 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ all: install: mkdir -p $(ROOT)/etc/profile.d $(ROOT)/sbin $(ROOT)/usr/sbin - mkdir -p $(ROOT)$(mandir)/man{5,8} + mkdir -p $(ROOT)$(mandir)/man{5,8} $(ROOT)/etc/init mkdir -p $(ROOT)/etc/rwtab.d $(ROOT)/etc/statetab.d mkdir -p $(ROOT)/var/lib/stateless/writable mkdir -p $(ROOT)/var/lib/stateless/state @@ -46,7 +46,8 @@ install: cp -af rc.d/init.d $(ROOT)/etc/rc.d/ install -m755 sysconfig/mcheck sysconfig/init sysconfig/netconsole sysconfig/readonly-root $(ROOT)/etc/sysconfig/ cp -af sysconfig/network-scripts $(ROOT)/etc/sysconfig/ - cp -af ppp udev NetworkManager event.d $(ROOT)/etc + cp -af ppp udev NetworkManager $(ROOT)/etc + cp -af jobs.d $(ROOT)/etc/init mkdir -p $(ROOT)/etc/ppp/peers chmod 755 $(ROOT)/etc/rc.d/* $(ROOT)/etc/rc.d/init.d/* chmod 755 $(ROOT)/etc/ppp/peers @@ -56,7 +57,7 @@ install: chmod 755 $(ROOT)/etc/sysconfig/network-scripts/init* chmod 755 $(ROOT)/etc/sysconfig/network-scripts/net.hotplug chmod 755 $(ROOT)/etc/NetworkManager/dispatcher.d/00-netreport - chmod 644 $(ROOT)/etc/event.d/* + chmod 644 $(ROOT)/etc/init/jobs.d/* mkdir -p $(ROOT)/etc/sysconfig/modules mkdir -p $(ROOT)/etc/sysconfig/networking/devices mkdir -p $(ROOT)/etc/sysconfig/networking/profiles/default diff --git a/README-event.d b/README-event.d deleted file mode 100644 index ea60fbce..00000000 --- a/README-event.d +++ /dev/null @@ -1,26 +0,0 @@ -The upstart scripts in /etc/event.d originate from event-compat-sysv-0.3.9, -and have since been heavily modified. - -The original copyright is: - -Copyright © 2008 Canonical Ltd. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/README-jobs.d b/README-jobs.d new file mode 100644 index 00000000..82fb065f --- /dev/null +++ b/README-jobs.d @@ -0,0 +1,26 @@ +The upstart scripts in /etc/init/jobs.d originate from event-compat-sysv-0.3.9, +and have since been heavily modified. + +The original copyright is: + +Copyright © 2008 Canonical Ltd. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/event.d/control-alt-delete b/event.d/control-alt-delete deleted file mode 100644 index 35cb1305..00000000 --- a/event.d/control-alt-delete +++ /dev/null @@ -1,8 +0,0 @@ -# control-alt-delete - emergency keypress handling -# -# This task is run whenever the Control-Alt-Delete key combination is -# pressed. Usually used to shut down the machine. - -start on control-alt-delete - -exec /sbin/shutdown -r now "Control-Alt-Delete pressed" diff --git a/event.d/prefdm b/event.d/prefdm deleted file mode 100644 index 7098bd76..00000000 --- a/event.d/prefdm +++ /dev/null @@ -1,12 +0,0 @@ -# prefdm - preferred display manager -# -# Starts gdm/xdm/etc by preference - -start on stopped rc5 - -stop on runlevel [!5] - -console output -respawn -respawn limit 10 120 -exec /etc/X11/prefdm -nodaemon diff --git a/event.d/rc0 b/event.d/rc0 deleted file mode 100644 index 63de616b..00000000 --- a/event.d/rc0 +++ /dev/null @@ -1,25 +0,0 @@ -# rc0 - runlevel 0 compatibility -# -# This task runs the old sysv-rc runlevel 0 ("halt/poweroff") scripts with -# the decision as to whether to halt or power off the system left up to the -# script (and thus /etc/default/poweroff). - -start on runlevel 0 - -stop on runlevel - -console output -script - set $(runlevel || true) - if [ "$2" != "0" ] && [ "$2" != "6" ]; then - set $(runlevel --set 0 || true) - fi - - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/rc.d/rc 0 -end script diff --git a/event.d/rc1 b/event.d/rc1 deleted file mode 100644 index 5ad47bbe..00000000 --- a/event.d/rc1 +++ /dev/null @@ -1,29 +0,0 @@ -# rc1 - runlevel 1 compatibility -# -# This task runs the old sysv-rc runlevel 1 ("single-user") scripts. -# /etc/rc.d/rc 1 will run the /etc/rc.d/rc1.d scripts. -# telinit S will run whichever task has "start on runlevel S", -# normally /etc/event.d/rcS-sulogin - -start on runlevel 1 - -stop on runlevel - -console output -script - set $(runlevel --set 1 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/rc.d/rc 1 -end script -post-stop script - clear - TEXTDOMAIN=initscripts - . /etc/profile.d/lang.sh - echo $"Telling INIT to go to single user mode." - exec telinit S -end script diff --git a/event.d/rc2 b/event.d/rc2 deleted file mode 100644 index 1e0ab677..00000000 --- a/event.d/rc2 +++ /dev/null @@ -1,20 +0,0 @@ -# rc2 - runlevel 2 compatibility -# -# This task runs the old sysv-rc runlevel 2 ("multi-user") scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 2 - -stop on runlevel - -console output -script - set $(runlevel --set 2 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/rc.d/rc 2 -end script diff --git a/event.d/rc3 b/event.d/rc3 deleted file mode 100644 index 785c98aa..00000000 --- a/event.d/rc3 +++ /dev/null @@ -1,20 +0,0 @@ -# rc3 - runlevel 3 compatibility -# -# This task runs the old sysv-rc runlevel 3 (user defined) scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 3 - -stop on runlevel - -console output -script - set $(runlevel --set 3 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/rc.d/rc 3 -end script diff --git a/event.d/rc4 b/event.d/rc4 deleted file mode 100644 index 590eebbc..00000000 --- a/event.d/rc4 +++ /dev/null @@ -1,20 +0,0 @@ -# rc4 - runlevel 4 compatibility -# -# This task runs the old sysv-rc runlevel 4 (user defined) scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 4 - -stop on runlevel - -console output -script - set $(runlevel --set 4 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/rc.d/rc 4 -end script diff --git a/event.d/rc5 b/event.d/rc5 deleted file mode 100644 index 69ca88a7..00000000 --- a/event.d/rc5 +++ /dev/null @@ -1,20 +0,0 @@ -# rc5 - runlevel 5 compatibility -# -# This task runs the old sysv-rc runlevel 5 (user defined) scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 5 - -stop on runlevel - -console output -script - set $(runlevel --set 5 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/rc.d/rc 5 -end script diff --git a/event.d/rc6 b/event.d/rc6 deleted file mode 100644 index c40f708d..00000000 --- a/event.d/rc6 +++ /dev/null @@ -1,23 +0,0 @@ -# rc6 - runlevel 6 compatibility -# -# This task runs the old sysv-rc runlevel 6 ("reboot") scripts. - -start on runlevel 6 - -stop on runlevel - -console output -script - set $(runlevel || true) - if [ "$2" != "0" ] && [ "$2" != "6" ]; then - set $(runlevel --set 6 || true) - fi - - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/rc.d/rc 6 -end script diff --git a/event.d/rcS b/event.d/rcS deleted file mode 100644 index b01ddc57..00000000 --- a/event.d/rcS +++ /dev/null @@ -1,31 +0,0 @@ -# rcS - runlevel compatibility -# -# This task runs the old sysv-rc startup scripts. - -start on startup - -stop on runlevel - -# Note: there can be no previous runlevel here, if we have one it's bad -# information (we enter rc1 not rcS for maintenance). Run /etc/rc.d/rc -# without information so that it defaults to previous=N runlevel=S. -console output -script - runlevel --set S >/dev/null || true - - /etc/rc.d/rc.sysinit - runlevel --reboot || true -end script -post-stop script - 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 deleted file mode 100644 index 59a0b4d3..00000000 --- a/event.d/rcS-sulogin +++ /dev/null @@ -1,21 +0,0 @@ -# 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 diff --git a/event.d/serial b/event.d/serial deleted file mode 100644 index 6869090e..00000000 --- a/event.d/serial +++ /dev/null @@ -1,29 +0,0 @@ - -start on fedora.serial-console-available * -stop on runlevel [016] - -instance -pre-start script - while /bin/true ; do - LANG=C /sbin/initctl status rcS | grep -wq "rcS (stop) waiting" && break - sleep 1 - done - while /bin/true ; do - runlevel=$(/sbin/runlevel | /bin/awk '{ print $2 }') - case "$runlevel" in - 2|3|4|5) - LANG=C /sbin/initctl status rc$runlevel | grep -wq "rc$runlevel (stop) waiting" && break - ;; - *) - ;; - esac - sleep 1 - done - /sbin/securetty $1 -end script -exec /sbin/agetty /dev/$1 $2 vt100-nav -post-stop script - if [ "$UPSTART_EVENT" != "${UPSTART_EVENT##fedora.serial-console-available}" ]; then - initctl emit --no-wait fedora.serial-console-available $1 $2 - fi -end script diff --git a/event.d/sulogin b/event.d/sulogin deleted file mode 100644 index 931fb062..00000000 --- a/event.d/sulogin +++ /dev/null @@ -1,18 +0,0 @@ -# sulogin - rescue mode -# -# This task ensures that should the system fail to have any active jobs -# that the system administrator can rescue it; by giving them a shell. - -#start on stalled - -exec /sbin/sulogin -console owner - -pre-start script - echo - echo "The system has reached a state where there are no jobs running." - echo "A shell will be spawned so that you may start such jobs that are" - echo "necessary." - echo - echo "Type 'exit' when finished." -end script diff --git a/event.d/tty1 b/event.d/tty1 deleted file mode 100644 index f0002ae3..00000000 --- a/event.d/tty1 +++ /dev/null @@ -1,16 +0,0 @@ -# tty1 - getty -# -# This service maintains a getty on tty1 from the point the system is -# started until it is shut down again. - -start on stopped rc2 -start on stopped rc3 -start on stopped rc4 -start on started prefdm - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 6 - -respawn -exec /sbin/mingetty tty1 diff --git a/event.d/tty2 b/event.d/tty2 deleted file mode 100644 index ec5f94cd..00000000 --- a/event.d/tty2 +++ /dev/null @@ -1,16 +0,0 @@ -# tty2 - getty -# -# This service maintains a getty on tty2 from the point the system is -# started until it is shut down again. - -start on stopped rc2 -start on stopped rc3 -start on stopped rc4 -start on started prefdm - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 6 - -respawn -exec /sbin/mingetty tty2 diff --git a/event.d/tty3 b/event.d/tty3 deleted file mode 100644 index ed95fdcf..00000000 --- a/event.d/tty3 +++ /dev/null @@ -1,16 +0,0 @@ -# tty3 - getty -# -# This service maintains a getty on tty3 from the point the system is -# started until it is shut down again. - -start on stopped rc2 -start on stopped rc3 -start on stopped rc4 -start on started prefdm - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 6 - -respawn -exec /sbin/mingetty tty3 diff --git a/event.d/tty4 b/event.d/tty4 deleted file mode 100644 index 76b6d717..00000000 --- a/event.d/tty4 +++ /dev/null @@ -1,16 +0,0 @@ -# tty4 - getty -# -# This service maintains a getty on tty4 from the point the system is -# started until it is shut down again. - -start on stopped rc2 -start on stopped rc3 -start on stopped rc4 -start on started prefdm - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 6 - -respawn -exec /sbin/mingetty tty4 diff --git a/event.d/tty5 b/event.d/tty5 deleted file mode 100644 index 9e9d8137..00000000 --- a/event.d/tty5 +++ /dev/null @@ -1,16 +0,0 @@ -# tty5 - getty -# -# This service maintains a getty on tty5 from the point the system is -# started until it is shut down again. - -start on stopped rc2 -start on stopped rc3 -start on stopped rc4 -start on started prefdm - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 6 - -respawn -exec /sbin/mingetty tty5 diff --git a/event.d/tty6 b/event.d/tty6 deleted file mode 100644 index 7eb42c01..00000000 --- a/event.d/tty6 +++ /dev/null @@ -1,16 +0,0 @@ -# tty6 - getty -# -# This service maintains a getty on tty6 from the point the system is -# started until it is shut down again. - -start on stopped rc2 -start on stopped rc3 -start on stopped rc4 -start on started prefdm - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 6 - -respawn -exec /sbin/mingetty tty6 diff --git a/jobs.d/control-alt-delete b/jobs.d/control-alt-delete new file mode 100644 index 00000000..35cb1305 --- /dev/null +++ b/jobs.d/control-alt-delete @@ -0,0 +1,8 @@ +# control-alt-delete - emergency keypress handling +# +# This task is run whenever the Control-Alt-Delete key combination is +# pressed. Usually used to shut down the machine. + +start on control-alt-delete + +exec /sbin/shutdown -r now "Control-Alt-Delete pressed" diff --git a/jobs.d/kickoff-ttys b/jobs.d/kickoff-ttys new file mode 100644 index 00000000..59f88198 --- /dev/null +++ b/jobs.d/kickoff-ttys @@ -0,0 +1,15 @@ +# kickoff-ttys - standard array of gettys + +start on stopped rc-multiuser RUNLEVEL=[!5] or started prefdm +task + +emits tty-requested + +script + /sbin/initctl emit tty-requested TTY=tty1 + /sbin/initctl emit tty-requested TTY=tty2 + /sbin/initctl emit tty-requested TTY=tty3 + /sbin/initctl emit tty-requested TTY=tty4 + /sbin/initctl emit tty-requested TTY=tty5 + /sbin/initctl emit tty-requested TTY=tty6 +end script diff --git a/jobs.d/prefdm b/jobs.d/prefdm new file mode 100644 index 00000000..5dd2d3f8 --- /dev/null +++ b/jobs.d/prefdm @@ -0,0 +1,12 @@ +# prefdm - preferred display manager +# +# Starts gdm/xdm/etc by preference + +start on stopped rc-multiuser RUNLEVEL=5 + +stop on runlevel [!5] + +console output +respawn +respawn limit 10 120 +exec /etc/X11/prefdm -nodaemon diff --git a/jobs.d/rc-multiuser b/jobs.d/rc-multiuser new file mode 100644 index 00000000..a6d13e56 --- /dev/null +++ b/jobs.d/rc-multiuser @@ -0,0 +1,19 @@ +# rc-multiuser - multiuser runlevel compatibility +# +# This task runs the old sysv-rc runlevel 2+ ("multi-user") scripts. It +# is usually started by the telinit compatibility wrapper. + +start on runlevel [2345] +stop on runlevel +task + +export PREVLEVEL +export RUNLEVEL + +console output +script + runlevel --set $RUNLEVEL || true + export PREVLEVEL RUNLEVEL + + exec /etc/rc.d/rc $RUNLELVEL +end script diff --git a/jobs.d/rc0 b/jobs.d/rc0 new file mode 100644 index 00000000..8dfd8218 --- /dev/null +++ b/jobs.d/rc0 @@ -0,0 +1,25 @@ +# rc0 - runlevel 0 compatibility +# +# This task runs the old sysv-rc runlevel 0 ("halt/poweroff") scripts with +# the decision as to whether to halt or power off the system left up to the +# script (and thus /etc/default/poweroff). + +start on runlevel 0 +stop on runlevel +task + +console output +script + set $(runlevel || true) + if [ "$2" != "0" ] && [ "$2" != "6" ]; then + set $(runlevel --set 0 || true) + fi + + if [ "$1" != "unknown" ]; then + PREVLEVEL=$1 + RUNLEVEL=$2 + export PREVLEVEL RUNLEVEL + fi + + exec /etc/rc.d/rc 0 +end script diff --git a/jobs.d/rc1 b/jobs.d/rc1 new file mode 100644 index 00000000..021791b1 --- /dev/null +++ b/jobs.d/rc1 @@ -0,0 +1,23 @@ +# rc1 - runlevel 1 compatibility +# +# This task runs the old sysv-rc runlevel 1 ("single-user") scripts. +# /etc/rc.d/rc 1 will run the /etc/rc.d/rc1.d scripts. +# telinit S will run whichever task has "start on runlevel S", +# normally /etc/event.d/rcS-sulogin + +start on runlevel 1 +stop on runlevel +task + +console output +script + export PREVLEVEL RUNLEVEL + exec /etc/rc.d/rc 1 +end script +post-stop script + clear + TEXTDOMAIN=initscripts + . /etc/profile.d/lang.sh + echo $"Telling INIT to go to single user mode." + exec telinit S +end script diff --git a/jobs.d/rc6 b/jobs.d/rc6 new file mode 100644 index 00000000..c40f708d --- /dev/null +++ b/jobs.d/rc6 @@ -0,0 +1,23 @@ +# rc6 - runlevel 6 compatibility +# +# This task runs the old sysv-rc runlevel 6 ("reboot") scripts. + +start on runlevel 6 + +stop on runlevel + +console output +script + set $(runlevel || true) + if [ "$2" != "0" ] && [ "$2" != "6" ]; then + set $(runlevel --set 6 || true) + fi + + if [ "$1" != "unknown" ]; then + PREVLEVEL=$1 + RUNLEVEL=$2 + export PREVLEVEL RUNLEVEL + fi + + exec /etc/rc.d/rc 6 +end script diff --git a/jobs.d/rcS b/jobs.d/rcS new file mode 100644 index 00000000..5faef6e8 --- /dev/null +++ b/jobs.d/rcS @@ -0,0 +1,33 @@ +# rcS - runlevel compatibility +# +# This task runs the old sysv-rc startup scripts. + +start on startup +stop on runlevel +task + +# Note: there can be no previous runlevel here, if we have one it's bad +# information (we enter rc1 not rcS for maintenance). Run /etc/rc.d/rc +# without information so that it defaults to previous=N runlevel=S. +console output +script + runlevel --set S >/dev/null || true + + /etc/rc.d/rc.sysinit + runlevel --reboot || true +end script +post-stop script + for UPSTART_EVENT in $UPSTART_EVENTS; do + 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 + done +end script diff --git a/jobs.d/rcS-sulogin b/jobs.d/rcS-sulogin new file mode 100644 index 00000000..d4774e92 --- /dev/null +++ b/jobs.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 +task + +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 diff --git a/jobs.d/serial b/jobs.d/serial new file mode 100644 index 00000000..be1bfd66 --- /dev/null +++ b/jobs.d/serial @@ -0,0 +1,24 @@ +start on fedora.serial-console-available * +stop on runlevel [016] +respawn + +instance $DEVNAME +pre-start script + while /bin/true ; do + LANG=C /sbin/initctl status rcS | grep -wq "rcS (stop) waiting" && break + sleep 1 + done + while /bin/true ; do + runlevel=$(/sbin/runlevel | /bin/awk '{ print $2 }') + case "$runlevel" in + 2|3|4|5) + LANG=C /sbin/initctl status rc$runlevel | grep -wq "rc$runlevel (stop) waiting" && break + ;; + *) + ;; + esac + sleep 1 + done + /sbin/securetty $1 +end script +exec /sbin/agetty /dev/$DEVNAME $BAUD vt100-nav diff --git a/jobs.d/startfail b/jobs.d/startfail new file mode 100644 index 00000000..0ef5a1d2 --- /dev/null +++ b/jobs.d/startfail @@ -0,0 +1,4 @@ +start on startup/failed +session leader +console output +exec /bin/bash diff --git a/jobs.d/tty b/jobs.d/tty new file mode 100644 index 00000000..a264c0c5 --- /dev/null +++ b/jobs.d/tty @@ -0,0 +1,14 @@ +# tty - getty +# +# This service maintains a getty from the point the system is started until it +# is shut down again. + +start on tty-requested +stop on runlevel [016] + +instance $TTY + +session leader + +respawn +exec /sbin/mingetty $TTY -- cgit