chroot/: make devicechroot pacstrap work without docker wrapper

This commit is contained in:
InsanePrawn 2022-08-16 02:14:56 +02:00
parent 707c61f026
commit 25ea4afe9b
2 changed files with 31 additions and 5 deletions

View file

@ -1,11 +1,14 @@
import atexit
import os
from typing import Optional
from tempfile import mktemp
from config import config
from constants import Arch, BASE_PACKAGES
from distro.distro import get_kupfer_local, get_kupfer_https
from exec.file import makedir, root_makedir
from utils import check_findmnt
from typing import Optional
from .base import BaseChroot
from .build import BuildChroot
@ -19,6 +22,14 @@ class DeviceChroot(BuildChroot):
def create_rootfs(self, reset, pacman_conf_target, active_previously):
clss = BuildChroot if self.copy_base else BaseChroot
makedir(config.get_path('chroots'))
root_makedir(self.get_path())
if not self.copy_base:
name = mktemp()
pacman_conf_target = name
self.write_pacman_conf(in_chroot=False, absolute_path=pacman_conf_target)
atexit.register(os.unlink, pacman_conf_target)
clss.create_rootfs(self, reset, pacman_conf_target, active_previously)
def mount_rootfs(self, source_path: str, fs_type: str = None, options: list[str] = [], allow_overlay: bool = False):