Fix GRUB fallback-from-removable logic introduced in c095eb56d8 (#3950)
Commit c095eb56d8 was supposed to introduce logic
such that if the `grub-install` command failed with a `--removable` flag, then
another attempt would be made with such flag removed.
This was broken because the `--removable` flag was kept in both cases (likely a
copy-paste mistake). This has been an issue since, in all future iterations of
the code.
What this commit does is fix this logic, but also invert the cases tested:
first test without `--removable`, then add it should that case fail, as this is
the most sensible thing to do.
This commit is contained in:
parent
7732d50016
commit
6fc0bc3671
|
|
@ -1320,11 +1320,15 @@ class Installer:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
SysCommand(command, peek_output=True)
|
SysCommand(command, peek_output=True)
|
||||||
except SysCallError:
|
except SysCallError as err:
|
||||||
try:
|
if not bootloader_removable:
|
||||||
SysCommand(command, peek_output=True)
|
command.append('--removable')
|
||||||
except SysCallError as err:
|
try:
|
||||||
raise DiskError(f'Could not install GRUB to {self.target}{efi_partition.mountpoint}: {err}')
|
SysCommand(command, peek_output=True)
|
||||||
|
except SysCallError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
raise DiskError(f'Could not install GRUB to {self.target}{efi_partition.mountpoint}: {err}') from err
|
||||||
else:
|
else:
|
||||||
info(f'GRUB boot partition: {boot_partition.dev_path}')
|
info(f'GRUB boot partition: {boot_partition.dev_path}')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue