liminix-fork/tests/pseudofiles/run.sh
Daniel Barlow 45025f128a switch to s6-linux-init and s6-rc
This is at the point where it runs a getty and a pile of s6-supervise
processes, though it doesn't seem to run the things being supervised
2022-09-21 23:01:21 +01:00

17 lines
751 B
Bash
Executable file

set -e
expr=$(cat <<"EXPR"
let
overlay = import ./overlay.nix;
nixpkgs = import <nixpkgs> ( {overlays = [overlay]; });
structure = import ./tests/pseudofiles/structure.nix;
in nixpkgs.pkgs.pseudofile "pseudo.s6-init" structure
EXPR
)
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-build -E "${expr}" -o tests/pseudofiles/result $*
diff tests/pseudofiles/result tests/pseudofiles/result.expected
test -f /tmp/out.squashfs && rm /tmp/out.squashfs
nix-shell -p squashfsTools -p qprint --run "mksquashfs - /tmp/out.squashfs -p '/ d 755 0 0' -pf tests/pseudofiles/result -quiet -no-progress"
foo="$(nix-shell -p squashfsTools --run 'unsquashfs -cat /tmp/out.squashfs service/s6-linux-init-runleveld/run')"
test "$foo" = "$(printf "hello\nworld")"