summaryrefslogtreecommitdiff
path: root/skel
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-04-20 05:58:37 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-04-20 05:58:37 +0000
commit9e6d0f168bf59df9cd829d6ebe63fb08ea9ae01e (patch)
tree77f5afd89846e1dd1b7020498426905f6ef7b5cb /skel
parentcb5b1af6dee0ff41e73a3bc0661ba7aa7b1d1b94 (diff)
downloads6-linux-init-9e6d0f168bf59df9cd829d6ebe63fb08ea9ae01e.tar.xz
Add skel files; add initdefault; remove env-stage2
Diffstat (limited to 'skel')
-rwxr-xr-xskel/rc.init34
-rwxr-xr-xskel/rc.shutdown17
-rwxr-xr-xskel/runlevel15
3 files changed, 66 insertions, 0 deletions
diff --git a/skel/rc.init b/skel/rc.init
index e69de29..37c3ea9 100755
--- a/skel/rc.init
+++ b/skel/rc.init
@@ -0,0 +1,34 @@
+#!/bin/sh -e
+
+rl="$1"
+shift
+
+### argv now contains the arguments of the kernel command line that are
+### not of the form key=value. (The key=value arguments were stored by
+### s6-linux-init into an envdir, if instructed so via the -s option.)
+### Normally this argv remains unused because programs that need the
+### kernel command line usually read it later on from /proc/cmdline -
+### but just in case, it's available here.
+
+
+### 1. Early preparation
+### This is done only once at boot time.
+### Ideally, this phase should just initialize the service manager.
+
+### If your services are managed by sysv-rc:
+# /etc/init.d/rcS
+
+### If your services are managed by OpenRC:
+# /sbin/openrc sysinit
+# /sbin/openrc boot
+
+### If your services are managed by s6-rc:
+### (replace /run/service with your scandir)
+# s6-rc-init /run/service
+
+
+### 2. Starting the wanted set of services
+### This is also called every time you change runlevels with telinit.
+### (edit the location to suit your installation)
+
+# exec /etc/s6-linux-init/current/scripts/runlevel "$rl"
diff --git a/skel/rc.shutdown b/skel/rc.shutdown
index e69de29..6acd0f0 100755
--- a/skel/rc.shutdown
+++ b/skel/rc.shutdown
@@ -0,0 +1,17 @@
+#!/bin/sh -e
+
+### Things to do before hardware halt/reboot/poweroff.
+### Ideally, it should be a single call to the service manager,
+### telling it to bring all the services down.
+
+### If your services are managed by sysv-rc:
+### remove the K11reboot link from /etc/rc6.d to prevent
+### sysv-rc from rebooting prematurely - because sysvinit does
+### not properly separate state changes from system init/shutdown.
+# exec /etc/init.d/rc 6
+
+### If your services are managed by OpenRC:
+# exec /sbin/openrc shutdown
+
+### If your services are managed by s6-rc:
+# exec s6-rc -da change
diff --git a/skel/runlevel b/skel/runlevel
index e69de29..6368b4b 100755
--- a/skel/runlevel
+++ b/skel/runlevel
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+### This script is called once at boot time by rc.init, and is
+### also called by the runleveld service every time the user
+### requests a machine state change via telinit.
+### Ideally, it should just be a call to the service manager.
+
+### If your services are managed by sysv-rc:
+# exec /etc/init.d/rc "$1"
+
+### If your services are managed by OpenRC:
+# exec /sbin/openrc "$1"
+
+### If your services are managed by s6-rc:
+# exec s6-rc -v2 change "$1"