fix: use bare tool names inside chroot (_tool_chroot), not host bundled paths
This commit is contained in:
@@ -36,7 +36,7 @@ class Alpine(Distro):
|
||||
def install_packages(self, rootfs: Path, packages: list[str]) -> None:
|
||||
if not packages:
|
||||
return
|
||||
self._run_chroot(rootfs, [self._tool("apk"), "add", *packages])
|
||||
self._run_chroot(rootfs, [self._tool_chroot("apk"), "add", *packages])
|
||||
|
||||
def configure_base(self, rootfs: Path, config: dict) -> None:
|
||||
hostname = config.get("hostname", "euri")
|
||||
|
||||
@@ -27,7 +27,7 @@ class Arch(Distro):
|
||||
self._run(cmd)
|
||||
|
||||
def install_packages(self, rootfs: Path, packages: list[str]) -> None:
|
||||
pm = self._tool("pacman")
|
||||
pm = self._tool_chroot("pacman")
|
||||
self._run_chroot(rootfs, [pm, "-Syu", "--noconfirm", *packages])
|
||||
|
||||
def configure_base(self, rootfs: Path, config: dict) -> None:
|
||||
@@ -70,7 +70,7 @@ class Arch(Distro):
|
||||
|
||||
def install_bootloader(self, rootfs: Path, config: dict) -> None:
|
||||
init = config.get("init", "dinit")
|
||||
pm = self._tool("pacman")
|
||||
pm = self._tool_chroot("pacman")
|
||||
self._run_chroot(rootfs, [pm, "-S", "--noconfirm", "grub", "efibootmgr", "os-prober"])
|
||||
self._run_chroot(rootfs, ["grub-install", "--target=i386-pc", "/dev/sda"])
|
||||
self._run_chroot(rootfs, ["grub-install", "--target=x86_64-efi", "--efi-directory=/boot/efi", "--bootloader-id=grub"])
|
||||
|
||||
@@ -54,6 +54,11 @@ class Distro(ABC):
|
||||
return path
|
||||
return name
|
||||
|
||||
@staticmethod
|
||||
def _tool_chroot(name: str) -> str:
|
||||
"""Return bare command name for use inside chroot (system PATH)."""
|
||||
return name
|
||||
|
||||
@staticmethod
|
||||
def _run(cmd: list[str], **kw) -> subprocess.CompletedProcess:
|
||||
import os
|
||||
|
||||
@@ -38,7 +38,7 @@ class Fedora(Distro):
|
||||
def install_packages(self, rootfs: Path, packages: list[str]) -> None:
|
||||
if not packages:
|
||||
return
|
||||
self._run_chroot(rootfs, [self._tool("dnf5"), "-y", "install", *packages])
|
||||
self._run_chroot(rootfs, [self._tool_chroot("dnf5"), "-y", "install", *packages])
|
||||
|
||||
def configure_base(self, rootfs: Path, config: dict) -> None:
|
||||
hostname = config.get("hostname", "euri")
|
||||
|
||||
@@ -38,12 +38,12 @@ class Void(Distro):
|
||||
|
||||
# remove runit if we're using dinit
|
||||
if init == "dinit":
|
||||
self._run_chroot(rootfs, [self._tool("xbps-remove"), "-y", "runit"])
|
||||
self._run_chroot(rootfs, [self._tool_chroot("xbps-remove"), "-y", "runit"])
|
||||
|
||||
def install_packages(self, rootfs: Path, packages: list[str]) -> None:
|
||||
if not packages:
|
||||
return
|
||||
self._run_chroot(rootfs, [self._tool("xbps-install"), "-Sy", *packages])
|
||||
self._run_chroot(rootfs, [self._tool_chroot("xbps-install"), "-Sy", *packages])
|
||||
|
||||
def configure_base(self, rootfs: Path, config: dict) -> None:
|
||||
hostname = config.get("hostname", "euri")
|
||||
@@ -79,7 +79,7 @@ class Void(Distro):
|
||||
def install_bootloader(self, rootfs: Path, config: dict) -> None:
|
||||
libc = config.get("libc", "musl")
|
||||
pkgs = ["grub", "grub-x86_64-efi", "efibootmgr"]
|
||||
self._run_chroot(rootfs, [self._tool("xbps-install"), "-Sy", *pkgs])
|
||||
self._run_chroot(rootfs, [self._tool_chroot("xbps-install"), "-Sy", *pkgs])
|
||||
self._run_chroot(rootfs, ["grub-install", "--target=i386-pc", "/dev/sda"])
|
||||
self._run_chroot(rootfs, ["grub-install", "--target=x86_64-efi", "--efi-directory=/boot/efi", "--bootloader-id=Void"])
|
||||
self._run_chroot(rootfs, ["grub-mkconfig", "-o", "/boot/grub/grub.cfg"])
|
||||
|
||||
Reference in New Issue
Block a user