Browse Source

meson: add option to skip installing to $sysconfdir

This is useful for development where overwriting files out side
the configured prefix will affect the host as well as stateless
systems such as NixOS that don't let packages install to /etc but handle
configuration on their own.

Alternative to https://github.com/systemd/systemd/pull/17501

tested with:

$ mkdir inst build && cd build
$ meson \
  -Dcreate-log-dirs=false \
  -Dsysvrcnd-path=$(realpath ../inst)/etc/rc.d \
  -Dsysvinit-path=$(realpath ../inst)/etc/init.d \
  -Drootprefix=$(realpath ../inst) \
  -Dinstall-sysconfdir=false \
  --prefix=$(realpath ../inst) ..
$ ninja install
master
Jörg Thalheim 2 years ago committed by Zbigniew Jędrzejewski-Szmek
parent
commit
d7aa78c32f
  1. 12
      hwdb.d/meson.build
  2. 25
      meson.build
  3. 2
      meson_options.txt
  4. 6
      network/meson.build
  5. 20
      src/core/meson.build
  6. 2
      src/coredump/meson.build
  7. 6
      src/home/meson.build
  8. 12
      src/journal-remote/meson.build
  9. 6
      src/journal/meson.build
  10. 23
      src/kernel-install/meson.build
  11. 6
      src/login/meson.build
  12. 6
      src/network/meson.build
  13. 6
      src/oom/meson.build
  14. 2
      src/pstore/meson.build
  15. 6
      src/resolve/meson.build
  16. 6
      src/timesync/meson.build
  17. 12
      src/udev/meson.build
  18. 6
      sysctl.d/meson.build
  19. 2
      tmpfiles.d/meson.build
  20. 8
      units/meson.build

12
hwdb.d/meson.build

@ -42,12 +42,14 @@ if conf.get('ENABLE_HWDB') == 1
hwdb_files_test,
install_dir : udevhwdbdir)
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d')))
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d')))
meson.add_install_script('sh', '-c',
'test -n "$DESTDIR" || @0@/systemd-hwdb update'
.format(rootbindir))
meson.add_install_script('sh', '-c',
'test -n "$DESTDIR" || @0@/systemd-hwdb update'
.format(rootbindir))
endif
if want_tests != 'false'
parse_hwdb_py = find_program('parse_hwdb.py')

25
meson.build

@ -126,6 +126,7 @@ if rootlibdir == ''
rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
endif
install_sysconfdir = get_option('install-sysconfdir')
# Dirs of external packages
pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir')
pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir')
@ -2776,8 +2777,10 @@ if conf.get('ENABLE_BINFMT') == 1
meson.add_install_script('sh', '-c',
mkdir_p.format(binfmtdir))
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
endif
endif
if conf.get('ENABLE_REPART') == 1
@ -2891,8 +2894,10 @@ executable(
install : true,
install_dir : rootlibexecdir)
install_data('src/sleep/sleep.conf',
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data('src/sleep/sleep.conf',
install_dir : pkgsysconfdir)
endif
public_programs += executable(
'systemd-sysctl',
@ -3243,8 +3248,10 @@ if conf.get('HAVE_KMOD') == 1
meson.add_install_script('sh', '-c',
mkdir_p.format(modulesloaddir))
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
endif
endif
public_programs += executable(
@ -3489,8 +3496,10 @@ subdir('docs/var-log')
install_subdir('factory/etc',
install_dir : factorydir)
install_data('xorg/50-systemd-user.sh',
install_dir : xinitrcdir)
if install_sysconfdir
install_data('xorg/50-systemd-user.sh',
install_dir : xinitrcdir)
endif
install_data('modprobe.d/systemd.conf',
install_dir : modprobedir)
install_data('LICENSE.GPL2',

2
meson_options.txt

@ -180,6 +180,8 @@ option('pamconfdir', type : 'string',
description : 'directory for PAM configuration ["no" disables]')
option('docdir', type : 'string',
description : 'documentation directory')
option('install-sysconfdir', type : 'boolean', value : true,
description : 'install configuration files to $sysconfdir')
option('fallback-hostname', type : 'string', value : 'localhost',
description : 'the hostname used if none configured')

6
network/meson.build

@ -10,8 +10,10 @@ if conf.get('ENABLE_NETWORKD') == 1
'80-wifi-station.network.example',
install_dir : networkdir)
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'systemd/network')))
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'systemd/network')))
endif
endif
install_data('99-default.link',

20
src/core/meson.build

@ -192,12 +192,14 @@ in_files = [['macros.systemd', rpmmacrosdir],
foreach item : in_files
file = item[0]
dir = item[1]
if install_sysconfdir or dir != pkgsysconfdir
configure_file(
input : file + '.in',
output : file,
configuration : substs,
install_dir : dir == 'no' ? '' : dir)
endif
configure_file(
input : file + '.in',
output : file,
configuration : substs,
install_dir : dir == 'no' ? '' : dir)
endforeach
install_data('org.freedesktop.systemd1.conf',
@ -217,6 +219,8 @@ meson.add_install_script('sh', '-c', mkdir_p.format(systemsleepdir))
meson.add_install_script('sh', '-c', mkdir_p.format(systemgeneratordir))
meson.add_install_script('sh', '-c', mkdir_p.format(usergeneratordir))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'system')))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user')))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd')))
if install_sysconfdir
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'system')))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user')))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd')))
endif

