3
0
Dr. Werner Fink 2016-03-03 10:09:49 +00:00 committed by Git OBS Bridge
parent 34f074503f
commit 35441a3b44
2 changed files with 70 additions and 20 deletions

View File

@ -50,19 +50,33 @@ Requires(postun): systemd \
%_ntpunitsdir /usr/lib/systemd/ntp-units.d
%_binfmtdir /usr/lib/binfmt.d
%_restart_check_systemctl \
test "$DISABLE_RESTART_ON_UPDATE" = yes && exit 0 \
test -f /etc/sysconfig/services && . /etc/sysconfig/services \
test "$YAST_IS_RUNNING" = instsys && exit 0 \
test "$DISABLE_RESTART_ON_UPDATE" = yes && exit 0 \
/usr/bin/systemctl try-restart %{nil}
%_restart_on_update_force() (\
test "$YAST_IS_RUNNING" = instsys && exit 0 \
%{?*:/usr/bin/systemctl try-restart %{*}} \
) || : %{nil}
%_restart_on_update_never() %{?*:# Restart of %{*} skipped} %{nil}
%_restart_on_update() (\
test "$YAST_IS_RUNNING" = instsys && exit 0\
test -f /etc/sysconfig/services -a \\\
-z "$DISABLE_RESTART_ON_UPDATE" && . /etc/sysconfig/services\
test "$DISABLE_RESTART_ON_UPDATE" = yes -o \\\
"$DISABLE_RESTART_ON_UPDATE" = 1 && exit 0\
%{?*:/usr/bin/systemctl try-restart %{*}}\
) || : %{nil}
%_stop_check_systemctl \
test "$DISABLE_STOP_ON_REMOVAL" = yes && exit 0 \
test -f /etc/sysconfig/services && . /etc/sysconfig/services \
test "$YAST_IS_RUNNING" = instsys && exit 0 \
test "$DISABLE_STOP_ON_REMOVAL" = yes && exit 0 \
/usr/bin/systemctl stop %{nil}
%_stop_on_removal_force() ( \
test "$YAST_IS_RUNNING" = instsys && exit 0\
%{?*:/usr/bin/systemctl stop %{*}}\
) || : %{nil}
%_stop_on_removal_never() %{?*:# Stop of %{*} skipped} %{nil}
%_stop_on_removal() (\
test "$YAST_IS_RUNNING" = instsys && exit 0\
test -f /etc/sysconfig/services -a \\\
-z "$DISABLE_STOP_ON_REMOVAL" && . /etc/sysconfig/services\
test "$DISABLE_STOP_ON_REMOVAL" = yes -o \\\
"$DISABLE_STOP_ON_REMOVAL" = 1 && exit 0\
%{?*:/usr/bin/systemctl stop %{*}}\
) || : %{nil}
%service_add_pre() \
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
@ -130,23 +144,38 @@ fi \
%{nil}
# On uninstall, disable and stop services
%service_del_preun() \
#
# Options used if not in an installation systems
# -f that is fore service stop in removal
# -n that do not touch active service
# the default is to check for DISABLE_STOP_ON_REMOVAL environment
# variable if not found use the value read from /etc/sysconfig/services
#
%service_del_preun(fn) \
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
if [ "$FIRST_ARG" -eq 0 -a -x /usr/bin/systemctl ]; then \
# Package removal, not upgrade \
/usr/bin/systemctl --no-reload disable %{?*} || : \
( %_stop_check_systemctl %{?*} || : ) \
%{expand:%%_stop_on_removal%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
%{nil}
# On uninstall, tell systemd to reload its unit files
%service_del_postun() \
#
# Options used if not in an installation systems
# -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" \
if [ "$FIRST_ARG" -ge 1 ]; then \
# Package upgrade, not uninstall \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
( %_restart_check_systemctl %{?*} || : ) \
%{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
else # package uninstall \
for service in %{?*} ; do \
@ -159,21 +188,35 @@ else # package uninstall \
fi \
%{nil}
%systemd_post() \
#
# Options used if not in an installation systems
# -f that is fore service stop in removal
# -n that do not touch active service
# the default is to check for DISABLE_STOP_ON_REMOVAL environment
# variable if not found use the value read from /etc/sysconfig/services
#
%systemd_post(fn) \
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \
# Package removal, not upgrade \
/usr/bin/systemctl --no-reload disable %{?*} || : \
( %_stop_check_systemctl %{?*} || : ) \
%{expand:%%_stop_on_removal%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
%{nil}
%systemd_user_post() %systemd_post --user --global %{?*}
%systemd_preun() \
#
# Options used if not in an installation systems
# -f that is fore service stop in removal
# -n that do not touch active service
# the default is to check for DISABLE_STOP_ON_REMOVAL environment
# variable if not found use the value read from /etc/sysconfig/services
#
%systemd_preun(fn) \
if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \
# Package removal, not upgrade \
/usr/bin/systemctl --no-reload disable %{?*} || : \
( %_stop_check_systemctl %{?*} || : ) \
%{expand:%%_stop_on_removal%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \
fi \
%{nil}

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Mar 3 10:01:52 UTC 2016 - werner@suse.de
- Allow the packagers to specify the options -f and -n on the
macros %service_del_preun(), %service_del_postun(), %systemd_post(),
and %systemd_preun() (boo#968405)
-------------------------------------------------------------------
Sat Feb 27 10:18:55 UTC 2016 - dimstar@opensuse.org