-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/command/execlineb -P | ||
|
||
# This file is run when an unrecoverable error happens | ||
# to s6-svscan. Edit it to suit your needs. | ||
|
||
cd / | ||
redirfd -r 0 /dev/console | ||
redirfd -w 1 /dev/console | ||
fdmove -c 2 1 | ||
|
||
foreground { s6-echo "s6-svscan panicked! Dropping to a root shell.\n" } | ||
|
||
/bin/sh -i | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/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 | ||
cd / | ||
umask 022 | ||
fdclose 0 | ||
|
||
/etc/s6/crash | ||
|
||
# This should be printed to the console | ||
if { s6-echo "* init stage 1" } | ||
|
||
|
||
# Mount /sys and /proc | ||
if { s6-mount -wt sysfs sys /sysfs } | ||
if { s6-mount -wt proc proc /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. | ||
|
||
# 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/env | ||
|
||
# Start stage 2. | ||
s6-svscan -t0 /service | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/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-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} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6/crash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6/finish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6/init-stage1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,3 @@ pacman | |
procps-ng | ||
radvd | ||
sed | ||
systemd | ||
systemd-sysvcompat |