From 32642573a04fa7a7c6d8a0c0b20458279da729ce6ff4c25c26418f3cedd637ba Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 20 Nov 2015 16:54:39 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=12 --- macros.systemd | 29 ++++++++++++++++++++--------- systemd-rpm-macros.changes | 6 ++++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/macros.systemd b/macros.systemd index 4290c12..eca50af 100644 --- a/macros.systemd +++ b/macros.systemd @@ -50,13 +50,25 @@ Requires(postun): systemd \ %_ntpunitsdir /usr/lib/systemd/ntp-units.d %_binfmtdir /usr/lib/binfmt.d +%_restart_check_systemctl \ + 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} + +%_stop_check_systemctl \ + 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} + %service_add_pre() \ test -n "$FIRST_ARG" || FIRST_ARG="$1" \ # disable migration if initial install under systemd \ [ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \ if [ "$FIRST_ARG" -eq 1 ]; then \ for service in %{?*} ; do \ - sysv_service="${service%.*}" \ + sysv_service="${service%%.*}" \ touch "/var/lib/systemd/migrated/$sysv_service" || : \ done \ else \ @@ -68,7 +80,7 @@ else \ done \ fi \ for service in %{?*} ; do \ - sysv_service="${service%.*}" \ + sysv_service="${service%%.*}" \ if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \ services_to_migrate="$services_to_migrate $sysv_service" \ fi \ @@ -84,7 +96,7 @@ fi \ test -n "$FIRST_ARG" || FIRST_ARG="$1" \ [ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \ for service in %{?*} ; do \ - sysv_service="${service%.*}" \ + sysv_service="${service%%.*}" \ if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \ services_to_migrate="$services_to_migrate $sysv_service" \ touch "/var/lib/systemd/migrated/$sysv_service" || : \ @@ -121,7 +133,7 @@ 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 %{?*} || : \ - /usr/bin/systemctl stop %{?*} || : \ + ( %_stop_check_systemctl %{?*} || : ) \ fi \ %{nil} @@ -130,10 +142,9 @@ fi \ test -n "$FIRST_ARG" || FIRST_ARG="$1" \ if [ "$FIRST_ARG" -ge 1 ]; then \ # Package upgrade, not uninstall \ - if test "$YAST_IS_RUNNING" != "instsys" && \ - test "$DISABLE_RESTART_ON_UPDATE" != yes -a -x /usr/bin/systemctl; then \ + if [ -x /usr/bin/systemctl ]; then \ /usr/bin/systemctl daemon-reload || : \ - /usr/bin/systemctl try-restart %{?*} || : \ + ( %_restart_check_systemctl %{?*} || : ) \ fi \ else # package uninstall \ for service in %{?*} ; do \ @@ -150,7 +161,7 @@ fi \ if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \ # Package removal, not upgrade \ /usr/bin/systemctl --no-reload disable %{?*} || : \ - /usr/bin/systemctl stop %{?*} || : \ + ( %_stop_check_systemctl %{?*} || : ) \ fi \ %{nil} @@ -160,7 +171,7 @@ fi \ if [ "$1" -eq 0 -a -x /usr/bin/systemctl ]; then \ # Package removal, not upgrade \ /usr/bin/systemctl --no-reload disable %{?*} || : \ - /usr/bin/systemctl stop %{?*} || : \ + ( %_stop_check_systemctl %{?*} || : ) \ fi \ %{nil} diff --git a/systemd-rpm-macros.changes b/systemd-rpm-macros.changes index b476516..89bf7fa 100644 --- a/systemd-rpm-macros.changes +++ b/systemd-rpm-macros.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Nov 20 16:53:23 UTC 2015 - werner@suse.de + +- Support of DISABLE_STOP_ON_REMOVAL and DISABLE_RESTART_ON_UPDATE + from /etc/sysconfig/service (bsc#955996) + ------------------------------------------------------------------- Fri Sep 18 15:27:04 CEST 2015 - sbrabec@suse.com