3
0

- Test for the presence of systemd only once in %service_add_post

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=45
This commit is contained in:
Franck Bui 2020-11-09 08:43:46 +00:00 committed by Git OBS Bridge
parent b8ac3768b4
commit 664f945153
2 changed files with 16 additions and 21 deletions

View File

@ -85,26 +85,18 @@ fi \
# On install, tell systemd to reload its unit files
%service_add_post() \
if [ -x /usr/bin/systemctl ]; then \
# FIXME: why is this needed ? \
/usr/bin/systemctl daemon-reload || : \
fi \
\
if [ $1 -eq 1 ]; then \
if [ -x /usr/bin/systemctl ]; then \
if [ $1 -eq 1 ]; then \
/usr/bin/systemctl preset %{?*} || : \
fi \
elif [ $1 -gt 1 ]; then \
for service in %{?*} ; do \
if [ ! -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \
continue \
fi \
rm -f "/run/rpm-%{name}-update-$service-new-in-upgrade" \
if [ ! -x /usr/bin/systemctl ]; then \
continue \
fi \
/usr/bin/systemctl preset "$service" || : \
done \
\
if [ -x /usr/lib/systemd/systemd-sysv-convert ]; then \
else \
for service in %{?*} ; do \
if [ -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \
rm -f "/run/rpm-%{name}-update-$service-new-in-upgrade" \
/usr/bin/systemctl preset "$service" || : \
fi \
done \
/usr/lib/systemd/systemd-sysv-convert --apply %{?*} || : \
fi \
fi \
@ -141,11 +133,9 @@ fi \
#
%service_del_postun(fn) \
%service_del_postun_without_restart %{?*} \
if [ $1 -ge 1 ]; then \
if [ $1 -ge 1 -a -x /usr/bin/systemctl ]; then \
# Package upgrade, not uninstall \
if [ -x /usr/bin/systemctl ]; then \
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
%{nil}

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 9 07:58:01 UTC 2020 - Franck Bui <fbui@suse.com>
- Test for the presence of systemd only once in %service_add_post
-------------------------------------------------------------------
Mon Nov 9 07:44:40 UTC 2020 - Franck Bui <fbui@suse.com>