make "shutdown" work

create a package for the s6-compatible shutdown/halt/poweroff
commands and put it on the path ahead of busybox
This commit is contained in:
Daniel Barlow
2022-09-26 14:13:23 +01:00
parent 2430e80ca1
commit d5ccecf038
5 changed files with 40 additions and 17 deletions

View File

@@ -23,18 +23,6 @@ let
};
dir = contents: { type = "d"; inherit contents; };
symlink = target: { type = "s"; inherit target; };
hpr = arg: "#!${execline}/bin/execlineb -S0\n${s6-linux-init}/bin/s6-linux-init-hpr ${arg} \$@";
bin = dir {
shutdown = symlink "${s6-linux-init}/bin/s6-linux-init-shutdown";
telinit = symlink "${s6-linux-init}/bin/s6-linux-init-telinit";
reboot = { type="f"; file = hpr "-r"; mode="0755"; };
poweroff = { type="f"; file = hpr "-p"; mode="0755"; };
halt = { type="f"; file = hpr "-h"; mode="0755"; };
init = {
type="f"; mode="0755";
file = "#!${execline}/bin/execlineb -S0\n${s6-linux-init}/bin/s6-linux-init -c /etc/s6-linux-init/current -m 0022 -p ${lib.makeBinPath [busybox execline s6-linux-init s6-rc]}:/usr/bin:/bin -d /dev -- \"\\$@\"";
};
};
scripts = symlink "${initscripts}/scripts";
env = dir {};
run-image = dir {
@@ -150,7 +138,7 @@ let
uncaught-logs = (dir {}) // {mode = "2750";};
};
structure = { etc = dir { s6-linux-init = dir { current = dir {
inherit bin scripts env run-image;
inherit scripts env run-image;
};};};};
in pseudofile "pseudo.s6-init" structure