From 225d08b8790fb0927f9ab360e372f9f34bbddacb Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Wed, 30 Dec 2020 15:11:30 -0800 Subject: [PATCH] Add install-sysconfdir=no-samples option for (non-)installation of sample configs By default, systemd installs various sample configuration files containing commented-out defaults. Systems seeking to minimize the number of files in /etc may wish to install directories and configuration files that have semantic effects, but not install not commented-out sample configuration files. Turn install-sysconfdir into a multi-valued option, with a "no-samples" value to skip installing sample-only configuration files. --- meson.build | 5 +++-- meson_options.txt | 4 ++-- src/core/meson.build | 2 +- src/coredump/meson.build | 2 +- src/home/meson.build | 2 +- src/journal-remote/meson.build | 2 +- src/journal/meson.build | 2 +- src/login/meson.build | 2 +- src/network/meson.build | 2 +- src/oom/meson.build | 2 +- src/pstore/meson.build | 2 +- src/resolve/meson.build | 2 +- src/timesync/meson.build | 2 +- src/udev/meson.build | 2 +- 14 files changed, 17 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 4a56ee3ee4..a8afa0dd2f 100644 --- a/meson.build +++ b/meson.build @@ -126,7 +126,8 @@ if rootlibdir == '' rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1]) endif -install_sysconfdir = get_option('install-sysconfdir') +install_sysconfdir = get_option('install-sysconfdir') != 'false' +install_sysconfdir_samples = get_option('install-sysconfdir') == 'true' # 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') @@ -2968,7 +2969,7 @@ executable( install : true, install_dir : rootlibexecdir) -if install_sysconfdir +if install_sysconfdir_samples install_data('src/sleep/sleep.conf', install_dir : pkgsysconfdir) endif diff --git a/meson_options.txt b/meson_options.txt index 2704f65baa..1707f64c17 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -184,8 +184,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('install-sysconfdir', type : 'combo', choices : ['true', 'no-samples', 'false'], value : 'true', + description : 'install configuration files and directories to $sysconfdir') option('fallback-hostname', type : 'string', value : 'localhost', description : 'the hostname used if none configured') diff --git a/src/core/meson.build b/src/core/meson.build index 662e6376f1..3482bd4472 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -190,7 +190,7 @@ in_files = [['macros.systemd', rpmmacrosdir], foreach item : in_files file = item[0] dir = item[1] - if install_sysconfdir or dir != pkgsysconfdir + if install_sysconfdir_samples or dir != pkgsysconfdir configure_file( input : file + '.in', output : file, diff --git a/src/coredump/meson.build b/src/coredump/meson.build index ebd99bd379..2e44556245 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 and install_sysconfdir +if conf.get('ENABLE_COREDUMP') == 1 and install_sysconfdir_samples install_data('coredump.conf', install_dir : pkgsysconfdir) endif diff --git a/src/home/meson.build b/src/home/meson.build index 8a879cc5d5..61f1e08a8a 100644 --- a/src/home/meson.build +++ b/src/home/meson.build @@ -99,7 +99,7 @@ if conf.get('ENABLE_HOMED') == 1 install_data('org.freedesktop.home1.policy', install_dir : polkitpolicydir) - if install_sysconfdir + if install_sysconfdir_samples install_data('homed.conf', install_dir : pkgsysconfdir) endif diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index 4572f4bd1c..940cef3040 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -59,7 +59,7 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 input : 'journal-remote.conf.in', output : 'journal-remote.conf', configuration : substs) - if install_sysconfdir + if install_sysconfdir_samples install_data(journal_remote_conf, install_dir : pkgsysconfdir) endif diff --git a/src/journal/meson.build b/src/journal/meson.build index 7aea28d129..dd0982a158 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -107,7 +107,7 @@ journalctl_sources = files(''' pcre2-dlopen.h '''.split()) -if install_sysconfdir +if install_sysconfdir_samples install_data('journald.conf', install_dir : pkgsysconfdir) endif diff --git a/src/login/meson.build b/src/login/meson.build index e09610960b..9c7545790c 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -74,7 +74,7 @@ if conf.get('ENABLE_LOGIND') == 1 input : 'logind.conf.in', output : 'logind.conf', configuration : substs) - if install_sysconfdir + if install_sysconfdir_samples install_data(logind_conf, install_dir : pkgsysconfdir) endif diff --git a/src/network/meson.build b/src/network/meson.build index 5cd7613168..72ca9b43e0 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -235,7 +235,7 @@ if conf.get('ENABLE_NETWORKD') == 1 install_dir : polkitpkladir) endif - if install_sysconfdir + if install_sysconfdir_samples install_data('networkd.conf', install_dir : pkgsysconfdir) endif diff --git a/src/oom/meson.build b/src/oom/meson.build index 1ea6766d1a..a32c366237 100644 --- a/src/oom/meson.build +++ b/src/oom/meson.build @@ -29,7 +29,7 @@ if conf.get('ENABLE_OOMD') == 1 install_data('org.freedesktop.oom1.service', install_dir : dbussystemservicedir) - if install_sysconfdir + if install_sysconfdir_samples install_data('oomd.conf', install_dir : pkgsysconfdir) endif diff --git a/src/pstore/meson.build b/src/pstore/meson.build index 6c0ab0563b..8e01af751c 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 and install_sysconfdir +if conf.get('ENABLE_PSTORE') == 1 and install_sysconfdir_samples install_data('pstore.conf', install_dir : pkgsysconfdir) endif diff --git a/src/resolve/meson.build b/src/resolve/meson.build index 8e7bad0659..d4cb5812a3 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -169,7 +169,7 @@ if conf.get('ENABLE_RESOLVE') == 1 input : 'resolved.conf.in', output : 'resolved.conf', configuration : substs) - if install_sysconfdir + if install_sysconfdir_samples install_data(resolved_conf, install_dir : pkgsysconfdir) endif diff --git a/src/timesync/meson.build b/src/timesync/meson.build index 571e3fc7ef..91e7cacfc5 100644 --- a/src/timesync/meson.build +++ b/src/timesync/meson.build @@ -26,7 +26,7 @@ if conf.get('ENABLE_TIMESYNCD') == 1 input : 'timesyncd.conf.in', output : 'timesyncd.conf', configuration : substs) - if install_sysconfdir + if install_sysconfdir_samples install_data(timesyncd_conf, install_dir : pkgsysconfdir) endif diff --git a/src/udev/meson.build b/src/udev/meson.build index 5a1d2149d7..9ec14c8021 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -203,7 +203,7 @@ foreach prog : udev_id_progs endif endforeach -if install_sysconfdir +if install_sysconfdir_samples install_data('udev.conf', install_dir : join_paths(sysconfdir, 'udev')) endif