]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Rename various "root" arguments to "tools"
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 16 Jul 2023 15:56:25 +0000 (17:56 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 16 Jul 2023 16:03:06 +0000 (18:03 +0200)
"tools" is more descriptive than "root" about indicating that we're
passing a tree of tools.

mkosi/__init__.py
mkosi/btrfs.py
mkosi/distributions/arch.py
mkosi/distributions/debian.py
mkosi/distributions/fedora.py
mkosi/distributions/gentoo.py
mkosi/distributions/opensuse.py
mkosi/install.py
mkosi/manifest.py
mkosi/qemu.py
mkosi/run.py

index 3a87a84385e0ecd9c162bb5df20674e2459f6b84..9cc3d3100e05c56729609ed4c4c2fc46c410f308 100644 (file)
@@ -361,7 +361,7 @@ def run_finalize_script(state: MkosiState) -> None:
 
     with complete_step("Running finalize script…"):
         bwrap([state.config.finalize_script],
-              root=state.config.tools_tree,
+              tools=state.config.tools_tree,
               env={**state.environment, "BUILDROOT": str(state.root), "OUTPUTDIR": str(state.staging)})
 
 
@@ -373,7 +373,7 @@ def certificate_common_name(state: MkosiState, certificate: Path) -> str:
         "-subject",
         "-nameopt", "multiline",
         "-in", certificate,
-    ], root=state.config.tools_tree, stdout=subprocess.PIPE).stdout
+    ], tools=state.config.tools_tree, stdout=subprocess.PIPE).stdout
 
     for line in output.splitlines():
         if not line.strip().startswith("commonName"):
@@ -411,14 +411,14 @@ def pesign_prepare(state: MkosiState) -> None:
            "-out", state.workspace / "secure-boot.p12",
            "-inkey", state.config.secure_boot_key,
            "-in", state.config.secure_boot_certificate],
-          root=state.config.tools_tree)
+          tools=state.config.tools_tree)
 
     bwrap(["pk12util",
            "-K", "",
            "-W", "",
            "-i", state.workspace / "secure-boot.p12",
            "-d", state.workspace / "pesign"],
-          root=state.config.tools_tree)
+          tools=state.config.tools_tree)
 
 
 def install_boot_loader(state: MkosiState) -> None:
@@ -459,7 +459,7 @@ def install_boot_loader(state: MkosiState) -> None:
                            "--cert", state.config.secure_boot_certificate,
                            "--output", output,
                            input],
-                          root=state.config.tools_tree)
+                          tools=state.config.tools_tree)
                 elif (state.config.secure_boot_sign_tool == SecureBootSignTool.pesign or
                       state.config.secure_boot_sign_tool == SecureBootSignTool.auto and
                       shutil.which("pesign") is not None):
@@ -471,13 +471,13 @@ def install_boot_loader(state: MkosiState) -> None:
                            "--force",
                            "--in", input,
                            "--out", output],
-                          root=state.config.tools_tree)
+                          tools=state.config.tools_tree)
                 else:
                     die("One of sbsign or pesign is required to use SecureBoot=")
 
     with complete_step("Installing boot loader…"):
         bwrap(["bootctl", "install", "--root", state.root, "--all-architectures"],
-              env={"SYSTEMD_ESP_PATH": "/efi"}, root=state.config.tools_tree)
+              env={"SYSTEMD_ESP_PATH": "/efi"}, tools=state.config.tools_tree)
 
     if state.config.secure_boot:
         assert state.config.secure_boot_key
@@ -493,13 +493,13 @@ def install_boot_loader(state: MkosiState) -> None:
                    "-outform", "DER",
                    "-in", state.config.secure_boot_certificate,
                    "-out", state.workspace / "mkosi.der"],
-                  root=state.config.tools_tree)
+                  tools=state.config.tools_tree)
             bwrap(["sbsiglist",
                    "--owner", str(uuid.uuid4()),
                    "--type", "x509",
                    "--output", state.workspace / "mkosi.esl",
                    state.workspace / "mkosi.der"],
-                  root=state.config.tools_tree)
+                  tools=state.config.tools_tree)
 
             # We reuse the key for all secure boot databases to keep things simple.
             for db in ["PK", "KEK", "db"]:
@@ -511,7 +511,7 @@ def install_boot_loader(state: MkosiState) -> None:
                        "--output", keys / f"{db}.auth",
                        db,
                        state.workspace / "mkosi.esl"],
-                      root=state.config.tools_tree)
+                      tools=state.config.tools_tree)
 
 
 def install_base_trees(state: MkosiState) -> None:
@@ -526,7 +526,7 @@ def install_base_trees(state: MkosiState) -> None:
                 shutil.unpack_archive(path, state.root)
             elif path.suffix == ".raw":
                 bwrap(["systemd-dissect", "--copy-from", path, "/", state.root],
-                      root=state.config.tools_tree)
+                      tools=state.config.tools_tree)
             else:
                 die(f"Unsupported base tree source {path}")
 
@@ -544,7 +544,7 @@ def install_skeleton_trees(state: MkosiState) -> None:
             t.parent.mkdir(mode=0o755, parents=True, exist_ok=True)
 
             if source.is_dir() or target:
-                copy_path(source, t, preserve_owner=False, root=state.config.tools_tree)
+                copy_path(source, t, preserve_owner=False, tools=state.config.tools_tree)
             else:
                 shutil.unpack_archive(source, t)
 
@@ -562,7 +562,7 @@ def install_package_manager_trees(state: MkosiState) -> None:
             t.parent.mkdir(mode=0o755, parents=True, exist_ok=True)
 
             if source.is_dir() or target:
-                copy_path(source, t, preserve_owner=False, root=state.config.tools_tree)
+                copy_path(source, t, preserve_owner=False, tools=state.config.tools_tree)
             else:
                 shutil.unpack_archive(source, t)
 
@@ -580,7 +580,7 @@ def install_extra_trees(state: MkosiState) -> None:
             t.parent.mkdir(mode=0o755, parents=True, exist_ok=True)
 
             if source.is_dir() or target:
-                copy_path(source, t, preserve_owner=False, root=state.config.tools_tree)
+                copy_path(source, t, preserve_owner=False, tools=state.config.tools_tree)
             else:
                 shutil.unpack_archive(source, t)
 
@@ -590,7 +590,7 @@ def install_build_dest(state: MkosiState) -> None:
         return
 
     with complete_step("Copying in build tree…"):
-        copy_path(state.install_dir, state.root, root=state.config.tools_tree)
+        copy_path(state.install_dir, state.root, tools=state.config.tools_tree)
 
 
 def gzip_binary() -> str:
@@ -623,7 +623,7 @@ def make_tar(state: MkosiState) -> None:
     ]
 
     with complete_step("Creating archive…"):
-        bwrap(cmd, root=state.config.tools_tree)
+        bwrap(cmd, tools=state.config.tools_tree)
 
 
 def find_files(dir: Path, root: Path) -> Iterator[Path]:
@@ -640,7 +640,7 @@ def make_initrd(state: MkosiState) -> None:
 
 
 def make_cpio(state: MkosiState, files: Iterator[Path], output: Path) -> None:
-    with complete_step(f"Creating cpio {output}…"), bwrap_cmd(root=state.config.tools_tree) as bwrap:
+    with complete_step(f"Creating cpio {output}…"), bwrap_cmd(tools=state.config.tools_tree) as bwrap:
         cmd: list[PathString] = [
             *bwrap,
             "cpio",
@@ -732,7 +732,7 @@ def resolve_module_dependencies(state: MkosiState, kver: str, modules: Sequence[
     # modinfo and it'll process them all in a single go. We get the modinfo for all modules to build two maps
     # that map the path of the module to its module dependencies and its firmware dependencies respectively.
     info = bwrap(["modinfo", "--basedir", state.root, "--set-version", kver, "--null", *nametofile.keys(), *builtin],
-                 stdout=subprocess.PIPE, root=state.config.tools_tree).stdout
+                 stdout=subprocess.PIPE, tools=state.config.tools_tree).stdout
 
     moddep = {}
     firmwaredep = {}
@@ -994,7 +994,7 @@ def install_unified_kernel(state: MkosiState, roothash: Optional[str]) -> None:
             if state.config.kernel_modules_initrd:
                 cmd += [gen_kernel_modules_initrd(state, kver)]
 
-            bwrap(cmd, root=state.config.tools_tree)
+            bwrap(cmd, tools=state.config.tools_tree)
 
             if not state.staging.joinpath(state.config.output_split_uki).exists():
                 shutil.copy(boot_binary, state.staging / state.config.output_split_uki)
@@ -1033,7 +1033,7 @@ def maybe_compress(state: MkosiState, compression: Compression, src: Path, dst:
 
             with dst.open("wb") as o:
                 bwrap(compressor_command(compression), user=state.uid, group=state.gid, stdin=i, stdout=o,
-                      root=state.config.tools_tree)
+                      tools=state.config.tools_tree)
 
 
 def copy_nspawn_settings(state: MkosiState) -> None:
@@ -1100,7 +1100,7 @@ def calculate_signature(state: MkosiState) -> None:
                     Path(os.environ['HOME']).joinpath('.gnupg')
                 )
             },
-            root=state.config.tools_tree,
+            tools=state.config.tools_tree,
         )
 
 
@@ -1510,23 +1510,23 @@ def run_depmod(state: MkosiState) -> None:
         process_kernel_modules(state, kver)
 
         with complete_step(f"Running depmod for {kver}"):
-            bwrap(["depmod", "--all", "--basedir", state.root, kver], root=state.config.tools_tree)
+            bwrap(["depmod", "--all", "--basedir", state.root, kver], tools=state.config.tools_tree)
 
 
 def run_sysusers(state: MkosiState) -> None:
     with complete_step("Generating system users"):
-        bwrap(["systemd-sysusers", "--root", state.root], root=state.config.tools_tree)
+        bwrap(["systemd-sysusers", "--root", state.root], tools=state.config.tools_tree)
 
 
 def run_preset(state: MkosiState) -> None:
     with complete_step("Applying presets…"):
-        bwrap(["systemctl", "--root", state.root, "preset-all"], root=state.config.tools_tree)
+        bwrap(["systemctl", "--root", state.root, "preset-all"], tools=state.config.tools_tree)
 
 
 def run_hwdb(state: MkosiState) -> None:
     with complete_step("Generating hardware database"):
         bwrap(["systemd-hwdb", "--root", state.root, "--usr", "--strict", "update"],
-              root=state.config.tools_tree)
+              tools=state.config.tools_tree)
 
 
 def run_firstboot(state: MkosiState) -> None:
@@ -1561,7 +1561,7 @@ def run_firstboot(state: MkosiState) -> None:
 
     with complete_step("Applying first boot settings"):
         bwrap(["systemd-firstboot", "--root", state.root, "--force", *options],
-              root=state.config.tools_tree)
+              tools=state.config.tools_tree)
 
         # Initrds generally don't ship with only /usr so there's not much point in putting the credentials in
         # /usr/lib/credstore.
@@ -1581,7 +1581,7 @@ def run_selinux_relabel(state: MkosiState) -> None:
         return
 
     policy = bwrap(["sh", "-c", f". {selinux} && echo $SELINUXTYPE"],
-                   stdout=subprocess.PIPE, root=state.config.tools_tree).stdout.strip()
+                   stdout=subprocess.PIPE, tools=state.config.tools_tree).stdout.strip()
     if not policy:
         return
 
@@ -1730,7 +1730,7 @@ def make_image(state: MkosiState, skip: Sequence[str] = [], split: bool = False)
 
     with complete_step("Generating disk image"):
         output = json.loads(bwrap(cmdline, stdout=subprocess.PIPE, env=env,
-                                  root=state.config.tools_tree).stdout)
+                                  tools=state.config.tools_tree).stdout)
 
     roothash = usrhash = None
     for p in output:
@@ -1899,7 +1899,7 @@ def setfacl(config: MkosiConfig, root: Path, uid: int, allow: bool) -> None:
            "--modify" if allow else "--remove",
            f"user:{uid}:rwx" if allow else f"user:{uid}",
            "-"],
-           root=config.tools_tree,
+           tools=config.tools_tree,
            # Supply files via stdin so we don't clutter --debug run output too much
            input="\n".join([str(root),
                            *(e.path for e in cast(Iterator[os.DirEntry[str]], scandir_recursive(root)) if e.is_dir())])
@@ -1917,7 +1917,7 @@ def acl_maybe_toggle(config: MkosiConfig, root: Path, uid: int, *, always: bool)
         has_acl = f"user:{uid}:rwx" in bwrap([
             "getfacl", "-n", root.relative_to(Path.cwd())],
             stdout=subprocess.PIPE,
-            root=config.tools_tree,
+            tools=config.tools_tree,
         ).stdout
 
         if not has_acl and not always:
@@ -2013,7 +2013,7 @@ def run_shell(args: MkosiArgs, config: MkosiConfig) -> None:
                    "--dry-run=no",
                    "--offline=no",
                    fname],
-                  root=config.tools_tree)
+                  tools=config.tools_tree)
 
         if config.output_format == OutputFormat.directory:
             cmdline += ["--directory", fname]
@@ -2042,7 +2042,7 @@ def run_shell(args: MkosiArgs, config: MkosiConfig) -> None:
               stdout=sys.stdout,
               env=os.environ,
               log=False,
-              root=config.tools_tree)
+              tools=config.tools_tree)
 
 
 def run_ssh(args: MkosiArgs, config: MkosiConfig) -> None:
@@ -2058,7 +2058,7 @@ def run_ssh(args: MkosiArgs, config: MkosiConfig) -> None:
 
     cmd += args.cmdline
 
-    bwrap(cmd, stdin=sys.stdin, stdout=sys.stdout, env=os.environ, log=False, root=config.tools_tree)
+    bwrap(cmd, stdin=sys.stdin, stdout=sys.stdout, env=os.environ, log=False, tools=config.tools_tree)
 
 
 def run_serve(config: MkosiConfig) -> None:
index 552a638cf95ec942b9ff2fc315042f233ef76b66..5b18a2f7a34367756785aced56640c01c1cde6c4 100644 (file)
@@ -13,7 +13,7 @@ from mkosi.run import bwrap
 
 def statfs(config: MkosiConfig, path: Path) -> str:
     return cast(str, bwrap(["stat", "--file-system", "--format", "%T", path.parent],
-                           root=config.tools_tree, stdout=subprocess.PIPE).stdout.strip())
+                           tools=config.tools_tree, stdout=subprocess.PIPE).stdout.strip())
 
 
 def btrfs_maybe_make_subvolume(config: MkosiConfig, path: Path, mode: int) -> None:
@@ -30,7 +30,7 @@ def btrfs_maybe_make_subvolume(config: MkosiConfig, path: Path, mode: int) -> No
     if config.use_subvolumes != ConfigFeature.disabled and shutil.which("btrfs") is not None:
         result = bwrap(["btrfs", "subvolume", "create", path],
                        check=config.use_subvolumes == ConfigFeature.enabled,
-                       root=config.tools_tree).returncode
+                       tools=config.tools_tree).returncode
     else:
         result = 1
 
@@ -49,7 +49,7 @@ def btrfs_maybe_snapshot_subvolume(config: MkosiConfig, src: Path, dst: Path) ->
 
     # Subvolumes always have inode 256 so we can use that to check if a directory is a subvolume.
     if not subvolume or statfs(config, src) != "btrfs" or src.stat().st_ino != 256 or (dst.exists() and any(dst.iterdir())):
-        return copy_path(src, dst, root=config.tools_tree)
+        return copy_path(src, dst, tools=config.tools_tree)
 
     # btrfs can't snapshot to an existing directory so make sure the destination does not exist.
     if dst.exists():
@@ -58,9 +58,9 @@ def btrfs_maybe_snapshot_subvolume(config: MkosiConfig, src: Path, dst: Path) ->
     if shutil.which("btrfs"):
         result = bwrap(["btrfs", "subvolume", "snapshot", src, dst],
                        check=config.use_subvolumes == ConfigFeature.enabled,
-                       root=config.tools_tree).returncode
+                       tools=config.tools_tree).returncode
     else:
         result = 1
 
     if result != 0:
-        copy_path(src, dst, root=config.tools_tree)
+        copy_path(src, dst, tools=config.tools_tree)
index e582d2f844029143de276543e57bf50d9e479347..4be0767a55760a24c69addc8bd0674422cf8f3cf 100644 (file)
@@ -136,4 +136,4 @@ def invoke_pacman(state: MkosiState, packages: Sequence[str], apivfs: bool = Tru
     bwrap(cmdline,
           apivfs=state.root if apivfs else None,
           env=dict(KERNEL_INSTALL_BYPASS="1") | state.environment,
-          root=state.config.tools_tree)
+          tools=state.config.tools_tree)
index cb196c9ba30da5efabc6335e7eae884698d2a4a6..769d194dd349c92bfacef11cc83a9ef10a7fc3d2 100644 (file)
@@ -93,9 +93,9 @@ class DebianInstaller(DistributionInstaller):
 
         for deb in essential:
             with tempfile.NamedTemporaryFile(dir=state.workspace) as f:
-                bwrap(["dpkg-deb", "--fsys-tarfile", deb], stdout=f, root=state.config.tools_tree)
+                bwrap(["dpkg-deb", "--fsys-tarfile", deb], stdout=f, tools=state.config.tools_tree)
                 bwrap(["tar", "-C", state.root, "--keep-directory-symlink", "--extract", "--file", f.name],
-                      root=state.config.tools_tree)
+                      tools=state.config.tools_tree)
 
         # Finally, run apt to properly install packages in the chroot without having to worry that maintainer
         # scripts won't find basic tools that they depend on.
@@ -247,7 +247,7 @@ def invoke_apt(
     return bwrap(["apt-get", *options, operation, *extra],
                  apivfs=state.root if apivfs else None,
                  env=env | state.environment,
-                 root=state.config.tools_tree)
+                 tools=state.config.tools_tree)
 
 
 def install_apt_sources(state: MkosiState, repos: Sequence[str]) -> None:
index f69ef195f8dd8b8c950026b59ffa9e1c3261c8eb..1b2cdea780853d1dbcf93ea60e81e6eac62f8329 100644 (file)
@@ -221,7 +221,7 @@ def invoke_dnf(
     bwrap(cmdline,
           apivfs=state.root if apivfs else None,
           env=dict(KERNEL_INSTALL_BYPASS="1") | env | state.environment,
-          root=state.config.tools_tree)
+          tools=state.config.tools_tree)
 
     fixup_rpmdb_location(state.root)
 
index 0ded5e53c3f363403e455cfe2b351371ac4572e8..fef5e0a7154061ba072cc7c339759869fe1571a7 100644 (file)
@@ -117,7 +117,7 @@ class GentooInstaller(DistributionInstaller):
             if stage3_tar.exists():
                 cmd += ["--time-cond", stage3_tar]
 
-            bwrap(cmd, root=state.config.tools_tree)
+            bwrap(cmd, tools=state.config.tools_tree)
 
             if stage3_tar.stat().st_mtime > old:
                 unlink_try_hard(stage3)
@@ -134,12 +134,12 @@ class GentooInstaller(DistributionInstaller):
                        "--exclude", "./dev/*",
                        "--exclude", "./proc/*",
                        "--exclude", "./sys/*"],
-                      root=state.config.tools_tree)
+                      tools=state.config.tools_tree)
 
         for d in ("binpkgs", "distfiles", "repos/gentoo"):
             (state.cache_dir / d).mkdir(parents=True, exist_ok=True)
 
-        copy_path(state.pkgmngr, stage3, preserve_owner=False, root=state.config.tools_tree)
+        copy_path(state.pkgmngr, stage3, preserve_owner=False, tools=state.config.tools_tree)
 
         run_workspace_command(
             stage3,
index 6e9c174994e7d92edfa644f614d5e35e32da3d79..6b4ff8a82d462a28e08a79feac9519b8d7499ef7 100644 (file)
@@ -142,7 +142,7 @@ def invoke_zypper(
     bwrap(cmdline,
           apivfs=state.root if apivfs else None,
           env=dict(ZYPP_CONF=str(state.pkgmngr / "etc/zypp/zypp.conf"), KERNEL_INSTALL_BYPASS="1") | state.environment,
-          root=state.config.tools_tree)
+          tools=state.config.tools_tree)
 
     fixup_rpmdb_location(state.root)
 
index 106c35b908315a90f064bc4a8041410acb346b51..57a0bad17474779103f81c673f6ea86bf7d35341 100644 (file)
@@ -53,7 +53,7 @@ def copy_path(
     *,
     dereference: bool = False,
     preserve_owner: bool = True,
-    root: Optional[Path] = None,
+    tools: Optional[Path] = None,
 ) -> None:
     bwrap([
         "cp",
@@ -63,4 +63,4 @@ def copy_path(
         "--no-target-directory",
         "--reflink=auto",
         src, dst,
-    ], root=root)
+    ], tools=tools)
index a0a5de1558ab41140a8ea8195b426436b3a180a3..1f5b199b38c8c8d0f3c1837e0c7d7745d55ef24a 100644 (file)
@@ -111,7 +111,7 @@ class Manifest:
                    "-qa",
                    "--qf", r"%{NEVRA}\t%{SOURCERPM}\t%{NAME}\t%{ARCH}\t%{LONGSIZE}\t%{INSTALLTIME}\n"],
                   stdout=PIPE,
-                  root=self.config.tools_tree)
+                  tools=self.config.tools_tree)
 
         packages = sorted(c.stdout.splitlines())
 
@@ -154,7 +154,7 @@ class Manifest:
                            nevra],
                           stdout=PIPE,
                           stderr=DEVNULL,
-                          root=self.config.tools_tree)
+                          tools=self.config.tools_tree)
                 changelog = c.stdout.strip()
                 source = SourcePackageManifest(srpm, changelog)
                 self.source_packages[srpm] = source
