@@ -1260,6 +1260,7 @@ def _add_grub_bootloader(
12601260 boot_partition : PartitionModification ,
12611261 root : PartitionModification | LvmVolume ,
12621262 efi_partition : PartitionModification | None ,
1263+ bootloader_removable : bool = False ,
12631264 ) -> None :
12641265 debug ('Installing grub bootloader' )
12651266
@@ -1303,9 +1304,11 @@ def _add_grub_bootloader(
13031304 f'--efi-directory={ efi_partition .mountpoint } ' ,
13041305 * boot_dir_arg ,
13051306 '--bootloader-id=GRUB' ,
1306- '--removable' ,
13071307 ]
13081308
1309+ if bootloader_removable :
1310+ add_options .append ('--removable' )
1311+
13091312 command .extend (add_options )
13101313
13111314 try :
@@ -1346,6 +1349,7 @@ def _add_limine_bootloader(
13461349 efi_partition : PartitionModification | None ,
13471350 root : PartitionModification | LvmVolume ,
13481351 uki_enabled : bool = False ,
1352+ bootloader_removable : bool = False ,
13491353 ) -> None :
13501354 debug ('Installing Limine bootloader' )
13511355
@@ -1368,17 +1372,11 @@ def _add_limine_bootloader(
13681372 info (f'Limine EFI partition: { efi_partition .dev_path } ' )
13691373
13701374 parent_dev_path = device_handler .get_parent_device_path (efi_partition .safe_dev_path )
1371- is_target_usb = (
1372- SysCommand (
1373- f'udevadm info --no-pager --query=property --property=ID_BUS --value --name={ parent_dev_path } ' ,
1374- ).decode ()
1375- == 'usb'
1376- )
13771375
13781376 try :
13791377 efi_dir_path = self .target / efi_partition .mountpoint .relative_to ('/' ) / 'EFI'
13801378 efi_dir_path_target = efi_partition .mountpoint / 'EFI'
1381- if is_target_usb :
1379+ if bootloader_removable :
13821380 efi_dir_path = efi_dir_path / 'BOOT'
13831381 efi_dir_path_target = efi_dir_path_target / 'BOOT'
13841382 else :
@@ -1398,7 +1396,7 @@ def _add_limine_bootloader(
13981396 f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI { efi_dir_path_target } / && /usr/bin/cp /usr/share/limine/BOOTX64.EFI { efi_dir_path_target } /'
13991397 )
14001398
1401- if not is_target_usb :
1399+ if not bootloader_removable :
14021400 # Create EFI boot menu entry for Limine.
14031401 try :
14041402 with open ('/sys/firmware/efi/fw_platform_size' ) as fw_platform_size :
@@ -1604,7 +1602,7 @@ def _config_uki(
16041602 if not self .mkinitcpio (['-P' ]):
16051603 error ('Error generating initramfs (continuing anyway)' )
16061604
1607- def add_bootloader (self , bootloader : Bootloader , uki_enabled : bool = False ) -> None :
1605+ def add_bootloader (self , bootloader : Bootloader , uki_enabled : bool = False , bootloader_removable : bool = False ) -> None :
16081606 """
16091607 Adds a bootloader to the installation instance.
16101608 Archinstall supports one of three types:
@@ -1614,6 +1612,8 @@ def add_bootloader(self, bootloader: Bootloader, uki_enabled: bool = False) -> N
16141612 * efistub (beta)
16151613
16161614 :param bootloader: Type of bootloader to be added
1615+ :param uki_enabled: Whether to use unified kernel images
1616+ :param bootloader_removable: Whether to install to removable media location (UEFI only, for GRUB and Limine)
16171617 """
16181618
16191619 for plugin in plugins .values ():
@@ -1642,11 +1642,11 @@ def add_bootloader(self, bootloader: Bootloader, uki_enabled: bool = False) -> N
16421642 case Bootloader .Systemd :
16431643 self ._add_systemd_bootloader (boot_partition , root , efi_partition , uki_enabled )
16441644 case Bootloader .Grub :
1645- self ._add_grub_bootloader (boot_partition , root , efi_partition )
1645+ self ._add_grub_bootloader (boot_partition , root , efi_partition , bootloader_removable )
16461646 case Bootloader .Efistub :
16471647 self ._add_efistub_bootloader (boot_partition , root , uki_enabled )
16481648 case Bootloader .Limine :
1649- self ._add_limine_bootloader (boot_partition , efi_partition , root , uki_enabled )
1649+ self ._add_limine_bootloader (boot_partition , efi_partition , root , uki_enabled , bootloader_removable )
16501650
16511651 def add_additional_packages (self , packages : str | list [str ]) -> None :
16521652 return self .pacman .strap (packages )
0 commit comments