- Don't automatically clean unmodified config files up (bsc#1226415)

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1535
This commit is contained in:
Franck Bui 2024-06-24 14:45:08 +00:00 committed by Git OBS Bridge
parent 369c023c24
commit 638de11012
8 changed files with 52 additions and 36 deletions

View File

@ -9,6 +9,8 @@
%if %{with sd_boot}
%dir %{_unitdir}/initrd.target.wants
%endif
# Main config files have been replaced in favor of drop-ins.
%ghost %{_sysconfdir}/systemd/oomd.conf
%{_bindir}/oomctl
%{_bindir}/systemd-vmspawn
%if %{with sd_boot}

View File

@ -4,6 +4,9 @@
%dir %{_sysconfdir}/systemd/journal-remote.conf.d
%dir %{_sysconfdir}/systemd/journal-upload.conf.d
%ghost %dir %{_localstatedir}/log/journal/remote
# Main config files have been replaced in favor of drop-ins.
%ghost %{_sysconfdir}/systemd/journal-remote.conf
%ghost %{_sysconfdir}/systemd/journal-upload.conf
%{_datadir}/systemd/gatewayd
%{_datadir}/systemd/gatewayd/browse.html
%{_mandir}/man5/journal-remote.conf.5.gz

View File

@ -5,6 +5,8 @@
%dir %{_sysconfdir}/systemd/network
%dir %{_sysconfdir}/systemd/networkd.conf.d
%dir %{_systemd_util_dir}/network
# Main config files have been replaced in favor of drop-ins.
%ghost %{_sysconfdir}/systemd/networkd.conf
%{_bindir}/networkctl
%{_datadir}/bash-completion/completions/networkctl
%{_datadir}/dbus-1/interfaces/org.freedesktop.network1.DHCPServer.xml

View File

@ -91,6 +91,11 @@
%ghost %config(noreplace) %{_sysconfdir}/machine-info
%ghost %dir %attr(2755, root, systemd-journal) %{_localstatedir}/log/journal
%ghost %{_localstatedir}/lib/systemd/catalog/database
# Main config files have been replaced in favor of drop-ins.
%ghost %{_sysconfdir}/systemd/journald.conf
%ghost %{_sysconfdir}/systemd/logind.conf
%ghost %{_sysconfdir}/systemd/system.conf
%ghost %{_sysconfdir}/systemd/user.conf
%license LICENSE.GPL2
%license LICENSE.LGPL2.1
%{_bindir}/busctl

View File

@ -40,6 +40,11 @@
%ghost %attr(644, root, root) %{_prefix}/lib/udev/compat-symlink-generation
%ghost %config(noreplace) %{_sysconfdir}/vconsole.conf
%ghost %{_localstatedir}/lib/systemd/backlight
# Main config files have been replaced in favor of drop-ins.
%ghost %{_sysconfdir}/systemd/pstore.conf
%ghost %{_sysconfdir}/systemd/sleep.conf
%ghost %{_sysconfdir}/systemd/timesyncd.conf
%ghost %{_sysconfdir}/udev/iocost.conf
%{_bindir}/bootctl
%if %{without bootstrap}
%{_bindir}/kernel-install

View File

@ -276,6 +276,31 @@ drop_after_local_support() {
fi
}
#
# We have stopped shipping the main config files in /etc but we don't try to
# clean them up automatically as it can have unexepected side effects
# (bsc#1226415). Instead we simply suggest users to convert them (if they exist)
# into drop-ins.
#
# Note: run at each package update
#
check_config_files () {
config_files=(systemd/journald.conf systemd/logind.conf systemd/system.conf systemd/user.conf
systemd/pstore.conf systemd/sleep.conf systemd/timesyncd.conf systemd/coredump.conf
systemd/journal-remote.conf systemd/journal-upload.conf systemd/networkd.conf
systemd/resolved.conf systemd/oomd.conf udev/iocost.conf)
for f in ${config_files[*]}; do
[ -e /etc/$f ] || continue
cat >&2 <<EOF
Main configuration files are deprecated in favor of drop-ins.
Hence we suggest you to remove /etc/$f if it doesn't contain any customization or convert it into drop-in otherwise.
For more details, please visit https://en.opensuse.org/Systemd#Configuration.
EOF
done
}
r=0
fix_machine_id_perms || r=1
fix_pre_210 || r=1

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Jun 24 14:36:21 UTC 2024 - Franck Bui <fbui@suse.com>
- Don't automatically clean unmodified config files up (bsc#1226415)
Relying on the presence of .rpmsave for detecting unmodified main config files
couldn't work as it created a time window in which some of the systemd
services were restarted with no config file. That had the bad side effect to
restart them with the upstream defaults, ignoring any user's customization.
-------------------------------------------------------------------
Tue Jun 18 13:20:26 UTC 2024 - Franck Bui <fbui@suse.com>

View File

@ -80,20 +80,6 @@
# value is independent of the build flavor.
%bcond_without filetriggers
# 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: %systemd_version
@ -1131,13 +1117,6 @@ journalctl --update-catalog || :
%systemd_postun_with_restart systemd-timedated.service
%systemd_postun_with_restart systemd-userdbd.service
%posttrans
%restore_rpmsave systemd/coredump.conf
%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.
@ -1192,10 +1171,6 @@ 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
@ -1246,10 +1221,6 @@ 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}
@ -1298,10 +1269,6 @@ fi
%ldconfig
%systemd_postun systemd-resolved.service
%endif
%posttrans network
%restore_rpmsave systemd/networkd.conf
%restore_rpmsave systemd/resolved.conf
%endif
%if %{with homed}
@ -1360,9 +1327,6 @@ 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