File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
nixos/modules/system/boot/loader/limine Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -388,9 +388,16 @@ def main():
388388 efibootmgr = os .path .join (config ('efiBootMgrPath' ), 'bin' , 'efibootmgr' )
389389 efi_partition = find_mounted_device (config ('efiMountPoint' ))
390390 efi_disk = find_disk_device (efi_partition )
391+
392+ efibootmgr_output = subprocess .check_output ([efibootmgr ], stderr = subprocess .STDOUT , universal_newlines = True )
393+ create_flag = '-c'
394+ # Check the output of `efibootmgr` to find if limine is already installed and present in the boot record
395+ if matches := re .findall (r'Boot[0-9a-fA-F]{4}\*? Limine' , efibootmgr_output ):
396+ create_flag = '-C' # if present, keep the same boot order
397+
391398 efibootmgr_output = subprocess .check_output ([
392399 efibootmgr ,
393- '-c' ,
400+ create_flag ,
394401 '-d' , efi_disk ,
395402 '-p' , efi_partition .removeprefix (efi_disk ).removeprefix ('p' ),
396403 '-l' , f'\\ efi\\ limine\\ { boot_file } ' ,
You can’t perform that action at this time.
0 commit comments