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.
This commit is contained in:
Josh Triplett 2020-12-30 15:11:30 -08:00 committed by Yu Watanabe
parent 983cbd91a8
commit 225d08b879
14 changed files with 17 additions and 16 deletions

View File

@ -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

View File

@ -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')

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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