diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2020-11-12 08:01:39 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-12 11:21:46 +0100 |
commit | d7aa78c32f076c305ceeb183fc06eb1de0960deb (patch) | |
tree | d7d262549dff0b1e195b1367616995241370d821 | |
parent | license: LGPL-2.1+ -> LGPL-2.1-or-later (diff) | |
download | systemd-d7aa78c32f076c305ceeb183fc06eb1de0960deb.tar.xz systemd-d7aa78c32f076c305ceeb183fc06eb1de0960deb.zip |
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
-rw-r--r-- | hwdb.d/meson.build | 12 | ||||
-rw-r--r-- | meson.build | 25 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rw-r--r-- | network/meson.build | 6 | ||||
-rw-r--r-- | src/core/meson.build | 20 | ||||
-rw-r--r-- | src/coredump/meson.build | 2 | ||||
-rw-r--r-- | src/home/meson.build | 6 | ||||
-rw-r--r-- | src/journal-remote/meson.build | 12 | ||||
-rw-r--r-- | src/journal/meson.build | 6 | ||||
-rw-r--r-- | src/kernel-install/meson.build | 23 | ||||
-rw-r--r-- | src/login/meson.build | 6 | ||||
-rw-r--r-- | src/network/meson.build | 6 | ||||
-rw-r--r-- | src/oom/meson.build | 6 | ||||
-rw-r--r-- | src/pstore/meson.build | 2 | ||||
-rw-r--r-- | src/resolve/meson.build | 6 | ||||
-rw-r--r-- | src/timesync/meson.build | 6 | ||||
-rw-r--r-- | src/udev/meson.build | 12 | ||||
-rw-r--r-- | sysctl.d/meson.build | 6 | ||||
-rw-r--r-- | tmpfiles.d/meson.build | 2 | ||||
-rw-r--r-- | units/meson.build | 8 |
20 files changed, 111 insertions, 63 deletions
diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build index 63a56b49cc..6fcb364acd 100644 --- a/hwdb.d/meson.build +++ b/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') diff --git a/meson.build b/meson.build index 19efa92db8..7996bc2c65 100644 --- a/meson.build +++ b/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', diff --git a/meson_options.txt b/meson_options.txt index ff45d60350..2435ccebd4 100644 --- a/meson_options.txt +++ b/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') diff --git a/network/meson.build b/network/meson.build index 08f29ca7df..b0e60f7217 100644 --- a/network/meson.build +++ b/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', diff --git a/src/core/meson.build b/src/core/meson.build index 552590393d..77767eb603 100644 --- a/src/core/meson.build +++ b/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 diff --git a/src/coredump/meson.build b/src/coredump/meson.build index 663c6c7a07..ebd99bd379 100644 --- a/src/coredump/meson.build +++ b/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 diff --git a/src/home/meson.build b/src/home/meson.build index 7847449c43..e3cc1a9fb5 100644 --- a/src/home/meson.build +++ b/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 += [ diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index 66cbcc69df..4572f4bd1c 100644 --- a/src/journal-remote/meson.build +++ b/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')) diff --git a/src/journal/meson.build b/src/journal/meson.build index 520e33c0b8..7aea28d129 100644 --- a/src/journal/meson.build +++ b/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( diff --git a/src/kernel-install/meson.build b/src/kernel-install/meson.build index 851e827590..4117188f14 100644 --- a/src/kernel-install/meson.build +++ b/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 diff --git a/src/login/meson.build b/src/login/meson.build index fd3202cd98..e09610960b 100644 --- a/src/login/meson.build +++ b/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) diff --git a/src/network/meson.build b/src/network/meson.build index cd1a897199..f5ca183088 100644 --- a/src/network/meson.build +++ b/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', diff --git a/src/oom/meson.build b/src/oom/meson.build index a250d2a62a..e966ad1dd8 100644 --- a/src/oom/meson.build +++ b/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 diff --git a/src/pstore/meson.build b/src/pstore/meson.build index 3b3a37c777..6c0ab0563b 100644 --- a/src/pstore/meson.build +++ b/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 diff --git a/src/resolve/meson.build b/src/resolve/meson.build index eb6fabea95..8e7bad0659 100644 --- a/src/resolve/meson.build +++ b/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) diff --git a/src/timesync/meson.build b/src/timesync/meson.build index 22b6347bab..571e3fc7ef 100644 --- a/src/timesync/meson.build +++ b/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', diff --git a/src/udev/meson.build b/src/udev/meson.build index e6dd4c7cac..5eb0f994a5 100644 --- a/src/udev/meson.build +++ b/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', diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build index e9b20ea540..e8d8fc8c53 100644 --- a/sysctl.d/meson.build +++ b/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 diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build index a41dd3e454..7322460dba 100644 --- a/tmpfiles.d/meson.build +++ b/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'))) diff --git a/units/meson.build b/units/meson.build index e249539dc8..ba60eb7fc1 100644 --- a/units/meson.build +++ b/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')) |