diff options
author | Josh Robson Chase <josh@robsonchase.com> | 2021-10-01 09:05:39 -0400 |
---|---|---|
committer | Josh Robson Chase <josh@robsonchase.com> | 2021-11-05 12:11:20 -0400 |
commit | 71ed9d096ea5511cbd59ba5e01894dc68ab9337f (patch) | |
tree | ec5443a31b5f59589a6e3ce740f4a75fb21978cb /nixos/modules/system/boot/loader | |
parent | 1d5ffa8cac35c4d1dbae6506ac10913deb1320b5 (diff) | |
download | nixpkgs-71ed9d096ea5511cbd59ba5e01894dc68ab9337f.tar nixpkgs-71ed9d096ea5511cbd59ba5e01894dc68ab9337f.tar.gz nixpkgs-71ed9d096ea5511cbd59ba5e01894dc68ab9337f.tar.bz2 nixpkgs-71ed9d096ea5511cbd59ba5e01894dc68ab9337f.tar.lz nixpkgs-71ed9d096ea5511cbd59ba5e01894dc68ab9337f.tar.xz nixpkgs-71ed9d096ea5511cbd59ba5e01894dc68ab9337f.tar.zst nixpkgs-71ed9d096ea5511cbd59ba5e01894dc68ab9337f.zip |
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.
Diffstat (limited to 'nixos/modules/system/boot/loader')
-rw-r--r-- | nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py index 27b2abc1eab..588016fe526 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py @@ -214,19 +214,13 @@ def main() -> None: subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "--no-variables", "install"]) else: # Update bootloader to latest if needed - systemd_version = subprocess.check_output(["@systemd@/bin/bootctl", "--version"], universal_newlines=True).split()[1] - sdboot_status = subprocess.check_output(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "status"], universal_newlines=True) - - # See status_binaries() in systemd bootctl.c for code which generates this - m = re.search("^\W+File:.*/EFI/(BOOT|systemd)/.*\.efi \(systemd-boot ([\d.]+)[^)]*\)$", - sdboot_status, re.IGNORECASE | re.MULTILINE) - if m is None: - 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"]) + update_output = subprocess.run(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "update", "--graceful"], + 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\"\.$", + update_output, re.MULTILINE) + if updated: + systemd_version = updated.group(1) + print(f"updated systemd-boot to {systemd_version}") mkdir_p("@efiSysMountPoint@/efi/nixos") mkdir_p("@efiSysMountPoint@/loader/entries") |