chroot: add chroot.mount_chroots() to mount /chroot and use in cmd_chroot()

This commit is contained in:
InsanePrawn 2022-08-29 00:53:09 +02:00
parent d3e2224b02
commit c0fd1f51b5
2 changed files with 11 additions and 1 deletions

View file

@ -50,11 +50,14 @@ def cmd_chroot(type: str = 'build', arch: str = None, enable_crossdirect=True):
build_chroot.initialize() build_chroot.initialize()
build_chroot.initialized = True build_chroot.initialized = True
build_chroot.mount_pkgbuilds() build_chroot.mount_pkgbuilds()
if config.file.build.crossdirect and enable_crossdirect: build_chroot.mount_chroots()
assert arch and config.runtime.arch
if config.file.build.crossdirect and enable_crossdirect and arch != config.runtime.arch:
build_chroot.mount_crossdirect() build_chroot.mount_crossdirect()
else: else:
raise Exception('Really weird bug') raise Exception('Really weird bug')
chroot.mount_packages()
chroot.activate() chroot.activate()
logging.debug(f'Starting shell in {chroot.name}:') logging.debug(f'Starting shell in {chroot.name}:')
chroot.run_cmd('bash', attach_tty=True) chroot.run_cmd('bash', attach_tty=True)

View file

@ -273,6 +273,13 @@ class Chroot(AbstractChroot):
fail_if_mounted=fail_if_mounted, fail_if_mounted=fail_if_mounted,
) )
def mount_chroots(self, fail_if_mounted: bool = False) -> str:
return self.mount(
absolute_source=config.get_path('chroots'),
relative_destination=CHROOT_PATHS['chroots'].lstrip('/'),
fail_if_mounted=fail_if_mounted,
)
def write_makepkg_conf(self, target_arch: Arch, cross_chroot_relative: Optional[str], cross: bool = True) -> str: def write_makepkg_conf(self, target_arch: Arch, cross_chroot_relative: Optional[str], cross: bool = True) -> str:
""" """
Generate a `makepkg.conf` or `makepkg_cross_$arch.conf` file in /etc. Generate a `makepkg.conf` or `makepkg_cross_$arch.conf` file in /etc.