nixos/sysupdate: fix systemd-sysupdate test

The test fails when the `Target`'s parent directories don't exist. For
the purpose of this test though, we can just download it to the root
directory for simplicity.
This commit is contained in:
Jared Baur 2024-01-31 09:16:04 -08:00
parent 50866dc20f
commit 514bfa6674
No known key found for this signature in database

View file

@ -23,8 +23,8 @@ in
mkdir -p $out mkdir -p $out
cd $out cd $out
echo "nixos" > nixos_1.efi echo "nixos" > nixos_1.txt
sha256sum nixos_1.efi > SHA256SUMS sha256sum nixos_1.txt > SHA256SUMS
export GNUPGHOME="$(mktemp -d)" export GNUPGHOME="$(mktemp -d)"
cp -R ${gpgKeyring}/* $GNUPGHOME cp -R ${gpgKeyring}/* $GNUPGHOME
@ -39,15 +39,15 @@ in
systemd.sysupdate = { systemd.sysupdate = {
enable = true; enable = true;
transfers = { transfers = {
"uki" = { "text-file" = {
Source = { Source = {
Type = "url-file"; Type = "url-file";
Path = "http://server/"; Path = "http://server/";
MatchPattern = "nixos_@v.efi"; MatchPattern = "nixos_@v.txt";
}; };
Target = { Target = {
Path = "/boot/EFI/Linux"; Path = "/";
MatchPattern = "nixos_@v.efi"; MatchPattern = [ "nixos_@v.txt" ];
}; };
}; };
}; };
@ -61,6 +61,6 @@ in
server.wait_for_unit("nginx.service") server.wait_for_unit("nginx.service")
target.succeed("systemctl start systemd-sysupdate") target.succeed("systemctl start systemd-sysupdate")
assert "nixos" in target.wait_until_succeeds("cat /boot/EFI/Linux/nixos_1.efi", timeout=5) assert "nixos" in target.wait_until_succeeds("cat /nixos_1.txt", timeout=5)
''; '';
} }