- Rename the tag file used to detect when presets need to be applied

Rather than placing these tags directly under /run, let's place them
  under /run/systemd/rpm. This also has the benefit to make the
  workaround for bsc#1059627 no more needed.

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=55
This commit is contained in:
Franck Bui 2020-11-23 18:03:40 +00:00 committed by Git OBS Bridge
parent 991b3b62db
commit f65be0ea90
2 changed files with 15 additions and 8 deletions

View File

@ -71,13 +71,10 @@ OrderWithRequires(postun): systemd \
%service_add_pre() \ %service_add_pre() \
if [ $1 -gt 1 -a -x /usr/bin/systemctl ]; then \ if [ $1 -gt 1 -a -x /usr/bin/systemctl ]; then \
for service in %{?*} ; do \ for service in %{?*} ; do \
# The tag file might have been left by a preceding \
# update (see bsc#1059627) \
rm -f "/run/rpm-%{name}-update-$service-new-in-upgrade" \
\
if [ ! -e "/usr/lib/systemd/system/$service" ] && \ if [ ! -e "/usr/lib/systemd/system/$service" ] && \
[ ! -e "/etc/init.d/${service%.*}" ]; then \ [ ! -e "/etc/init.d/${service%.*}" ]; then \
touch "/run/rpm-%{name}-update-$service-new-in-upgrade" \ mkdir -p /run/systemd/rpm/needs-preset \
touch "/run/systemd/rpm/needs-preset/$service" \
fi \ fi \
done \ done \
fi \ fi \
@ -94,11 +91,12 @@ if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl preset %{?*} || : \ /usr/bin/systemctl preset %{?*} || : \
else \ else \
for service in %{?*} ; do \ for service in %{?*} ; do \
if [ -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \ if [ -e "/run/systemd/rpm/needs-preset/$service" ]; then \
rm -f "/run/rpm-%{name}-update-$service-new-in-upgrade" \
/usr/bin/systemctl preset "$service" || : \ /usr/bin/systemctl preset "$service" || : \
fi \ fi \
done \ done \
rm -fr /run/systemd/rpm/needs-preset \
\
/usr/lib/systemd/systemd-sysv-convert --apply %{?*} || : \ /usr/lib/systemd/systemd-sysv-convert --apply %{?*} || : \
fi \ fi \
fi \ fi \
@ -180,7 +178,7 @@ fi \
%systemd_user_preun() \ %systemd_user_preun() \
if [ $1 -eq 0 -a -x /usr/bin/systemctl ]; then \ if [ $1 -eq 0 -a -x /usr/bin/systemctl ]; then \
# Package removal, not upgrade \ # Package removal, not upgrade \
/usr/bin/systemctl --global disable %{?*} || : \ /usr/bin/systemctl --global disable %{?*} || : \
fi \ fi \
%{nil} %{nil}

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Nov 20 06:34:57 UTC 2020 - Franck Bui <fbui@suse.com>
- Rename the tag file used to detect when presets need to be applied
Rather than placing these tags directly under /run, let's place them
under /run/systemd/rpm. This also has the benefit to make the
workaround for bsc#1059627 no more needed.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Nov 19 15:53:43 UTC 2020 - Franck Bui <fbui@suse.com> Thu Nov 19 15:53:43 UTC 2020 - Franck Bui <fbui@suse.com>