summaryrefslogtreecommitdiff
path: root/xi/s6/base
diff options
context:
space:
mode:
Diffstat (limited to 'xi/s6/base')
-rwxr-xr-xxi/s6/base/bin/halt3
-rwxr-xr-xxi/s6/base/bin/init3
-rwxr-xr-xxi/s6/base/bin/poweroff3
-rwxr-xr-xxi/s6/base/bin/reboot3
-rwxr-xr-xxi/s6/base/bin/shutdown3
-rwxr-xr-xxi/s6/base/bin/telinit3
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGHUP2
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGINT3
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGPWR3
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGQUIT2
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGTERM2
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGUSR13
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGUSR23
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/SIGWINCH2
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/crash6
-rwxr-xr-xxi/s6/base/run-image/service/.s6-svscan/finish6
-rwxr-xr-xxi/s6/base/run-image/service/s6-linux-init-early-getty/run3
-rw-r--r--xi/s6/base/run-image/service/s6-linux-init-logouthookd/notification-fd1
-rwxr-xr-xxi/s6/base/run-image/service/s6-linux-init-logouthookd/run4
-rw-r--r--xi/s6/base/run-image/service/s6-linux-init-runleveld/notification-fd1
-rwxr-xr-xxi/s6/base/run-image/service/s6-linux-init-runleveld/run7
-rwxr-xr-xxi/s6/base/run-image/service/s6-linux-init-shutdownd/run3
-rw-r--r--xi/s6/base/run-image/service/s6-svscan-log/notification-fd1
-rwxr-xr-xxi/s6/base/run-image/service/s6-svscan-log/run5
-rw-r--r--xi/s6/base/run-image/service/utmpd/notification-fd1
-rwxr-xr-xxi/s6/base/run-image/service/utmpd/run8
-rw-r--r--xi/s6/base/run-image/service/wtmpd/notification-fd1
-rwxr-xr-xxi/s6/base/run-image/service/wtmpd/run8
-rwxr-xr-xxi/s6/base/scripts/rc.init49
-rwxr-xr-xxi/s6/base/scripts/rc.shutdown30
-rwxr-xr-xxi/s6/base/scripts/rc.shutdown.final18
-rwxr-xr-xxi/s6/base/scripts/runlevel18
32 files changed, 208 insertions, 0 deletions
diff --git a/xi/s6/base/bin/halt b/xi/s6/base/bin/halt
new file mode 100755
index 0000000..a2c7938
--- /dev/null
+++ b/xi/s6/base/bin/halt
@@ -0,0 +1,3 @@
+#!/bin/execlineb -S0
+
+s6-linux-init-hpr -h $@
diff --git a/xi/s6/base/bin/init b/xi/s6/base/bin/init
new file mode 100755
index 0000000..278e493
--- /dev/null
+++ b/xi/s6/base/bin/init
@@ -0,0 +1,3 @@
+#!/bin/execlineb -S0
+
+s6-linux-init -c "/etc/s6/base" -m 0022 -p "/bin:/sbin:/usr/bin" -D "default" -- "$@"
diff --git a/xi/s6/base/bin/poweroff b/xi/s6/base/bin/poweroff
new file mode 100755
index 0000000..8177a96
--- /dev/null
+++ b/xi/s6/base/bin/poweroff
@@ -0,0 +1,3 @@
+#!/bin/execlineb -S0
+
+s6-linux-init-hpr -p $@
diff --git a/xi/s6/base/bin/reboot b/xi/s6/base/bin/reboot
new file mode 100755
index 0000000..8e82d11
--- /dev/null
+++ b/xi/s6/base/bin/reboot
@@ -0,0 +1,3 @@
+#!/bin/execlineb -S0
+
+s6-linux-init-hpr -r $@
diff --git a/xi/s6/base/bin/shutdown b/xi/s6/base/bin/shutdown
new file mode 100755
index 0000000..6c1b0c3
--- /dev/null
+++ b/xi/s6/base/bin/shutdown
@@ -0,0 +1,3 @@
+#!/bin/execlineb -S0
+
+s6-linux-init-shutdown $@
diff --git a/xi/s6/base/bin/telinit b/xi/s6/base/bin/telinit
new file mode 100755
index 0000000..823def0
--- /dev/null
+++ b/xi/s6/base/bin/telinit
@@ -0,0 +1,3 @@
+#!/bin/execlineb -S0
+
+s6-linux-init-telinit $@
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGHUP b/xi/s6/base/run-image/service/.s6-svscan/SIGHUP
new file mode 100755
index 0000000..130ab12
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGHUP
@@ -0,0 +1,2 @@
+#!/bin/execlineb -P
+
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGINT b/xi/s6/base/run-image/service/.s6-svscan/SIGINT
new file mode 100755
index 0000000..9a7eeaf
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGINT
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+s6-linux-init-shutdown -a -r -- now
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGPWR b/xi/s6/base/run-image/service/.s6-svscan/SIGPWR
new file mode 100755
index 0000000..bc55899
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGPWR
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+s6-linux-init-shutdown -a -p -- now
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGQUIT b/xi/s6/base/run-image/service/.s6-svscan/SIGQUIT
new file mode 100755
index 0000000..130ab12
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGQUIT
@@ -0,0 +1,2 @@
+#!/bin/execlineb -P
+
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGTERM b/xi/s6/base/run-image/service/.s6-svscan/SIGTERM
new file mode 100755
index 0000000..130ab12
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGTERM
@@ -0,0 +1,2 @@
+#!/bin/execlineb -P
+
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGUSR1 b/xi/s6/base/run-image/service/.s6-svscan/SIGUSR1
new file mode 100755
index 0000000..bc55899
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGUSR1
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+s6-linux-init-shutdown -a -p -- now
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGUSR2 b/xi/s6/base/run-image/service/.s6-svscan/SIGUSR2
new file mode 100755
index 0000000..5bbca00
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGUSR2
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+s6-linux-init-shutdown -a -h -- now
diff --git a/xi/s6/base/run-image/service/.s6-svscan/SIGWINCH b/xi/s6/base/run-image/service/.s6-svscan/SIGWINCH
new file mode 100755
index 0000000..130ab12
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/SIGWINCH
@@ -0,0 +1,2 @@
+#!/bin/execlineb -P
+
diff --git a/xi/s6/base/run-image/service/.s6-svscan/crash b/xi/s6/base/run-image/service/.s6-svscan/crash
new file mode 100755
index 0000000..e5a9440
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/crash
@@ -0,0 +1,6 @@
+#!/bin/execlineb -P
+
+redirfd -w 2 /dev/console
+fdmove -c 1 2
+foreground { s6-linux-init-echo -- "s6-svscan crashed. Rebooting." }
+s6-linux-init-hpr -fr
diff --git a/xi/s6/base/run-image/service/.s6-svscan/finish b/xi/s6/base/run-image/service/.s6-svscan/finish
new file mode 100755
index 0000000..ad17596
--- /dev/null
+++ b/xi/s6/base/run-image/service/.s6-svscan/finish
@@ -0,0 +1,6 @@
+#!/bin/execlineb -P
+
+redirfd -w 2 /dev/console
+fdmove -c 1 2
+foreground { s6-linux-init-echo -- "s6-svscan exited. Rebooting." }
+s6-linux-init-hpr -fr
diff --git a/xi/s6/base/run-image/service/s6-linux-init-early-getty/run b/xi/s6/base/run-image/service/s6-linux-init-early-getty/run
new file mode 100755
index 0000000..646423b
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-linux-init-early-getty/run
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+/sbin/agetty -L -8 tty1 115200
diff --git a/xi/s6/base/run-image/service/s6-linux-init-logouthookd/notification-fd b/xi/s6/base/run-image/service/s6-linux-init-logouthookd/notification-fd
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-linux-init-logouthookd/notification-fd
@@ -0,0 +1 @@
+1
diff --git a/xi/s6/base/run-image/service/s6-linux-init-logouthookd/run b/xi/s6/base/run-image/service/s6-linux-init-logouthookd/run
new file mode 100755
index 0000000..9698c56
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-linux-init-logouthookd/run
@@ -0,0 +1,4 @@
+#!/bin/execlineb -P
+
+s6-ipcserver -1 -a 0700 -c 1000 -C 1000 -- s
+s6-linux-init-logouthookd
diff --git a/xi/s6/base/run-image/service/s6-linux-init-runleveld/notification-fd b/xi/s6/base/run-image/service/s6-linux-init-runleveld/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-linux-init-runleveld/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/xi/s6/base/run-image/service/s6-linux-init-runleveld/run b/xi/s6/base/run-image/service/s6-linux-init-runleveld/run
new file mode 100755
index 0000000..1196d8d
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-linux-init-runleveld/run
@@ -0,0 +1,7 @@
+#!/bin/execlineb -P
+
+fdmove -c 2 1
+fdmove 1 3
+s6-ipcserver -1 -a 0700 -c 1 -- s
+s6-sudod -dt30000 --
+"/etc/s6/base"/scripts/runlevel
diff --git a/xi/s6/base/run-image/service/s6-linux-init-shutdownd/run b/xi/s6/base/run-image/service/s6-linux-init-shutdownd/run
new file mode 100755
index 0000000..8258d75
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-linux-init-shutdownd/run
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+s6-linux-init-shutdownd -c "/etc/s6/base" -g 3000
diff --git a/xi/s6/base/run-image/service/s6-svscan-log/notification-fd b/xi/s6/base/run-image/service/s6-svscan-log/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-svscan-log/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/xi/s6/base/run-image/service/s6-svscan-log/run b/xi/s6/base/run-image/service/s6-svscan-log/run
new file mode 100755
index 0000000..7028d1b
--- /dev/null
+++ b/xi/s6/base/run-image/service/s6-svscan-log/run
@@ -0,0 +1,5 @@
+#!/bin/execlineb -P
+
+redirfd -w 1 /dev/null
+redirfd -rnb 0 fifo
+s6-log -bpd3 -- T /run/uncaught-logs
diff --git a/xi/s6/base/run-image/service/utmpd/notification-fd b/xi/s6/base/run-image/service/utmpd/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/xi/s6/base/run-image/service/utmpd/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/xi/s6/base/run-image/service/utmpd/run b/xi/s6/base/run-image/service/utmpd/run
new file mode 100755
index 0000000..35c60c5
--- /dev/null
+++ b/xi/s6/base/run-image/service/utmpd/run
@@ -0,0 +1,8 @@
+#!/bin/execlineb -P
+
+fdmove -c 2 1
+s6-setuidgid "utmp"
+cd /run/utmps
+fdmove 1 3
+s6-ipcserver -1 -c 1000 -- /run/utmps/.utmpd-socket
+utmps-utmpd
diff --git a/xi/s6/base/run-image/service/wtmpd/notification-fd b/xi/s6/base/run-image/service/wtmpd/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/xi/s6/base/run-image/service/wtmpd/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/xi/s6/base/run-image/service/wtmpd/run b/xi/s6/base/run-image/service/wtmpd/run
new file mode 100755
index 0000000..79815bb
--- /dev/null
+++ b/xi/s6/base/run-image/service/wtmpd/run
@@ -0,0 +1,8 @@
+#!/bin/execlineb -P
+
+fdmove -c 2 1
+s6-setuidgid "utmp"
+cd /run/utmps
+fdmove 1 3
+s6-ipcserver -1 -c 1000 -- /run/utmps/.wtmpd-socket
+utmps-wtmpd
diff --git a/xi/s6/base/scripts/rc.init b/xi/s6/base/scripts/rc.init
new file mode 100755
index 0000000..56c3e7b
--- /dev/null
+++ b/xi/s6/base/scripts/rc.init
@@ -0,0 +1,49 @@
+#!/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 -c /etc/s6/db/current /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)
+### By default, $rl is the string "default", unless you changed it
+### via the -D option to s6-linux-init-maker.
+### Numeric arguments from 1 to 5 on the kernel command line will
+### override the default.
+
+exec /etc/s6/base/scripts/runlevel "$rl"
+
+
+### If this script is run in a container, then 1. and 2. above do not
+### apply and you should just call your CMD, if any, or let your
+### services run.
+### Something like this:
+
+# if test -z "$*" ; then return 0 ; fi
+# $@
+# echo $? > /run/s6-linux-init-container-results/exitcode
+# halt
diff --git a/xi/s6/base/scripts/rc.shutdown b/xi/s6/base/scripts/rc.shutdown
new file mode 100755
index 0000000..f759ba7
--- /dev/null
+++ b/xi/s6/base/scripts/rc.shutdown
@@ -0,0 +1,30 @@
+#!/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 s6-linux-init-maker invocation was made with the -1
+### option, messages from rc.shutdown will appear on /dev/console
+### as well as be logged by the catch-all logger.
+### If your s6-linux-init-maker invocation did NOT include the -1
+### option, messages from rc.shutdown will only be logged by the
+### catch-all logger and will NOT appear on /dev/console. In order
+### to print them to /dev/console instead, you may want to
+### uncomment the following line:
+exec >/dev/console 2>&1
+
+### If your services are managed by sysv-rc:
+### also 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:
+### also remove the "killprocs" and "mount-ro" symlinks from
+### /etc/runlevels/shutdown - because OpenRC does not properly
+### separate the service manager from the shutdown manager either.
+# exec /sbin/openrc shutdown
+
+### If your services are managed by s6-rc:
+exec s6-rc -v2 -bda change
diff --git a/xi/s6/base/scripts/rc.shutdown.final b/xi/s6/base/scripts/rc.shutdown.final
new file mode 100755
index 0000000..3f46b87
--- /dev/null
+++ b/xi/s6/base/scripts/rc.shutdown.final
@@ -0,0 +1,18 @@
+#!/bin/sh -e
+
+### Things to do *right before* the machine gets rebooted or
+### powered off, at the very end of the shutdown sequence,
+### when all the filesystems are unmounted.
+
+### This is a last resort hook; normally nothing should be
+### done here (your rc.shutdown script should have taken care
+### of everything) and you should leave this script empty.
+
+### Some distributions, however, may need to perform some
+### actions after unmounting the filesystems: typically if
+### an additional teardown action is required on a filesystem
+### after unmounting it, or if the system needs to be
+### pivot_rooted before it can be shut down, etc.
+
+### Those are all exceptional cases. If you don't know for
+### certain that you need to do something here, you don't.
diff --git a/xi/s6/base/scripts/runlevel b/xi/s6/base/scripts/runlevel
new file mode 100755
index 0000000..d266171
--- /dev/null
+++ b/xi/s6/base/scripts/runlevel
@@ -0,0 +1,18 @@
+#!/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.
+
+test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; }
+
+
+### 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 -up change "$1"