Make removable location the default for bootloader installation (#4030)

Also update the option's description to make it clear that it being enabled is the sane default.
This commit is contained in:
Mintsuki 2025-12-27 14:38:14 +01:00 committed by GitHub
parent 6968a33508
commit 42a4ee8472
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 11 deletions

View File

@ -185,7 +185,7 @@ class ArchConfig:
uki = args_config.get('uki', False)
if uki and not bootloader.has_uki_support():
uki = False
arch_config.bootloader_config = BootloaderConfiguration(bootloader=bootloader, uki=uki, removable=False)
arch_config.bootloader_config = BootloaderConfiguration(bootloader=bootloader, uki=uki, removable=True)
# deprecated: backwards compatibility
audio_config_args = args_config.get('audio_config', None)

View File

@ -83,8 +83,8 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]):
def _prev_removable(self, item: MenuItem) -> str | None:
if item.value:
return tr('Will install to /EFI/BOOT/ (removable location)')
return tr('Will install to standard location with NVRAM entry')
return tr('Will install to /EFI/BOOT/ (removable location, safe default)')
return tr('Will install to custom location with NVRAM entry')
@override
def run(
@ -114,6 +114,9 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]):
removable_item.value = False
self._bootloader_conf.removable = False
else:
if not removable_item.enabled:
removable_item.value = True
self._bootloader_conf.removable = True
removable_item.enabled = True
return bootloader
@ -147,18 +150,26 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]):
+ '\n\n'
+ tr('This installs the bootloader to /EFI/BOOT/BOOTX64.EFI (or similar) which is useful for:')
+ '\n\n'
+ tr('Firmware that does not properly support NVRAM boot entries like most MSI motherboards,')
+ '\n '
+ tr('most Apple Macs, many laptops...')
+ '\n'
+ tr('USB drives or other portable external media.')
+ '\n'
+ tr('Systems where you want the disk to be bootable on any computer.')
+ '\n'
+ tr('Firmware that does not properly support NVRAM boot entries.')
+ '\n\n'
+ tr(
textwrap.dedent(
"""\
This is NOT recommended if none of the above apply, as it makes installing multiple
EFI bootloaders on the same disk more challenging, and it overwrites whatever bootloader
was previously installed on the default removable media search location, if any.
If you do not know what this means, LEAVE THIS OPTION ENABLED, as it is the safe default.
It is suggested to disable this if none of the above apply, as it makes installing multiple
EFI bootloaders on the same disk easier, and it will not overwrite whatever bootloader
was previously installed at the default removable media search location, if any.
It may also make the installation more resilient in case of dual-booting with Windows,
as Windows is known to sometimes erase or replace the bootloader installed at the removable
location.
"""
)
)

View File

@ -65,7 +65,7 @@ class Bootloader(Enum):
class BootloaderConfiguration:
bootloader: Bootloader
uki: bool = False
removable: bool = False
removable: bool = True
def json(self) -> dict[str, Any]:
return {'bootloader': self.bootloader.json(), 'uki': self.uki, 'removable': self.removable}
@ -74,12 +74,14 @@ class BootloaderConfiguration:
def parse_arg(cls, config: dict[str, Any], skip_boot: bool) -> BootloaderConfiguration:
bootloader = Bootloader.from_arg(config.get('bootloader', ''), skip_boot)
uki = config.get('uki', False)
removable = config.get('removable', False)
removable = config.get('removable', True)
return cls(bootloader=bootloader, uki=uki, removable=removable)
@classmethod
def get_default(cls) -> BootloaderConfiguration:
return cls(bootloader=Bootloader.get_default(), uki=False, removable=False)
bootloader = Bootloader.get_default()
removable = SysInfo.has_uefi() and bootloader.has_removable_support()
return cls(bootloader=bootloader, uki=False, removable=removable)
def preview(self) -> str:
text = f'{tr("Bootloader")}: {self.bootloader.value}'