From 8c84c85d440feef545a08a9ce4db00f7ae1b40425929bd7fe2de0324a2c5cfc0 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Thu, 19 Oct 2023 14:27:22 +0000 Subject: [PATCH] - Ship the main configuration files in /usr/lib/ Besides the fact that shipping files in /etc is not recommended anymore, this change will hopefully encourage users to customize the defaults via the mean of drop-ins hence removing the risk of conflicts with downstream customization. In contrary, shipping empty directories *.conf.d/ in /etc is not a concern and should suggest users to create drop-ins (bsc#1207056). OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1464 --- files.coredump | 3 +- files.experimental | 3 +- files.homed | 2 +- files.journal-remote | 6 ++-- files.network | 6 ++-- files.systemd | 12 +++++--- files.udev | 12 +++++--- systemd.changes | 13 ++++++++ systemd.spec | 72 ++++++++++++++++++++++++++++++++++++++++++-- 9 files changed, 112 insertions(+), 17 deletions(-) diff --git a/files.coredump b/files.coredump index 32b62d7..f78f2f1 100644 --- a/files.coredump +++ b/files.coredump @@ -1,8 +1,8 @@ # # Please keep the list sorted (with `LC_ALL=C sort`). # -%config(noreplace) %{_sysconfdir}/systemd/coredump.conf %dir %{_localstatedir}/lib/systemd/coredump +%dir %{_sysconfdir}/systemd/coredump.conf.d %{_bindir}/coredumpctl %if %{without bootstrap} %{_datadir}/bash-completion/completions/coredumpctl @@ -15,6 +15,7 @@ %{_mandir}/man8/systemd-coredump@.service.8.gz %endif %{_sysctldir}/50-coredump.conf +%{_systemd_util_dir}/coredump.conf %{_systemd_util_dir}/systemd-coredump %{_sysusersdir}/systemd-coredump.conf %{_unitdir}/sockets.target.wants/systemd-coredump.socket diff --git a/files.experimental b/files.experimental index 7b2439b..7330317 100644 --- a/files.experimental +++ b/files.experimental @@ -1,7 +1,7 @@ # # Please keep the list sorted (with `LC_ALL=C sort`). # -%config(noreplace) %{_sysconfdir}/systemd/oomd.conf +%dir %{_sysconfdir}/systemd/oomd.conf.d %if %{with sd_boot} %dir %{_unitdir}/initrd.target.wants %endif @@ -45,6 +45,7 @@ %if %{with sd_boot} %{_prefix}/lib/kernel/install.d/60-ukify.install %endif +%{_systemd_util_dir}/oomd.conf %{_systemd_util_dir}/system/initrd-root-fs.target.wants/systemd-repart.service %{_systemd_util_dir}/system/sysinit.target.wants/systemd-repart.service %if %{with sd_boot} diff --git a/files.homed b/files.homed index 93a0b8a..0460593 100644 --- a/files.homed +++ b/files.homed @@ -1,7 +1,6 @@ # # Please keep the list sorted (with `LC_ALL=C sort`). # -%config(noreplace) %{_sysconfdir}/systemd/homed.conf %{_bindir}/homectl %{_datadir}/bash-completion/completions/homectl %{_datadir}/dbus-1/interfaces/org.freedesktop.home1.Home.xml @@ -17,6 +16,7 @@ %{_mandir}/man8/systemd-homed.8.gz %{_mandir}/man8/systemd-homed.service.8.gz %{_pam_moduledir}/pam_systemd_home.so +%{_systemd_util_dir}/homed.conf %{_systemd_util_dir}/systemd-homed %{_systemd_util_dir}/systemd-homework %{_unitdir}/systemd-homed-activate.service diff --git a/files.journal-remote b/files.journal-remote index 9db81f6..1acfe41 100644 --- a/files.journal-remote +++ b/files.journal-remote @@ -1,8 +1,8 @@ # # Please keep the list sorted (with `LC_ALL=C sort`). # -%config(noreplace) %{_sysconfdir}/systemd/journal-remote.conf -%config(noreplace) %{_sysconfdir}/systemd/journal-upload.conf +%dir %{_sysconfdir}/systemd/journal-remote.conf.d +%dir %{_sysconfdir}/systemd/journal-upload.conf.d %ghost %dir %{_localstatedir}/log/journal/remote %{_datadir}/systemd/gatewayd %{_datadir}/systemd/gatewayd/browse.html @@ -18,6 +18,8 @@ %{_mandir}/man8/systemd-journal-remote.socket.8.gz %{_mandir}/man8/systemd-journal-upload.8.gz %{_mandir}/man8/systemd-journal-upload.service.8.gz +%{_systemd_util_dir}/journal-remote.conf +%{_systemd_util_dir}/journal-upload.conf %{_systemd_util_dir}/systemd-journal-gatewayd %{_systemd_util_dir}/systemd-journal-remote %{_systemd_util_dir}/systemd-journal-upload diff --git a/files.network b/files.network index e1588c4..e28d482 100644 --- a/files.network +++ b/files.network @@ -2,8 +2,8 @@ # Please keep the list sorted (with `LC_ALL=C sort`). # %if %{with networkd} -%config(noreplace) %{_sysconfdir}/systemd/networkd.conf %dir %{_sysconfdir}/systemd/network +%dir %{_sysconfdir}/systemd/networkd.conf.d %dir %{_systemd_util_dir}/network %{_bindir}/networkctl %{_datadir}/bash-completion/completions/networkctl @@ -36,6 +36,7 @@ %{_systemd_util_dir}/network/80-wifi-adhoc.network %{_systemd_util_dir}/network/80-wifi-ap.network.example %{_systemd_util_dir}/network/80-wifi-station.network.example +%{_systemd_util_dir}/networkd.conf %{_systemd_util_dir}/systemd-networkd %{_systemd_util_dir}/systemd-networkd-wait-online %{_sysusersdir}/systemd-network.conf @@ -47,7 +48,7 @@ %endif %if %{with resolved} -%config(noreplace) %{_sysconfdir}/systemd/resolved.conf +%dir %{_sysconfdir}/systemd/resolved.conf.d %{_bindir}/resolvectl %{_bindir}/systemd-resolve %{_datadir}/bash-completion/completions/resolvectl @@ -69,6 +70,7 @@ %{_mandir}/man8/systemd-resolved.8.gz %{_mandir}/man8/systemd-resolved.service.8.gz %{_systemd_util_dir}/resolv.conf +%{_systemd_util_dir}/resolved.conf %{_systemd_util_dir}/systemd-resolved %{_sysusersdir}/systemd-resolve.conf %{_tmpfilesdir}/systemd-resolve.conf diff --git a/files.systemd b/files.systemd index ec5e7ab..a4b3bcf 100644 --- a/files.systemd +++ b/files.systemd @@ -1,10 +1,6 @@ # # Please keep the list sorted (with `LC_ALL=C sort`). # -%config(noreplace) %{_sysconfdir}/systemd/journald.conf -%config(noreplace) %{_sysconfdir}/systemd/logind.conf -%config(noreplace) %{_sysconfdir}/systemd/system.conf -%config(noreplace) %{_sysconfdir}/systemd/user.conf %dir %{_binfmtdir} %if %{without bootstrap} %dir %{_datadir}/bash-completion @@ -34,8 +30,12 @@ %dir %{_sysconfdir}/binfmt.d %dir %{_sysconfdir}/sysctl.d %dir %{_sysconfdir}/systemd +%dir %{_sysconfdir}/systemd/journald.conf.d +%dir %{_sysconfdir}/systemd/logind.conf.d %dir %{_sysconfdir}/systemd/system +%dir %{_sysconfdir}/systemd/system.conf.d %dir %{_sysconfdir}/systemd/user +%dir %{_sysconfdir}/systemd/user.confd.d %dir %{_sysconfdir}/tmpfiles.d %dir %{_sysconfdir}/xdg/systemd %dir %{_sysctldir} @@ -402,8 +402,11 @@ %{_sysconfdir}/xdg/systemd/user %{_sysctldir}/99-sysctl.conf %{_systemd_user_env_generator_dir}/30-systemd-environment-d-generator +%{_systemd_util_dir}/journald.conf +%{_systemd_util_dir}/logind.conf %{_systemd_util_dir}/rpm/fixlet-systemd-post.sh %{_systemd_util_dir}/system-preset/99-default.preset +%{_systemd_util_dir}/system.conf %{_systemd_util_dir}/systemd %{_systemd_util_dir}/systemd-binfmt %{_systemd_util_dir}/systemd-boot-check-no-failures @@ -433,6 +436,7 @@ %{_systemd_util_dir}/systemd-xdg-autostart-condition %{_systemd_util_dir}/user-preset/90-systemd.preset %{_systemd_util_dir}/user-preset/99-default.preset +%{_systemd_util_dir}/user.conf %{_systemd_util_dir}/user/app.slice %{_systemd_util_dir}/user/background.slice %{_systemd_util_dir}/user/basic.target diff --git a/files.udev b/files.udev index c338889..c32bbb7 100644 --- a/files.udev +++ b/files.udev @@ -1,10 +1,6 @@ # # Please keep the list sorted (with `LC_ALL=C sort`). # -%config(noreplace) %{_sysconfdir}/systemd/pstore.conf -%config(noreplace) %{_sysconfdir}/systemd/sleep.conf -%config(noreplace) %{_sysconfdir}/systemd/timesyncd.conf -%config(noreplace) %{_sysconfdir}/udev/iocost.conf %config(noreplace) %{_sysconfdir}/udev/udev.conf %if %{without bootstrap} %dir %{_libdir}/cryptsetup @@ -17,7 +13,11 @@ %dir %{_sysconfdir}/modules-load.d %endif %dir %{_sysconfdir}/systemd/network +%dir %{_sysconfdir}/systemd/pstore.conf.d +%dir %{_sysconfdir}/systemd/sleep.conf.d +%dir %{_sysconfdir}/systemd/timesyncd.conf.d %dir %{_sysconfdir}/udev +%dir %{_sysconfdir}/udev/iocost.conf.d %dir %{_sysconfdir}/udev/rules.d %dir %{_systemd_util_dir}/network %dir %{_systemd_util_dir}/system-sleep @@ -146,11 +146,14 @@ %endif %{_prefix}/lib/udev/fido_id %{_prefix}/lib/udev/iocost +%{_prefix}/lib/udev/iocost.conf %{_prefix}/lib/udev/mtd_probe %{_prefix}/lib/udev/scsi_id %{_prefix}/lib/udev/v4l_id %{_systemd_util_dir}/network/99-default.link %{_systemd_util_dir}/ntp-units.d/80-systemd-timesync.list +%{_systemd_util_dir}/pstore.conf +%{_systemd_util_dir}/sleep.conf %{_systemd_util_dir}/systemd-backlight %{_systemd_util_dir}/systemd-battery-check %if %{without bootstrap} @@ -180,6 +183,7 @@ %{_systemd_util_dir}/systemd-veritysetup %endif %{_systemd_util_dir}/systemd-volatile-root +%{_systemd_util_dir}/timesyncd.conf %if %{without bootstrap} %{_systemdgeneratordir}/systemd-cryptsetup-generator %endif diff --git a/systemd.changes b/systemd.changes index fe09321..bd206e7 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Thu Oct 19 13:25:01 UTC 2023 - Franck Bui + +- Ship the main configuration files in /usr/lib/ + + Besides the fact that shipping files in /etc is not recommended anymore, this + change will hopefully encourage users to customize the defaults via the mean + of drop-ins hence removing the risk of conflicts with downstream + customization. + + In contrary, shipping empty directories *.conf.d/ in /etc is not a concern and + should suggest users to create drop-ins (bsc#1207056). + ------------------------------------------------------------------- Thu Oct 19 12:13:51 UTC 2023 - Franck Bui diff --git a/systemd.spec b/systemd.spec index 6a9ccec..e1f5090 100644 --- a/systemd.spec +++ b/systemd.spec @@ -65,6 +65,20 @@ %bcond_with filetriggers %bcond_with split_usr +# We stopped shipping main config files in /etc but we have to restore any +# config files that might have been backed up by rpm during the migration of the +# main config files from /etc to /usr. This needs to be done in %%posttrans +# because the .rpmsave files are created when the *old* package version is +# removed. This is not needed by ALP and will be dropped from Factory near the +# end of 2024. +%define restore_rpmsave() \ +if [ -e %{_sysconfdir}/%{1}.rpmsave ] && [ ! -e %{_sysconfdir}/%{1} ]; then \ + echo >&2 "Restoring %{_sysconfdir}/%1. Please consider moving your customizations in a drop-in instead." \ + echo >&2 "For more details, visit https://en.opensuse.org/Systemd#Configuration." \ + mv -v %{_sysconfdir}/%{1}.rpmsave %{_sysconfdir}/%{1} || : \ +fi \ +%{nil} + Name: systemd%{?mini} URL: http://www.freedesktop.org/wiki/Software/systemd Version: 254.5 @@ -814,8 +828,18 @@ install -m0755 -D %{SOURCE3} %{buildroot}/%{_systemd_util_dir}/systemd-update-he install -m0755 -D %{SOURCE4} %{buildroot}/%{_systemd_util_dir}/systemd-sysv-install %endif -mkdir -p % %{buildroot}%{_sysconfdir}/systemd/network -mkdir -p % %{buildroot}%{_sysconfdir}/systemd/nspawn +# For some reasons, upstream refuses to add a new build option (see pr#29244) +# for customizing the installation path of main config files. However we want to +# store them in /usr/lib so we don't encourage users to modify them while they +# still can serve as templates. +for f in %{buildroot}%{_sysconfdir}/systemd/*.conf; do + mv $f %{buildroot}%{_systemd_util_dir}/ +done +for f in %{buildroot}%{_sysconfdir}/udev/*.conf; do + # Drop-ins are currently not supported by udevd. + [ $(basename $f) = "udev.conf" ] && continue + mv $f %{buildroot}%{_prefix}/lib/udev/ +done # Install the fixlets mkdir -p %{buildroot}%{_systemd_util_dir}/rpm @@ -886,6 +910,26 @@ rm -f %{buildroot}%{_environmentdir}/99-environment.conf # directory... oh well. rm -f %{buildroot}%{_sysconfdir}/init.d/README +# Create *.conf.d/ directories to encourage users to create drop-ins when they +# need to customize some setting defaults. +mkdir -p %{buildroot}%{_sysconfdir}/systemd/coredump.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/journald.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/journal-remote.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/journal-upload.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/logind.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/networkd.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/oomd.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/pstore.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/resolved.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/sleep.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/system.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/timesyncd.conf.d +mkdir -p %{buildroot}%{_sysconfdir}/systemd/user.confd.d +mkdir -p %{buildroot}%{_sysconfdir}/udev/iocost.conf.d + +mkdir -p %{buildroot}%{_sysconfdir}/systemd/network +mkdir -p %{buildroot}%{_sysconfdir}/systemd/nspawn + # This dir must be owned (and thus created) by systemd otherwise the build # system will complain. This is odd since we simply own a ghost file in it... mkdir -p %{buildroot}%{_sysconfdir}/X11/xorg.conf.d @@ -1049,6 +1093,12 @@ journalctl --update-catalog || : %systemd_postun_with_restart systemd-timedated.service %systemd_postun_with_restart systemd-userdbd.service +%posttrans +%restore_rpmsave systemd/journald.conf +%restore_rpmsave systemd/logind.conf +%restore_rpmsave systemd/system.conf +%restore_rpmsave systemd/user.conf + %pre -n udev%{?mini} # Units listed below can be enabled at installation accoding to their preset # setting. @@ -1103,6 +1153,10 @@ fi %posttrans -n udev%{?mini} %regenerate_initrd_posttrans +%restore_rpmsave systemd/pstore.conf +%restore_rpmsave systemd/sleep.conf +%restore_rpmsave systemd/timesyncd.conf +%restore_rpmsave udev/iocost.conf %ldconfig_scriptlets -n libsystemd0%{?mini} %ldconfig_scriptlets -n libudev%{?mini}1 @@ -1133,6 +1187,9 @@ fi %post coredump %if %{without filetriggers} %sysusers_create systemd-coredump.conf + +%posttrans coredump +%restore_rpmsave systemd/coredump.conf %endif %endif @@ -1160,6 +1217,10 @@ fi %systemd_postun_with_restart systemd-journal-gatewayd.service %systemd_postun_with_restart systemd-journal-remote.service %systemd_postun_with_restart systemd-journal-upload.service + +%posttrans journal-remote +%restore_rpmsave systemd/journal-remote.conf +%restore_rpmsave systemd/journal-upload.conf %endif %if %{with networkd} || %{with resolved} @@ -1208,6 +1269,10 @@ fi %ldconfig %systemd_postun systemd-resolved.service %endif + +%posttrans network +%restore_rpmsave systemd/networkd.conf +%restore_rpmsave systemd/resolved.conf %endif %if %{with homed} @@ -1266,6 +1331,9 @@ fi %postun experimental %systemd_postun systemd-homed.service %systemd_postun systemd-oomd.service systemd-oomd.socket + +%posttrans experimental +%restore_rpmsave systemd/oomd.conf %endif # File trigger definitions