flowy: avoid invoking no-op efibootmgr operations
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user