3
0

- No need to run 'systemd-sysv-convert --save' in %service_add_pre anymore

Due to the fact that the initscripts being removed during package
  updates are still available in %post, systemd-sysv-convert has been
  reworked so it's only needed to call it in %post.

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=44
This commit is contained in:
Franck Bui 2020-11-09 07:45:47 +00:00 committed by Git OBS Bridge
parent fe75626308
commit b8ac3768b4
2 changed files with 17 additions and 41 deletions

View File

@ -69,14 +69,7 @@ OrderWithRequires(postun): systemd \
%{nil}
%service_add_pre() \
# disable migration if initial install under systemd \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
if [ $1 -eq 1 ]; then \
for service in %{?*} ; do \
sysv_service="${service%%.*}" \
touch "/var/lib/systemd/migrated/$sysv_service" || : \
done \
else \
if [ $1 -gt 1 -a -x /usr/bin/systemctl ]; then \
for service in %{?*} ; do \
# The tag file might have been left by a preceding \
# update (see bsc#1059627) \
@ -86,32 +79,20 @@ else \
touch "/run/rpm-%{name}-update-$service-new-in-upgrade" \
fi \
done \
for service in %{?*} ; do \
sysv_service="${service%%.*}" \
if [ -e /var/lib/systemd/migrated/$sysv_service ]; then \
continue \
fi \
if [ ! -x /usr/lib/systemd/systemd-sysv-convert ]; then \
continue \
fi \
/usr/lib/systemd/systemd-sysv-convert --save $sysv_service || : \
done \
fi \
%{nil}
# On install, tell systemd to reload its unit files
%service_add_post() \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
\
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
fi \
\
if [ $1 -eq 1 ]; then \
if [ $1 -eq 1 ]; then \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl preset %{?*} || : \
fi \
elif [ $1 -gt 1 ]; then \
elif [ $1 -gt 1 ]; then \
for service in %{?*} ; do \
if [ ! -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \
continue \
@ -122,23 +103,16 @@ elif [ $1 -gt 1 ]; then \
fi \
/usr/bin/systemctl preset "$service" || : \
done \
for service in %{?*} ; do \
sysv_service=${service%%.*} \
if [ -e /var/lib/systemd/migrated/$sysv_service ]; then \
continue \
fi \
if [ ! -x /usr/lib/systemd/systemd-sysv-convert ]; then \
continue \
fi \
/usr/lib/systemd/systemd-sysv-convert --apply $sysv_service || : \
touch /var/lib/systemd/migrated/$sysv_service || : \
done \
\
if [ -x /usr/lib/systemd/systemd-sysv-convert ]; then \
/usr/lib/systemd/systemd-sysv-convert --apply %{?*} || : \
fi \
fi \
%{nil}
# On uninstall, disable and stop services
#
# Note: '-n' and '-f' options are still allowed to kept backward compatibility
# Note: '-n' and '-f' options are still allowed to keep backward compatibility
# with SLE
#
%service_del_preun(fn) \
@ -152,13 +126,6 @@ fi \
# On update, tell systemd to reload its unit files but don't restart service.
#
%service_del_postun_without_restart() \
if [ $1 -eq 0 ]; then \
# Package removal \
for service in %{?*} ; do \
sysv_service="${service%.*}" \
rm -f "/var/lib/systemd/migrated/$sysv_service" || : \
done \
fi \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
fi \

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Nov 9 07:44:40 UTC 2020 - Franck Bui <fbui@suse.com>
- No need to run 'systemd-sysv-convert --save' in %service_add_pre anymore
Due to the fact that the initscripts being removed during package
updates are still available in %post, systemd-sysv-convert has been
reworked so it's only needed to call it in %post.
-------------------------------------------------------------------
Mon Nov 9 07:35:12 UTC 2020 - Franck Bui <fbui@suse.com>