nixos/etc: make re-mounting /etc overlay idempotent
This commit is contained in:
parent
1e1efbcf8c
commit
5df8caced4
3 changed files with 25 additions and 11 deletions
|
@ -238,7 +238,9 @@ in
|
|||
# this should not run because /etc is mounted via a systemd mount unit
|
||||
# instead. To a large extent this mimics what composefs does. Because
|
||||
# it's relatively simple, however, we avoid the composefs dependency.
|
||||
if [[ ! $IN_NIXOS_SYSTEMD_STAGE1 ]]; then
|
||||
# Since this script is not idempotent, it should not run when etc hasn't
|
||||
# changed.
|
||||
if [[ ! $IN_NIXOS_SYSTEMD_STAGE1 ]] && [[ "${config.system.build.etc}/etc" != "$(readlink -f /run/current-system/etc)" ]]; then
|
||||
echo "remounting /etc..."
|
||||
|
||||
tmpMetadataMount=$(mktemp --directory)
|
||||
|
|
|
@ -20,7 +20,13 @@
|
|||
};
|
||||
|
||||
testScript = ''
|
||||
with subtest("/etc is mounted as an overlay"):
|
||||
machine.succeed("findmnt --kernel --type overlay /etc")
|
||||
|
||||
with subtest("switching to the same generation"):
|
||||
machine.succeed("/run/current-system/bin/switch-to-configuration test")
|
||||
|
||||
with subtest("switching to a new generation"):
|
||||
machine.fail("stat /etc/newgen")
|
||||
|
||||
machine.succeed("/run/current-system/specialisation/new-generation/bin/switch-to-configuration switch")
|
||||
|
|
|
@ -18,7 +18,13 @@
|
|||
};
|
||||
|
||||
testScript = ''
|
||||
with subtest("/etc is mounted as an overlay"):
|
||||
machine.succeed("findmnt --kernel --type overlay /etc")
|
||||
|
||||
with subtest("switching to the same generation"):
|
||||
machine.succeed("/run/current-system/bin/switch-to-configuration test")
|
||||
|
||||
with subtest("switching to a new generation"):
|
||||
machine.fail("stat /etc/newgen")
|
||||
machine.succeed("echo -n 'mutable' > /etc/mutable")
|
||||
|
||||
|
|
Loading…
Reference in a new issue