Fix parsing of systemd package version (#3732)
This commit is contained in:
parent
a4324ec5f1
commit
7d94210cd3
|
|
@ -30,6 +30,7 @@ from archinstall.lib.models.device import (
|
|||
Unit,
|
||||
)
|
||||
from archinstall.lib.models.packages import Repository
|
||||
from archinstall.lib.packages import installed_package
|
||||
from archinstall.lib.translationhandler import tr
|
||||
from archinstall.tui.curses_menu import Tui
|
||||
|
||||
|
|
@ -1197,22 +1198,24 @@ class Installer:
|
|||
|
||||
# TODO: This is a temporary workaround to deal with https://github.com/archlinux/archinstall/pull/3396#issuecomment-2996862019
|
||||
# the systemd_version check can be removed once `--variables=BOOL` is merged into systemd.
|
||||
if pacman_q_systemd := self.pacman.run('-Q systemd').trace_log:
|
||||
systemd_version = int(pacman_q_systemd.split(b' ')[1][:3].decode())
|
||||
else:
|
||||
systemd_version = 257 # This works as a safety workaround for this hot-fix
|
||||
systemd_pkg = installed_package('systemd')
|
||||
|
||||
# keep the version as a str as it can be something like 257.8-2
|
||||
if systemd_pkg is not None:
|
||||
systemd_version = systemd_pkg.version
|
||||
else:
|
||||
systemd_version = '257' # This works as a safety workaround for this hot-fix
|
||||
|
||||
# Install the boot loader
|
||||
try:
|
||||
# Force EFI variables since bootctl detects arch-chroot
|
||||
# as a container environemnt since v257 and skips them silently.
|
||||
# https://github.com/systemd/systemd/issues/36174
|
||||
if systemd_version >= 258:
|
||||
if systemd_version >= '258':
|
||||
SysCommand(f'arch-chroot {self.target} bootctl --variables=yes {" ".join(bootctl_options)} install')
|
||||
else:
|
||||
SysCommand(f'arch-chroot {self.target} bootctl {" ".join(bootctl_options)} install')
|
||||
except SysCallError:
|
||||
if systemd_version >= 258:
|
||||
if systemd_version >= '258':
|
||||
# Fallback, try creating the boot loader without touching the EFI variables
|
||||
SysCommand(f'arch-chroot {self.target} bootctl --variables=no {" ".join(bootctl_options)} install')
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -103,27 +103,12 @@ class PackageSearch:
|
|||
|
||||
class LocalPackage(BaseModel):
|
||||
name: str
|
||||
repository: str
|
||||
version: str
|
||||
description: str
|
||||
architecture: str
|
||||
url: str
|
||||
licenses: str
|
||||
groups: str
|
||||
depends_on: str
|
||||
optional_deps: str
|
||||
required_by: str
|
||||
optional_for: str
|
||||
conflicts_with: str
|
||||
replaces: str
|
||||
installed_size: str
|
||||
packager: str
|
||||
build_date: str
|
||||
install_date: str
|
||||
install_reason: str
|
||||
install_script: str
|
||||
validated_by: str
|
||||
provides: str
|
||||
|
||||
@override
|
||||
def __eq__(self, other: object) -> bool:
|
||||
|
|
|
|||
|
|
@ -106,7 +106,10 @@ def validate_package_list(packages: list[str]) -> tuple[list[str], list[str]]:
|
|||
|
||||
def installed_package(package: str) -> LocalPackage | None:
|
||||
try:
|
||||
package_info = Pacman.run(f'-Q --info {package}').decode().split('\n')
|
||||
package_info = []
|
||||
for line in Pacman.run(f'-Q --info {package}'):
|
||||
package_info.append(line.decode().strip())
|
||||
|
||||
return _parse_package_output(package_info, LocalPackage)
|
||||
except SysCallError:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in New Issue