flowy: avoid invoking no-op efibootmgr operations

This commit is contained in:
2025-08-16 08:05:55 +00:00
parent 03a1638628
commit 9847e0171c

View File

@@ -45,11 +45,12 @@
bootCurrent=''${bootCurrent/BootCurrent: /}
bootOrder=$(echo "$efi" | grep '^BootOrder: ')
bootOrder=''${bootOrder/BootOrder: /}
# prepend the current boot entry to the boot order...
newBootOrder="$bootCurrent,$bootOrder"
# but in a way that's idempotent :)
newBootOrder=''${newBootOrder/$bootCurrent,$bootCurrent/$bootCurrent}
(set -x; efibootmgr -o "$newBootOrder")
if ! [[ "$bootOrder" =~ ^"$bootCurrent", ]]; then
# booted entry was not the default,
# so prepend it to the boot order:
newBootOrder="$bootCurrent,$bootOrder"
(set -x; efibootmgr -o "$newBootOrder")
fi
'';
};
in lib.getExe makeDefaultBootEntry;