meson: allow systemd sysusersdir to be changed

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 <mprivozn@redhat.com>
Reported-by: Yaakov Selkowitz <yselkowi@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-06-06 12:57:08 +01:00
parent 6759137f72
commit f2828880b6
4 changed files with 8 additions and 1 deletions

View File

@ -1326,6 +1326,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
-Drunstatedir=%{_rundir} \ -Drunstatedir=%{_rundir} \
-Dinitconfdir=%{_sysconfdir}/sysconfig \ -Dinitconfdir=%{_sysconfdir}/sysconfig \
-Dunitdir=%{_unitdir} \ -Dunitdir=%{_unitdir} \
-Dsysusersdir=%{_sysusersdir} \
%{?arg_qemu} \ %{?arg_qemu} \
%{?arg_openvz} \ %{?arg_openvz} \
%{?arg_lxc} \ %{?arg_lxc} \

View File

@ -100,6 +100,11 @@ if unitdir == ''
unitdir = prefix / 'lib' / 'systemd' / 'system' unitdir = prefix / 'lib' / 'systemd' / 'system'
endif endif
sysusersdir = getoption('sysusersdir')
if sysusersdir == ''
sysusersdir = prefix / 'lib' / 'sysusers.d'
endif
bindir = prefix / get_option('bindir') bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir') datadir = prefix / get_option('datadir')
includedir = prefix / get_option('includedir') includedir = prefix / get_option('includedir')

View File

@ -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('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('initconfdir', type: 'string', value: '', description: 'directory for init script configuration files')
option('unitdir', type: 'string', value: '', description: 'directory for systemd unit files') option('unitdir', type: 'string', value: '', description: 'directory for systemd unit files')
option('sysusersdir', type: 'string', value: '', description: 'directory for sysusers files')
# dep:tests # dep:tests
option('expensive_tests', type: 'feature', value: 'auto', description: 'set the default for enabling expensive tests (long timeouts)') 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') option('test_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation')

View File

@ -163,7 +163,7 @@ if conf.has('WITH_QEMU')
# Install the sysuser config for the qemu driver # Install the sysuser config for the qemu driver
install_data( install_data(
'libvirt-qemu.sysusers.conf', 'libvirt-qemu.sysusers.conf',
install_dir: prefix / 'lib' / 'sysusers.d', install_dir: sysusersdir,
rename: [ 'libvirt-qemu.conf' ], rename: [ 'libvirt-qemu.conf' ],
) )