forked from Mirror/pmbootstrap
chroot: require explicit initialisation (MR 2252)
We currently lazily initialize the chroot's on first use, plus a few bonus calls to init. However, there are some instances where we actually don't want the chroot to be initialised (mostly to break recursion loops). Simplify the codebase by removing all of this, and just calling pmb.chroot.init() where it's needed. In addition, print a warning if init() is called multiple times for one chroot. This should help us catch these instances if they crop up again. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
22f805a325
commit
1d9bbd613e
11 changed files with 21 additions and 21 deletions
|
@ -127,8 +127,7 @@ def init(args: PmbArgs, chroot: Chroot=Chroot.native(), usr_merge=UsrMerge.AUTO,
|
|||
|
||||
already_setup = str(chroot) in pmb.helpers.other.cache["pmb.chroot.init"]
|
||||
if already_setup:
|
||||
# FIXME: drop to debug/verbose later
|
||||
logging.debug(f"({chroot}) already initialised")
|
||||
logging.warning(f"({chroot}) FIXME! init() called multiple times!")
|
||||
return
|
||||
|
||||
pmb.chroot.mount(args, chroot)
|
||||
|
@ -176,7 +175,7 @@ def init(args: PmbArgs, chroot: Chroot=Chroot.native(), usr_merge=UsrMerge.AUTO,
|
|||
if not chroot.type == ChrootType.ROOTFS:
|
||||
pmb.chroot.root(args, ["adduser", "-D", "pmos", "-u",
|
||||
pmb.config.chroot_uid_user],
|
||||
chroot, auto_init=False)
|
||||
chroot)
|
||||
|
||||
# Create the links (with subfolders if necessary)
|
||||
for target, link_name in pmb.config.chroot_home_symlinks.items():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue