From: Daan De Meyer Date: Mon, 10 Jun 2024 12:37:12 +0000 (+0200) Subject: Add dpkg and dpkg-query scripts X-Git-Tag: v23.1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0081ea66faf56a35353d6aeadfe42f9679c7d1cf;p=thirdparty%2Fmkosi.git Add dpkg and dpkg-query scripts --- diff --git a/mkosi/installer/apt.py b/mkosi/installer/apt.py index f782fa76d..fdf8a63d7 100644 --- a/mkosi/installer/apt.py +++ b/mkosi/installer/apt.py @@ -48,6 +48,14 @@ class Apt(PackageManager): def cache_subdirs(cls, cache: Path) -> list[Path]: return [cache / "archives"] + @classmethod + def dpkg_cmd(cls, command: str) -> list[PathString]: + return [ + command, + "--admindir=/buildroot/var/lib/dpkg", + "--root=/buildroot", + ] + @classmethod def scripts(cls, context: Context) -> dict[str, list[PathString]]: return { @@ -64,6 +72,12 @@ class Apt(PackageManager): "apt-sortpkgs", ) }, + **{ + command: apivfs_cmd() + cls.dpkg_cmd(command) for command in( + "dpkg", + "dpkg-query", + ) + }, "mkosi-install" : ["apt-get", "install"], "mkosi-upgrade" : ["apt-get", "upgrade"], "mkosi-remove" : ["apt-get", "purge"], diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index 7a12aa544..19750585a 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -2197,12 +2197,12 @@ available via `$PATH` to simplify common usecases. To execute the entire script inside the image, add a ".chroot" suffix to the name (`mkosi.build.chroot` instead of `mkosi.build`, etc.). -* For all of the supported package managers except portage (`dnf`, - `rpm`, `apt`, `pacman`, `zypper`), scripts of the same name are put - into `$PATH` that make sure these commands operate on the image's root - directory with the configuration supplied by the user instead of on - the host system. This means that from a script, you can do e.g. `dnf - install vim` to install vim into the image. +* For all of the supported package managers (`dnf`, `rpm`, `apt`, `dpkg`, + `pacman`, `zypper`), scripts of the same name are put into `$PATH` + that make sure these commands operate on the image's root directory + with the configuration supplied by the user instead of on the host + system. This means that from a script, you can do e.g. + `dnf install vim` to install vim into the image. Additionally, `mkosi-install`, `mkosi-reinstall`, `mkosi-upgrade` and `mkosi-remove` will invoke the corresponding operation of the package