2
src/coredump/meson.build

@ -13,7 +13,7 @@ endif
coredumpctl_sources = files('coredumpctl.c')
if conf.get('ENABLE_COREDUMP') == 1
if conf.get('ENABLE_COREDUMP') == 1 and install_sysconfdir
install_data('coredump.conf',
install_dir : pkgsysconfdir)
endif

6
src/home/meson.build

@ -107,8 +107,10 @@ if conf.get('ENABLE_HOMED') == 1
install_data('org.freedesktop.home1.policy',
install_dir : polkitpolicydir)
install_data('homed.conf',
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data('homed.conf',
install_dir : sysconfdir)
endif
endif
tests += [

12
src/journal-remote/meson.build

@ -48,8 +48,10 @@ if conf.get('ENABLE_REMOTE') ==1 and conf.get('HAVE_LIBCURL') == 1
input : 'journal-upload.conf.in',
output : 'journal-upload.conf',
configuration : substs)
install_data(journal_upload_conf,
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data(journal_upload_conf,
install_dir : pkgsysconfdir)
endif
endif
if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
@ -57,8 +59,10 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
input : 'journal-remote.conf.in',
output : 'journal-remote.conf',
configuration : substs)
install_data(journal_remote_conf,
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data(journal_remote_conf,
install_dir : pkgsysconfdir)
endif
install_data('browse.html',
install_dir : join_paths(pkgdatadir, 'gatewayd'))

6
src/journal/meson.build

@ -107,8 +107,10 @@ journalctl_sources = files('''
pcre2-dlopen.h
'''.split())
install_data('journald.conf',
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data('journald.conf',
install_dir : pkgsysconfdir)
endif
if get_option('create-log-dirs')
meson.add_install_script(

23
src/kernel-install/meson.build

@ -3,16 +3,19 @@
want_kernel_install = get_option('kernel-install')
if want_kernel_install
install_data('kernel-install',
install_mode : 'rwxr-xr-x',
install_dir : bindir)
install_data('kernel-install',
install_mode : 'rwxr-xr-x',
install_dir : bindir)
install_data('00-entry-directory.install',
'50-depmod.install',
'90-loaderentry.install',
install_mode : 'rwxr-xr-x',
install_dir : kernelinstalldir)
install_data('00-entry-directory.install',
'50-depmod.install',
'90-loaderentry.install',
install_mode : 'rwxr-xr-x',
install_dir : kernelinstalldir)
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'kernel/install.d')))
endif
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'kernel/install.d')))
endif

6
src/login/meson.build