@@ -168,7 +168,7 @@ class Manifest:
                    "--showformat",
                        r'${Package}\t${source:Package}\t${Version}\t${Architecture}\t${Installed-Size}\t${db-fsys:Last-Modified}\n'],
                   stdout=PIPE,
-                  root=self.config.tools_tree)
+                  tools=self.config.tools_tree)
 
         packages = sorted(c.stdout.splitlines())
 
@@ -227,7 +227,7 @@ class Manifest:
                 # We have to run from the root, because if we use the RootDir option to make
                 # apt from the host look at the repositories in the image, it will also pick
                 # the 'methods' executables from there, but the ABI might not be compatible.
-                result = bwrap(cmd, stdout=PIPE, root=self.config.tools_tree)
+                result = bwrap(cmd, stdout=PIPE, tools=self.config.tools_tree)
                 source_package = SourcePackageManifest(source, result.stdout.strip())
                 self.source_packages[source] = source_package
 
index a4dd0bb9a6aaf6ca6e703b25c09218a730ea7db5..38d3c0a9a308a9247d8d2057137d858d67883423 100644 (file)
@@ -138,7 +138,7 @@ def find_ovmf_vars(config: MkosiConfig) -> Path:
 
 @contextlib.contextmanager
 def start_swtpm(config: MkosiConfig) -> Iterator[Optional[Path]]:
-    with tempfile.TemporaryDirectory() as state, bwrap_cmd(root=config.tools_tree) as bwrap:
+    with tempfile.TemporaryDirectory() as state, bwrap_cmd(tools=config.tools_tree) as bwrap:
         sock = Path(state) / Path("sock")
         proc = spawn([*bwrap, "swtpm", "socket", "--tpm2", "--tpmstate", f"dir={state}", "--ctrl", f"type=unixio,path={sock}"])
 
@@ -313,7 +313,7 @@ def run_qemu(args: MkosiArgs, config: MkosiConfig) -> None:
               stdout=sys.stdout,
               env=os.environ,
               log=False,
-              root=config.tools_tree)
+              tools=config.tools_tree)
 
     if status := int(notifications.get("EXIT_STATUS", 0)):
         raise subprocess.CalledProcessError(status, cmdline)
index 0643a80d615521d5a7e2fd9dc04b0803b7b0279a..76e0743727c9b850c074727c33a33acbf53e543b 100644 (file)
@@ -298,7 +298,7 @@ def spawn(
 @contextlib.contextmanager
 def bwrap_cmd(
     *,
-    root: Optional[Path] = None,
+    tools: Optional[Path] = None,
     apivfs: Optional[Path] = None,
 ) -> Iterator[list[PathString]]:
     cmdline: list[PathString] = [
@@ -306,7 +306,7 @@ def bwrap_cmd(
         "--dev-bind", "/", "/",
         "--chdir", Path.cwd(),
         "--die-with-parent",
-        "--ro-bind", (root or Path("/")) / "usr", "/usr",
+        "--ro-bind", (tools or Path("/")) / "usr", "/usr",
     ]
 
     for d in ("/etc", "/opt", "/srv", "/boot", "/efi"):
@@ -365,18 +365,18 @@ def bwrap_cmd(
 def bwrap(
     cmd: Sequence[PathString],
     *,
-    root: Optional[Path] = None,
+    tools: Optional[Path] = None,
     apivfs: Optional[Path] = None,
     env: Mapping[str, PathString] = {},
     log: bool = True,
     **kwargs: Any,
 ) -> CompletedProcess:
-    with bwrap_cmd(root=root, apivfs=apivfs) as bwrap:
-        if root:
-            # If a root is specified, we should ignore any local modifications made to PATH as any of those
-            # tools might not work anymore when /usr is replaced wholesale. We also make sure that both
-            # /usr/bin and /usr/sbin/ are searched so that e.g. if the host is Arch and the root is Debian we
-            # don't ignore the binaries from /usr/sbin in the Debian root.
+    with bwrap_cmd(tools=tools, apivfs=apivfs) as bwrap:
+        if tools:
+            # If a tools tree is specified, we should ignore any local modifications made to PATH as any of
+            # those binaries might not work anymore when /usr is replaced wholesale. We also make sure that
+            # both /usr/bin and /usr/sbin/ are searched so that e.g. if the host is Arch and the root is
+            # Debian we don't ignore the binaries from /usr/sbin in the Debian root.
             env = dict(PATH="/usr/bin:/usr/sbin") | env
 
         try: