]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
debian: load skeletons after running debootstrap
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Fri, 22 Apr 2022 15:09:15 +0000 (17:09 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 25 Apr 2022 13:05:15 +0000 (15:05 +0200)
Right now mkosi.skeleton cannot be used for dpkg-based distributions, since
debootstrap will not work on a non-empty target. This adds a parameter to
install_skeleton_trees to hack around this for Debian and Ubuntu, so that the
call before install_distribution is skipped and we only add skeletons before
invoking apt again after doing the initial debootstrap.

mkosi/__init__.py

index 3245e49cb8e00c86f7e45f955bd741f7cee99484..35b9bf858c5314a4b0d8217cab01dde964064a48 100644 (file)
@@ -2811,6 +2811,8 @@ def install_debian_or_ubuntu(args: MkosiArgs, root: Path, *, do_run_build_script
 
         root.joinpath(f"etc/apt/sources.list.d/{args.release}-security.list").write_text(f"{security}\n")
 
+    install_skeleton_trees(args, root, False, late=True)
+
     invoke_apt(args, do_run_build_script, root, "update", [])
     invoke_apt(args, do_run_build_script, root, "install", ["--no-install-recommends", *extra_packages])
 
@@ -3558,13 +3560,16 @@ def install_extra_trees(args: MkosiArgs, root: Path, for_cache: bool) -> None:
                 shutil.unpack_archive(cast(str, tree), root)
 
 
-def install_skeleton_trees(args: MkosiArgs, root: Path, cached: bool) -> None:
+def install_skeleton_trees(args: MkosiArgs, root: Path, cached: bool, *, late: bool=False) -> None:
     if not args.skeleton_trees:
         return
 
     if cached:
         return
 
+    if not late and args.distribution in (Distribution.debian, Distribution.ubuntu):
+        return
+
     with complete_step("Copying in skeleton file trees…"):
         for tree in args.skeleton_trees:
             if tree.is_dir():