From f2828880b68fda5c17edeef09fc36f05d6eb6e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 6 Jun 2024 12:57:08 +0100 Subject: [PATCH] meson: allow systemd sysusersdir to be changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We currently hardcode the systemd sysusersdir, but it is desirable to be able to choose a different location in some cases. For example, Fedora flatpak builds change the RPM %_sysusersdir macro, but we can't currently honour that. Reviewed-by: Michal Privoznik Reported-by: Yaakov Selkowitz Signed-off-by: Daniel P. Berrangé --- libvirt.spec.in | 1 + meson.build | 5 +++++ meson_options.txt | 1 + src/qemu/meson.build | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 9bff6ef6db..29101e74fe 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1326,6 +1326,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Drunstatedir=%{_rundir} \ -Dinitconfdir=%{_sysconfdir}/sysconfig \ -Dunitdir=%{_unitdir} \ + -Dsysusersdir=%{_sysusersdir} \ %{?arg_qemu} \ %{?arg_openvz} \ %{?arg_lxc} \ diff --git a/meson.build b/meson.build index 295613fd93..2fc9ab3e96 100644 --- a/meson.build +++ b/meson.build @@ -100,6 +100,11 @@ if unitdir == '' unitdir = prefix / 'lib' / 'systemd' / 'system' endif +sysusersdir = getoption('sysusersdir') +if sysusersdir == '' + sysusersdir = prefix / 'lib' / 'sysusers.d' +endif + bindir = prefix / get_option('bindir') datadir = prefix / get_option('datadir') includedir = prefix / get_option('includedir') diff --git a/meson_options.txt b/meson_options.txt index a4f1dd769f..50d71427cb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,6 +5,7 @@ option('system', type: 'boolean', value: false, description: 'Set install paths option('runstatedir', type: 'string', value: '', description: 'State directory for temporary sockets, pid files, etc') option('initconfdir', type: 'string', value: '', description: 'directory for init script configuration files') option('unitdir', type: 'string', value: '', description: 'directory for systemd unit files') +option('sysusersdir', type: 'string', value: '', description: 'directory for sysusers files') # dep:tests option('expensive_tests', type: 'feature', value: 'auto', description: 'set the default for enabling expensive tests (long timeouts)') option('test_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation') diff --git a/src/qemu/meson.build b/src/qemu/meson.build index 907893d431..57356451e4 100644 --- a/src/qemu/meson.build +++ b/src/qemu/meson.build @@ -163,7 +163,7 @@ if conf.has('WITH_QEMU') # Install the sysuser config for the qemu driver install_data( 'libvirt-qemu.sysusers.conf', - install_dir: prefix / 'lib' / 'sysusers.d', + install_dir: sysusersdir, rename: [ 'libvirt-qemu.conf' ], )