chroot/*: use exec.run_(root_)cmd

This commit is contained in:
InsanePrawn 2022-08-15 06:32:43 +02:00
parent 0465d1035a
commit 6593471a8e
2 changed files with 4 additions and 3 deletions

View file

@ -1,11 +1,11 @@
import logging
import os
import subprocess
from glob import glob
from shutil import rmtree
from constants import Arch
from exec import run_root_cmd
from .abstract import Chroot, get_chroot
from .helpers import base_chroot_name
@ -26,7 +26,7 @@ class BaseChroot(Chroot):
logging.info(f'Pacstrapping chroot {self.name}: {", ".join(self.base_packages)}')
result = subprocess.run([
result = run_root_cmd([
'pacstrap',
'-C',
pacman_conf_target,

View file

@ -7,6 +7,7 @@ from typing import Optional
from config import config
from constants import Arch, GCC_HOSTSPECS, CROSSDIRECT_PKGS, CHROOT_PATHS
from distro.distro import get_kupfer_local
from exec import run_root_cmd
from .abstract import Chroot, get_chroot
from .helpers import build_chroot_name
@ -29,7 +30,7 @@ class BuildChroot(Chroot):
cmd += ['--exclude', mountpoint.rstrip('/')]
cmd += [f'{base_chroot.path}/', f'{self.path}/']
logging.debug(f"running rsync: {cmd}")
result = subprocess.run(cmd)
result = run_root_cmd(cmd)
if result.returncode != 0:
raise Exception(f'Failed to copy {base_chroot.name} to {self.name}')