Skip to content

Commit 9dd9232

Browse files
authored
Added temporary hold on bootctl's --variables=BOOL usage, as it's notin systemd main yet (#3625)
* Added temporary hold on bootctl's --variables=BOOL usage, as it's not in systemd main yet * Fixed ruff format check * Fixed mypy type check issue * Spelling error * Fixed flake8 complaint
1 parent 9d0e1e5 commit 9dd9232

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

archinstall/lib/installer.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,15 +1172,28 @@ def _add_systemd_bootloader(
11721172
bootctl_options.append(f'--esp-path={efi_partition.mountpoint}')
11731173
bootctl_options.append(f'--boot-path={boot_partition.mountpoint}')
11741174

1175+
# TODO: This is a temporary workaround to deal with https://github.com/archlinux/archinstall/pull/3396#issuecomment-2996862019
1176+
# the systemd_version check can be removed once `--variables=BOOL` is merged into systemd.
1177+
if pacman_q_systemd := self.pacman.run('-Q systemd').trace_log:
1178+
systemd_version = int(pacman_q_systemd.split(b' ')[1][:3].decode())
1179+
else:
1180+
systemd_version = 257 # This works as a safety workaround for this hot-fix
1181+
11751182
# Install the boot loader
11761183
try:
11771184
# Force EFI variables since bootctl detects arch-chroot
11781185
# as a container environemnt since v257 and skips them silently.
11791186
# https://github.com/systemd/systemd/issues/36174
1180-
SysCommand(f'arch-chroot {self.target} bootctl --variables=yes {" ".join(bootctl_options)} install')
1187+
if systemd_version >= 258:
1188+
SysCommand(f'arch-chroot {self.target} bootctl --variables=yes {" ".join(bootctl_options)} install')
1189+
else:
1190+
SysCommand(f'arch-chroot {self.target} bootctl {" ".join(bootctl_options)} install')
11811191
except SysCallError:
1182-
# Fallback, try creating the boot loader without touching the EFI variables
1183-
SysCommand(f'arch-chroot {self.target} bootctl --variables=no {" ".join(bootctl_options)} install')
1192+
if systemd_version >= 258:
1193+
# Fallback, try creating the boot loader without touching the EFI variables
1194+
SysCommand(f'arch-chroot {self.target} bootctl --variables=no {" ".join(bootctl_options)} install')
1195+
else:
1196+
SysCommand(f'arch-chroot {self.target} bootctl --no-variables {" ".join(bootctl_options)} install')
11841197

11851198
# Loader configuration is stored in ESP/loader:
11861199
# https://man.archlinux.org/man/loader.conf.5

0 commit comments

Comments
 (0)