From 7da78a3102dce586b571a3ea5719a518c1dc42b1 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Wed, 28 Feb 2024 21:19:59 +0100 Subject: [PATCH] Use systemd-tmpfiles for var dirs when on systemd Putting packages files in /var prevent makes new install start with an already populated /var, which prevent taking advantage of the systemd provided tmpfiles.d/var.conf, which notably has this line: q /var 0755 - - - -> on supported filesystems (currently that means btrfs), this creates /var as a subvolume, which has the benefit of excluding it from / snapshots. On non-systemd system, the `meson install` behavior stays the same, /var/lib/pacman and /var/cache/pacman/pkg are included in DESTDIR. Signed-off-by: Max Gautier --- meson.build | 17 ++++++++++++++--- tmpfiles.conf | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tmpfiles.conf diff --git a/meson.build b/meson.build index 84154bc2..c3779a47 100644 --- a/meson.build +++ b/meson.build @@ -445,9 +445,20 @@ install_data( 'proto/proto.install', install_dir : join_paths(DATAROOTDIR, 'pacman')) -foreach path : [ - join_paths(LOCALSTATEDIR, 'lib/pacman/'), - join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/'), +systemd = dependency('systemd', required: false) +if systemd.found() + install_data('tmpfiles.conf', + rename: 'pacman.conf', + install_dir: systemd.get_variable(pkgconfig: 'tmpfilesdir')) + var_paths = [] +else + var_paths = [ + join_paths(LOCALSTATEDIR, 'lib/pacman/'), + join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/'), + ] +endif + +foreach path : var_paths + [ join_paths(DATAROOTDIR, 'makepkg-template/'), join_paths(DATAROOTDIR, 'libalpm/hooks/'), ] diff --git a/tmpfiles.conf b/tmpfiles.conf new file mode 100644 index 00000000..bdad4fab --- /dev/null +++ b/tmpfiles.conf @@ -0,0 +1,4 @@ +# Setup pacman data and cache directories + +d %S/pacman +d %C/pacman/pkg