From: Daan De Meyer Date: Fri, 9 Feb 2024 11:12:22 +0000 (+0100) Subject: Only bind mount /var/lib/pacman/local from image if it exists X-Git-Tag: v21~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=070528fec478fc93af7ec057a5d2fd0045123c99;p=thirdparty%2Fmkosi.git Only bind mount /var/lib/pacman/local from image if it exists When running the finalize scripts, this directory might have been cleaned up already as part of removing package manager metadata so let's make sure we don't mount it in that case. --- diff --git a/mkosi/installer/pacman.py b/mkosi/installer/pacman.py index c1906dce5..d4eaca9ec 100644 --- a/mkosi/installer/pacman.py +++ b/mkosi/installer/pacman.py @@ -41,14 +41,15 @@ class Pacman(PackageManager): def mounts(cls, context: Context) -> list[PathString]: return [ *super().mounts(context), - # pacman reuses the same directory for the sync databases and the local database containing the list of - # installed packages. The format should go in the cache directory, the latter should go in the image, so we - # bind mount the local directory from the image to make sure that happens. - "--bind", context.root / "var/lib/pacman/local", "/var/lib/pacman/local", # pacman writes downloaded packages to the first writable cache directory. We don't want it to write to our # local repository directory so we expose it as a read-only directory to pacman. "--ro-bind", context.packages, "/var/cache/pacman/mkosi", - ] + ] + ([ + # pacman reuses the same directory for the sync databases and the local database containing the list of + # installed packages. The former should go in the cache directory, the latter should go in the image, + # so we bind mount the local directory from the image to make sure that happens. + "--bind", context.root / "var/lib/pacman/local", "/var/lib/pacman/local", + ] if (context.root / "var/lib/pacman/local").exists() else []) @classmethod def setup(cls, context: Context, repositories: Iterable[Repository]) -> None: