3
0

Accepting request 678270 from home:fbui:branches:Base:System

- Introduce %service_del_postun_without_restart
  This is another step to make the SUSE rpm macros closer to their
  upstream counterparts.
  Introduce %service_del_postun_without_restart which should help in
  getting rid of '-f' and '-n' switches of %service_del_postun.

OBS-URL: https://build.opensuse.org/request/show/678270
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=32
This commit is contained in:
Thomas Blume 2019-02-25 09:47:37 +00:00 committed by Git OBS Bridge
parent 283ce5b854
commit e5d6d1a3e5
2 changed files with 41 additions and 17 deletions

View File

@ -18,6 +18,7 @@
# #
# %postun # %postun
# %service_del_postun demo.service # %service_del_postun demo.service
# %service_del_postun_without_restart demo.service
# #
%_unitdir /usr/lib/systemd/system %_unitdir /usr/lib/systemd/system
@ -157,34 +158,46 @@ if [ "$FIRST_ARG" -eq 0 -a -x /usr/bin/systemctl ]; then \
fi \ fi \
%{nil} %{nil}
# On uninstall, tell systemd to reload its unit files # On uninstall, tell systemd to reload its unit files.
# On update, tell systemd to reload its unit files but don't restart service.
# #
# Options used if not in an installation systems %service_del_postun_without_restart() \
# -f that is fore service restart in removal
# -n that do not touch active service
# the default is to check for DISABLE_RESTART_ON_UPDATE environment
# variable if not found use the value read from /etc/sysconfig/services
#
%service_del_postun(fn) \
test -n "$FIRST_ARG" || FIRST_ARG="$1" \ test -n "$FIRST_ARG" || FIRST_ARG="$1" \
if [ "$FIRST_ARG" -ge 1 ]; then \ if [ "$FIRST_ARG" -eq 0 ]; then \
# Package upgrade, not uninstall \ # Package removal \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
else # package uninstall \
for service in %{?*} ; do \ for service in %{?*} ; do \
sysv_service="${service%.*}" \ sysv_service="${service%.*}" \
rm -f "/var/lib/systemd/migrated/$sysv_service" || : \ rm -f "/var/lib/systemd/migrated/$sysv_service" || : \
done \ done \
if [ -x /usr/bin/systemctl ]; then \ fi \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \ /usr/bin/systemctl daemon-reload || : \
fi \
%{nil}
# On uninstall, tell systemd to reload its unit files
#
# Options used if not in an installation systems
# -f that is force service restart in removal (deprecated)
# -n that do not touch active service (depredacted)
# the default is to check for DISABLE_RESTART_ON_UPDATE environment
# variable if not found use the value read from /etc/sysconfig/services
#
%service_del_postun(fn) \
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
%service_del_postun_without_restart %{?*} \
if [ "$FIRST_ARG" -ge 1 ]; then \
# Package upgrade, not uninstall \
if [ -x /usr/bin/systemctl ]; then \
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \ fi \
fi \ fi \
%{nil} %{nil}
#
# Upstream variants
#
%systemd_post() \ %systemd_post() \
if [ $1 -eq 1 -a -x /usr/bin/systemctl ] ; then \ if [ $1 -eq 1 -a -x /usr/bin/systemctl ] ; then \
# Initial installation \ # Initial installation \

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Feb 22 13:00:18 UTC 2019 - Franck Bui <fbui@suse.com>
- Introduce %service_del_postun_without_restart
This is another step to make the SUSE rpm macros closer to their
upstream counterparts.
Introduce %service_del_postun_without_restart which should help in
getting rid of '-f' and '-n' switches of %service_del_postun.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 21 17:53:18 UTC 2019 - Franck Bui <fbui@suse.com> Thu Feb 21 17:53:18 UTC 2019 - Franck Bui <fbui@suse.com>