@ -74,8 +74,10 @@ if conf.get('ENABLE_LOGIND') == 1
input : 'logind.conf.in',
output : 'logind.conf',
configuration : substs)
install_data(logind_conf,
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data(logind_conf,
install_dir : pkgsysconfdir)
endif
install_data('org.freedesktop.login1.conf',
install_dir : dbuspolicydir)

6
src/network/meson.build

@ -236,8 +236,10 @@ if conf.get('ENABLE_NETWORKD') == 1
install_dir : polkitpkladir)
endif
install_data('networkd.conf',
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data('networkd.conf',
install_dir : pkgsysconfdir)
endif
fuzzers += [
[['src/network/fuzz-netdev-parser.c',

6
src/oom/meson.build

@ -29,6 +29,8 @@ if conf.get('ENABLE_OOMD') == 1
install_data('org.freedesktop.oom1.service',
install_dir : dbussystemservicedir)
install_data('oomd.conf',
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data('oomd.conf',
install_dir : sysconfdir)
endif
endif

2
src/pstore/meson.build

@ -4,7 +4,7 @@ systemd_pstore_sources = files('''
pstore.c
'''.split())
if conf.get('ENABLE_PSTORE') == 1
if conf.get('ENABLE_PSTORE') == 1 and install_sysconfdir
install_data('pstore.conf',
install_dir : pkgsysconfdir)
endif

6
src/resolve/meson.build

@ -169,8 +169,10 @@ if conf.get('ENABLE_RESOLVE') == 1
input : 'resolved.conf.in',
output : 'resolved.conf',
configuration : substs)
install_data(resolved_conf,
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data(resolved_conf,
install_dir : pkgsysconfdir)
endif
install_data('resolv.conf',
install_dir : rootlibexecdir)

6
src/timesync/meson.build

@ -26,8 +26,10 @@ if conf.get('ENABLE_TIMESYNCD') == 1
input : 'timesyncd.conf.in',
output : 'timesyncd.conf',
configuration : substs)
install_data(timesyncd_conf,
install_dir : pkgsysconfdir)
if install_sysconfdir
install_data(timesyncd_conf,
install_dir : pkgsysconfdir)
endif
install_data('org.freedesktop.timesync1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.timesync1.service',

12
src/udev/meson.build

@ -185,8 +185,10 @@ foreach prog : [['ata_id/ata_id.c'],
install_dir : udevlibexecdir)
endforeach
install_data('udev.conf',
install_dir : join_paths(sysconfdir, 'udev'))
if install_sysconfdir
install_data('udev.conf',
install_dir : join_paths(sysconfdir, 'udev'))
endif
configure_file(
input : 'udev.pc.in',
@ -194,8 +196,10 @@ configure_file(
configuration : substs,
install_dir : pkgconfigdatadir == 'no' ? '' : pkgconfigdatadir)
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d')))
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d')))
endif
fuzzers += [
[['src/udev/net/fuzz-link-parser.c',

6
sysctl.d/meson.build

@ -26,5 +26,7 @@ foreach file : in_files
install_dir : sysctldir)
endforeach
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'sysctl.d')))
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'sysctl.d')))
endif

2
tmpfiles.d/meson.build

@ -55,7 +55,7 @@ foreach file : m4_files
endif
endforeach
if enable_tmpfiles
if enable_tmpfiles and install_sysconfdir
meson.add_install_script(
'sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'tmpfiles.d')))

8
units/meson.build

@ -326,9 +326,11 @@ install_data('user-.slice.d/10-defaults.conf',
############################################################
meson.add_install_script(meson_make_symlink,
join_paths(pkgsysconfdir, 'user'),
join_paths(sysconfdir, 'xdg/systemd/user'))
if install_sysconfdir
meson.add_install_script(meson_make_symlink,
join_paths(pkgsysconfdir, 'user'),
join_paths(sysconfdir, 'xdg/systemd/user'))
endif
meson.add_install_script(meson_make_symlink,
join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'),
join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service'))

Loading…
Cancel
Save