Use default EFI boot app path for Limine if installing to USB (#3331)
This commit is contained in:
parent
1678fb5192
commit
0f90d5991d
|
|
@ -1256,8 +1256,21 @@ class Installer:
|
||||||
|
|
||||||
info(f"Limine EFI partition: {efi_partition.dev_path}")
|
info(f"Limine EFI partition: {efi_partition.dev_path}")
|
||||||
|
|
||||||
|
parent_dev_path = device_handler.get_parent_device_path(efi_partition.safe_dev_path)
|
||||||
|
is_target_usb = SysCommand(
|
||||||
|
f'udevadm info --no-pager --query=property --property=ID_BUS --value --name={parent_dev_path}'
|
||||||
|
).decode() == 'usb'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
efi_dir_path = self.target / efi_partition.mountpoint.relative_to('/') / 'EFI' / 'limine'
|
efi_dir_path = self.target / efi_partition.mountpoint.relative_to('/') / 'EFI'
|
||||||
|
efi_dir_path_target = efi_partition.mountpoint / 'EFI'
|
||||||
|
if is_target_usb:
|
||||||
|
efi_dir_path = efi_dir_path / 'BOOT'
|
||||||
|
efi_dir_path_target = efi_dir_path_target / 'BOOT'
|
||||||
|
else:
|
||||||
|
efi_dir_path = efi_dir_path / 'limine'
|
||||||
|
efi_dir_path_target = efi_dir_path_target / 'limine'
|
||||||
|
|
||||||
efi_dir_path.mkdir(parents=True, exist_ok=True)
|
efi_dir_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
for file in ('BOOTIA32.EFI', 'BOOTX64.EFI'):
|
for file in ('BOOTIA32.EFI', 'BOOTX64.EFI'):
|
||||||
|
|
@ -1268,40 +1281,38 @@ class Installer:
|
||||||
config_path = efi_dir_path / 'limine.conf'
|
config_path = efi_dir_path / 'limine.conf'
|
||||||
|
|
||||||
hook_command = (
|
hook_command = (
|
||||||
f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI {efi_partition.mountpoint}/EFI/limine/'
|
f'/usr/bin/cp /usr/share/limine/BOOTIA32.EFI {efi_dir_path_target}/'
|
||||||
f' && /usr/bin/cp /usr/share/limine/BOOTX64.EFI {efi_partition.mountpoint}/EFI/limine/'
|
f' && /usr/bin/cp /usr/share/limine/BOOTX64.EFI {efi_dir_path_target}/'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create EFI boot menu entry for Limine.
|
if not is_target_usb:
|
||||||
parent_dev_path = device_handler.get_parent_device_path(efi_partition.safe_dev_path)
|
# Create EFI boot menu entry for Limine.
|
||||||
|
try:
|
||||||
|
with open('/sys/firmware/efi/fw_platform_size') as fw_platform_size:
|
||||||
|
efi_bitness = fw_platform_size.read().strip()
|
||||||
|
except Exception as err:
|
||||||
|
raise OSError(f'Could not open or read /sys/firmware/efi/fw_platform_size to determine EFI bitness: {err}')
|
||||||
|
|
||||||
try:
|
if efi_bitness == '64':
|
||||||
with open('/sys/firmware/efi/fw_platform_size') as fw_platform_size:
|
loader_path = '/EFI/limine/BOOTX64.EFI'
|
||||||
efi_bitness = fw_platform_size.read().strip()
|
elif efi_bitness == '32':
|
||||||
except Exception as err:
|
loader_path = '/EFI/limine/BOOTIA32.EFI'
|
||||||
error(f'Could not open or read /sys/firmware/efi/fw_platform_size to determine EFI bitness: {err}')
|
else:
|
||||||
|
raise ValueError(f'EFI bitness is neither 32 nor 64 bits. Found "{efi_bitness}".')
|
||||||
|
|
||||||
loader_path = None
|
try:
|
||||||
if efi_bitness == '64':
|
SysCommand(
|
||||||
loader_path = '/EFI/limine/BOOTX64.EFI'
|
'efibootmgr'
|
||||||
elif efi_bitness == '32':
|
' --create'
|
||||||
loader_path = '/EFI/limine/BOOTIA32.EFI'
|
f' --disk {parent_dev_path}'
|
||||||
else:
|
f' --part {efi_partition.partn}'
|
||||||
error('EFI bitness is neither 32 nor 64 bits')
|
' --label "Arch Linux Limine Bootloader"'
|
||||||
|
f' --loader {loader_path}'
|
||||||
try:
|
' --unicode'
|
||||||
SysCommand(
|
' --verbose'
|
||||||
'efibootmgr'
|
)
|
||||||
' --create'
|
except Exception as err:
|
||||||
f' --disk {parent_dev_path}'
|
raise ValueError(f'SysCommand for efibootmgr failed: {err}')
|
||||||
f' --part {efi_partition.partn}'
|
|
||||||
' --label "Arch Linux Limine Bootloader"'
|
|
||||||
f' --loader {loader_path}'
|
|
||||||
' --unicode'
|
|
||||||
' --verbose'
|
|
||||||
)
|
|
||||||
except Exception as err:
|
|
||||||
error(f'SysCommand for efibootmgr failed: {err}')
|
|
||||||
else:
|
else:
|
||||||
boot_limine_path = self.target / 'boot' / 'limine'
|
boot_limine_path = self.target / 'boot' / 'limine'
|
||||||
boot_limine_path.mkdir(parents=True, exist_ok=True)
|
boot_limine_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue