|
30 | 30 | Unit, |
31 | 31 | ) |
32 | 32 | from archinstall.lib.models.packages import Repository |
| 33 | +from archinstall.lib.packages import installed_package |
33 | 34 | from archinstall.lib.translationhandler import tr |
34 | 35 | from archinstall.tui.curses_menu import Tui |
35 | 36 |
|
@@ -1197,22 +1198,24 @@ def _add_systemd_bootloader( |
1197 | 1198 |
|
1198 | 1199 | # TODO: This is a temporary workaround to deal with https://github.com/archlinux/archinstall/pull/3396#issuecomment-2996862019 |
1199 | 1200 | # the systemd_version check can be removed once `--variables=BOOL` is merged into systemd. |
1200 | | - if pacman_q_systemd := self.pacman.run('-Q systemd').trace_log: |
1201 | | - systemd_version = int(pacman_q_systemd.split(b' ')[1][:3].decode()) |
| 1201 | + systemd_pkg = installed_package('systemd') |
| 1202 | + |
| 1203 | + # keep the version as a str as it can be something like 257.8-2 |
| 1204 | + if systemd_pkg is not None: |
| 1205 | + systemd_version = systemd_pkg.version |
1202 | 1206 | else: |
1203 | | - systemd_version = 257 # This works as a safety workaround for this hot-fix |
| 1207 | + systemd_version = '257' # This works as a safety workaround for this hot-fix |
1204 | 1208 |
|
1205 | | - # Install the boot loader |
1206 | 1209 | try: |
1207 | 1210 | # Force EFI variables since bootctl detects arch-chroot |
1208 | 1211 | # as a container environemnt since v257 and skips them silently. |
1209 | 1212 | # https://github.com/systemd/systemd/issues/36174 |
1210 | | - if systemd_version >= 258: |
| 1213 | + if systemd_version >= '258': |
1211 | 1214 | SysCommand(f'arch-chroot {self.target} bootctl --variables=yes {" ".join(bootctl_options)} install') |
1212 | 1215 | else: |
1213 | 1216 | SysCommand(f'arch-chroot {self.target} bootctl {" ".join(bootctl_options)} install') |
1214 | 1217 | except SysCallError: |
1215 | | - if systemd_version >= 258: |
| 1218 | + if systemd_version >= '258': |
1216 | 1219 | # Fallback, try creating the boot loader without touching the EFI variables |
1217 | 1220 | SysCommand(f'arch-chroot {self.target} bootctl --variables=no {" ".join(bootctl_options)} install') |
1218 | 1221 | else: |
|
0 commit comments