Compare commits

...
Sign in to create a new pull request.

3 commits

4 changed files with 10 additions and 7 deletions

View file

@ -123,7 +123,11 @@ class Chroot(AbstractChroot):
active_previously = self.active
self.deactivate(fail_if_inactive=False, ignore_rootfs=True)
if not (os.path.ismount(self.path) or check_findmnt(self.path)):
makedir(os.path.dirname(self.path))
root_makedir(self.path)
logging.debug(f"Bind-mounting {self.name} ({self.uuid}) over itself") # needed for pacman space calculation
self.mount(self.path, '/', options=['rbind'])
self.create_rootfs(reset, pacman_conf_target, active_previously)
def get_path(self, *joins: str) -> str:

View file

@ -2,12 +2,11 @@ import logging
import os
from glob import glob
from shutil import rmtree
from typing import ClassVar
from constants import Arch
from exec.cmd import run_root_cmd
from exec.file import makedir, root_makedir
from exec.file import makedir, remove_file, root_makedir
from config.state import config
from .abstract import Chroot, get_chroot
@ -19,10 +18,10 @@ class BaseChroot(Chroot):
_copy_base: ClassVar[bool] = False
def create_rootfs(self, reset, pacman_conf_target, active_previously):
if reset:
if reset and os.path.exists(self.path):
logging.info(f'Resetting {self.name}')
for dir in glob(os.path.join(self.path, '*')):
rmtree(dir)
remove_file(dir, recursive=True)
makedir(config.get_path('chroots'))
root_makedir(self.get_path())

View file

@ -42,7 +42,7 @@ class DeviceChroot(BuildChroot):
really_active.append(mnt)
if really_active:
raise Exception(f'{self.name}: Chroot has submounts active: {really_active}')
if os.path.ismount(self.path):
if os.path.ismount(self.path) or check_findmnt(self.path):
raise Exception(f'{self.name}: There is already something mounted at {self.path}, not mounting over it.')
if os.path.exists(os.path.join(self.path, 'usr/bin')):
raise Exception(f'{self.name}: {self.path}/usr/bin exists, not mounting over existing rootfs.')

View file

@ -31,7 +31,7 @@ CONFIG_DEFAULTS_DICT = {
},
'pacman': {
'parallel_downloads': 4,
'check_space': False, # TODO: investigate why True causes issues
'check_space': True,
'repo_branch': DEFAULT_PACKAGE_BRANCH,
},
'paths': {