diff options
Diffstat (limited to 'examples/ROOT/etc/s6-init')
-rw-r--r-- | examples/ROOT/etc/s6-init/README | 9 | ||||
-rw-r--r-- | examples/ROOT/etc/s6-init/env/PATH | 1 | ||||
-rw-r--r-- | examples/ROOT/etc/s6-init/env/README | 6 | ||||
l--------- | examples/ROOT/etc/s6-init/init | 1 | ||||
-rwxr-xr-x | examples/ROOT/etc/s6-init/init-stage1 | 59 | ||||
-rwxr-xr-x | examples/ROOT/etc/s6-init/init-stage2 | 27 | ||||
-rwxr-xr-x | examples/ROOT/etc/s6-init/init-stage3 | 46 |
7 files changed, 0 insertions, 149 deletions
diff --git a/examples/ROOT/etc/s6-init/README b/examples/ROOT/etc/s6-init/README deleted file mode 100644 index 7e104fd..0000000 --- a/examples/ROOT/etc/s6-init/README +++ /dev/null @@ -1,9 +0,0 @@ -This is an example directory containing booting scripts -that lead to s6-svscan running as process 1 in stage 2. - -Read them carefully and edit them to suit your needs. -Some scripts are Linux-dependent; they can be easily -adapted to other Unix systems. - -The skarnet.org servers actually run such a system, with -scripts that are based on this model. diff --git a/examples/ROOT/etc/s6-init/env/PATH b/examples/ROOT/etc/s6-init/env/PATH deleted file mode 100644 index a4c496e..0000000 --- a/examples/ROOT/etc/s6-init/env/PATH +++ /dev/null @@ -1 +0,0 @@ -/command:/usr/bin:/bin:/usr/sbin:/sbin diff --git a/examples/ROOT/etc/s6-init/env/README b/examples/ROOT/etc/s6-init/env/README deleted file mode 100644 index 6c84e3b..0000000 --- a/examples/ROOT/etc/s6-init/env/README +++ /dev/null @@ -1,6 +0,0 @@ - -This directory is read by s6-envdir at boot time. -It contains environment variables that will be present in -all the supervision tree, and all the launched services. -Make sure to remove this file, or else you'll have a -README environment variable in all your daemons. :) diff --git a/examples/ROOT/etc/s6-init/init b/examples/ROOT/etc/s6-init/init deleted file mode 120000 index 4ac5fd9..0000000 --- a/examples/ROOT/etc/s6-init/init +++ /dev/null @@ -1 +0,0 @@ -init-stage1
\ No newline at end of file diff --git a/examples/ROOT/etc/s6-init/init-stage1 b/examples/ROOT/etc/s6-init/init-stage1 deleted file mode 100755 index 810948b..0000000 --- a/examples/ROOT/etc/s6-init/init-stage1 +++ /dev/null @@ -1,59 +0,0 @@ -#!/command/execlineb -P - -# This file is the first program run at boot time, -# as process 1. -# Edit it to suit your needs. - -# Make sure everything is sane and ignore input -s6-setsid -qb -cd / -umask 022 -fdclose 0 - -# This should be printed to the console -if { s6-echo "* init stage 1" } - - -# Mount /sys and /proc -if { s6-mount -wt sysfs sys /mnt/sysfs } -if { s6-mount -wt proc proc /mnt/procfs } - -# Close remaining handles to /dev/console -fdclose 1 fdclose 2 - -# Now no process has any open fd to /dev/console (or to -# anything for that matter). -# We can safely overwrite the minimal /dev with the real one. - -# in case some Linux kernel has mounted a devtmpfs -foreground { s6-umount /mnt/tmpfs/dev } - -# Make the tmpfs -if { s6-mount -wt tmpfs -o mode=0755,size=67108864 tmpfs /mnt/tmpfs } - -# Copy the image to the tmpfs -if { s6-hiercopy /img/tmpfs /mnt/tmpfs } - -# Now we have a working /dev and /tmp, and a minimal writable /service -# with a catch-all logger and a getty. We're good for stage 2 ! - -# Reopen stdin/stdout/stderr and make them point to the right places -redirfd -r 0 /dev/null -redirfd -wnb 1 /service/s6-svscan-log/fifo # (black magic: doesn't block) -fdmove -c 2 1 - -# Load the general environment -s6-envdir /etc/s6-init/env - -# Fork the "init-stage2" script and have it ready to start as soon -# as the catch-all logger is in place -background -{ - s6-setsid - redirfd -w 1 /service/s6-svscan-log/fifo # (blocks until the logger reads) - /etc/s6-init/init-stage2 -} -unexport ! - -# Start stage 2. -s6-svscan -st0 /service diff --git a/examples/ROOT/etc/s6-init/init-stage2 b/examples/ROOT/etc/s6-init/init-stage2 deleted file mode 100755 index 86f31a5..0000000 --- a/examples/ROOT/etc/s6-init/init-stage2 +++ /dev/null @@ -1,27 +0,0 @@ -#!/command/execlineb -P - -# This file is executed (not as process 1!) as soon as s6-svscan -# starts. It should perform all the remaining one-time initialization -# tasks. - -if -nt -{ - -# This should be logged in /mnt/tmpfs/uncaught-logs/current, -# NOT on /dev/console ! - if { s6-echo "* init-stage2 starting." } - -# Call your service manager commands here to run the boot scripts. - if { s6-rc-init /service } - if { s6-rc -u change normal-state } - -# We're done and the machine is fully operational. - s6-echo "* init-stage2 completed." -} - - -# If anything in the if -nt { } block fails, control jumps here. -# No need to do much because there's already an operational getty running. - -redirfd -w 1 /dev/console -s6-echo "\n!!!!!\ninit-stage2 failed, please log in and investigate.\n!!!!!" diff --git a/examples/ROOT/etc/s6-init/init-stage3 b/examples/ROOT/etc/s6-init/init-stage3 deleted file mode 100755 index 7ea5639..0000000 --- a/examples/ROOT/etc/s6-init/init-stage3 +++ /dev/null @@ -1,46 +0,0 @@ -#!/command/execlineb -S0 - -# This is the shutdown script, running as process 1. - -# Make sure we have no open handle to anywhere else -# than /dev/console -cd / -fdclose 0 -redirfd -w 1 /dev/console -fdmove -c 2 1 - -foreground { s6-echo "Syncing disks." } -foreground { s6-sync } - - -# Even if s6-rc and s6-svscan properly brought all the services down -# before exec'ing into this script, users might have launched -# background nohup processes, so we have to kill everything. - -foreground { s6-echo "Sending all processes the TERM signal." } -foreground { s6-nuke -th } -foreground { s6-sleep 1 } -foreground { s6-echo "Sending all processes the KILL signal." } -foreground { s6-nuke -k } - -# Here, s6-nuke sends a SIGKILL to every process on the system. -# It kills itself, but not before the SIGKILL has been broadcast. -# The "foreground" process runs as process 1, so it survives, -# and execs into the rest of the script when s6-nuke dies. - -# Reap the huge army of zombies we just created -wait { } - - -foreground { s6-echo "Syncing disks." } -foreground { s6-sync } # yes, it helps. -foreground { s6-echo "Unmounting disks." } - -# Unmount all your filesystems here, turn off swap, -# remount / read-only if needed, etc. -# foreground { s6-umount /mnt/rwfs } - -# Reboot, halt or poweroff the machine, depending on the parameter -# that was given to the script. -foreground { s6-echo "\nPerforming "${1}"." } -s6-${1} -f |