forked from Mirror/pmbootstrap
core: chroot: add .exists() method (MR 2252)
Add a method to determine if a chroot exists. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
e49fb064b5
commit
7d98605a92
3 changed files with 6 additions and 2 deletions
|
@ -115,7 +115,7 @@ def init(chroot: Chroot, usr_merge=UsrMerge.AUTO):
|
|||
|
||||
pmb.chroot.mount(chroot)
|
||||
mark_in_chroot(chroot)
|
||||
if (chroot / "bin/sh").is_symlink():
|
||||
if chroot.exists():
|
||||
pmb.config.workdir.chroot_check_channel(chroot)
|
||||
copy_resolv_conf(chroot)
|
||||
pmb.chroot.apk.update_repository_list(chroot)
|
||||
|
|
|
@ -159,7 +159,7 @@ def zap_pkgs_online_mismatch(confirm=True, dry=False):
|
|||
# Skip if chroot does not exist
|
||||
# FIXME: should we init the buildroot to do it anyway?
|
||||
# what if we run apk.static with --arch instead?
|
||||
if not chroot.path.is_dir():
|
||||
if not chroot.exists():
|
||||
continue
|
||||
|
||||
# Clean the cache with apk
|
||||
|
|
|
@ -74,6 +74,10 @@ class Chroot:
|
|||
return Path(get_context().config.work, self.dirname)
|
||||
|
||||
|
||||
def exists(self) -> bool:
|
||||
return (self / "bin/sh").is_symlink()
|
||||
|
||||
|
||||
@property
|
||||
def arch(self) -> Arch:
|
||||
if self.type == ChrootType.NATIVE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue