3
0

- Introduce %service_del_postun_with_restart()

It's the counterpart of %service_del_postun_without_restart() and
  replaces the '-f' option of %service_del_postun().
- Expand %service_del_postun_without_restart in %service_del_postun

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=52
This commit is contained in:
Franck Bui 2020-11-10 11:04:59 +00:00 committed by Git OBS Bridge
parent 198ba4caa7
commit 163b073fa1
2 changed files with 36 additions and 7 deletions

View File

@ -118,25 +118,44 @@ fi \
# On uninstall, tell systemd to reload its unit files.
# On update, tell systemd to reload its unit files but don't restart service.
#
# It ignores the content of /etc/sysconfig/services
#
%service_del_postun_without_restart() \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
fi \
%{nil}
# On uninstall, tell systemd to reload its unit files.
# On update, tell systemd to reload its unit files and restart service.
#
# It ignores the content of /etc/sysconfig/services
#
%service_del_postun_with_restart() \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
if [ $1 -ge 1 ]; then \
# Package upgrade, not uninstall \
/usr/bin/systemctl try-restart %{?*} || : \
fi \
fi \
%{nil}
# On uninstall, tell systemd to reload its unit files
#
# Options used if not in an installation systems
# -f : force service restart on update (deprecated)
# -n : do not touch active service (deprecated, replaced by %service_del_postun_without_restart)
# Deprecated options, please do not use in new code:
# -f : force restart on update (replaced by %service_del_postun_with_restart)
# -n : don't restart on update (replaced by %service_del_postun_without_restart)
#
# The default is to read DISABLE_RESTART_ON_UPDATE from /etc/sysconfig/services
#
%service_del_postun(fn) \
%service_del_postun_without_restart %{?*} \
if [ $1 -ge 1 -a -x /usr/bin/systemctl ]; then \
# Package upgrade, not uninstall \
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
if [ $1 -ge 1 ]; then \
# Package upgrade, not uninstall \
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
fi \
%{nil}

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue Nov 10 09:32:31 UTC 2020 - Franck Bui <fbui@suse.com>
- Introduce %service_del_postun_with_restart()
It's the counterpart of %service_del_postun_without_restart() and
replaces the '-f' option of %service_del_postun().
- Expand %service_del_postun_without_restart in %service_del_postun
-------------------------------------------------------------------
Tue Nov 10 09:13:03 UTC 2020 - Franck Bui <fbui@suse.com>