0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 14:10:33 +03:00

nixos/shutdown: Create /run/initramfs with mode 0700

This commit is contained in:
Will Fancher 2025-04-02 15:56:28 -04:00
parent 098fb93ebd
commit 1cd8c7fcfe
2 changed files with 9 additions and 0 deletions

View file

@ -23,6 +23,8 @@ import ./make-test-python.nix (
};
testScript = ''
# Check that 'generate-shutdown-ramfs.service' is started
# automatically and that 'systemd-shutdown' runs our script.
machine.wait_for_unit("multi-user.target")
# .shutdown() would wait for the machine to power off
machine.succeed("systemctl poweroff")
@ -31,6 +33,12 @@ import ./make-test-python.nix (
machine.wait_for_console_text("${msg}")
# Don't try to sync filesystems
machine.wait_for_shutdown()
# In a separate boot, start 'generate-shutdown-ramfs.service'
# manually in order to check the permissions on '/run/initramfs'.
machine.systemctl("start generate-shutdown-ramfs.service")
stat = machine.succeed("stat --printf=%a:%u:%g /run/initramfs")
assert stat == "700:0:0", f"Improper permissions on /run/initramfs: {stat}"
'';
}
)