nixos/systemd-boot: Remove the installed version check altogether
bootctl does it as a part of its update process anyway, so we're just duplicating code.
This commit is contained in:
parent
1d5ffa8cac
commit
71ed9d096e
@ -214,19 +214,13 @@ def main() -> None:
|
|||||||
subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "--no-variables", "install"])
|
subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "--no-variables", "install"])
|
||||||
else:
|
else:
|
||||||
# Update bootloader to latest if needed
|
# Update bootloader to latest if needed
|
||||||
systemd_version = subprocess.check_output(["@systemd@/bin/bootctl", "--version"], universal_newlines=True).split()[1]
|
update_output = subprocess.run(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "update", "--graceful"],
|
||||||
sdboot_status = subprocess.check_output(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "status"], universal_newlines=True)
|
universal_newlines=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr
|
||||||
|
updated = re.search("^Copied \"/nix/store/.*-systemd-(.*)/lib/systemd/boot/efi/.*\.efi\" to \"/boot/EFI/.*\.efi\"\.$",
|
||||||
# See status_binaries() in systemd bootctl.c for code which generates this
|
update_output, re.MULTILINE)
|
||||||
m = re.search("^\W+File:.*/EFI/(BOOT|systemd)/.*\.efi \(systemd-boot ([\d.]+)[^)]*\)$",
|
if updated:
|
||||||
sdboot_status, re.IGNORECASE | re.MULTILINE)
|
systemd_version = updated.group(1)
|
||||||
if m is None:
|
print(f"updated systemd-boot to {systemd_version}")
|
||||||
print("could not find any previously installed systemd-boot")
|
|
||||||
else:
|
|
||||||
sdboot_version = m.group(2)
|
|
||||||
if systemd_version > sdboot_version:
|
|
||||||
print("updating systemd-boot from %s to %s" % (sdboot_version, systemd_version))
|
|
||||||
subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "update"])
|
|
||||||
|
|
||||||
mkdir_p("@efiSysMountPoint@/efi/nixos")
|
mkdir_p("@efiSysMountPoint@/efi/nixos")
|
||||||
mkdir_p("@efiSysMountPoint@/loader/entries")
|
mkdir_p("@efiSysMountPoint@/loader/entries")
|
||||||
|
@ -84,7 +84,7 @@ in
|
|||||||
)
|
)
|
||||||
|
|
||||||
output = machine.succeed("/run/current-system/bin/switch-to-configuration boot")
|
output = machine.succeed("/run/current-system/bin/switch-to-configuration boot")
|
||||||
assert "updating systemd-boot from 000.0 to " in output
|
assert "updated systemd-boot to " in output
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user