From ddfaf8c77bb510ac843a75945fc729d15a370e81 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Wed, 1 Oct 2014 15:15:11 +0200 Subject: [PATCH] MT#8125 postinst/postrm do not reload if not mgmt Change-Id: I1faac642ecd8f6a3d2d84884800a4267a391d30b --- debian/ngcp-schema.postinst | 52 ++++++++++++++++++++++++------------- debian/ngcp-schema.postrm | 20 +++++++++++++- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/debian/ngcp-schema.postinst b/debian/ngcp-schema.postinst index d2bb958b..845b515b 100755 --- a/debian/ngcp-schema.postinst +++ b/debian/ngcp-schema.postinst @@ -2,27 +2,43 @@ set -e -case "$1" in - configure) - if [ -x /etc/init.d/ngcp-panel ] ; then - if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then - echo "Force-reloading ngcp-panel to handle schema changes" - invoke-rc.d ngcp-panel force-reload || exit $? - else - echo "Force-reloading ngcp-panel to handle schema changes" - /etc/init.d/ngcp-panel force-reload || exit $? - fi +if [ -e /etc/default/ngcp-roles ]; then + . /etc/default/ngcp-roles +else + NGCP_IS_MGMT="yes" +fi + +do_reload() +{ + if [ "${NGCP_IS_MGMT}" != "yes" ]; then + echo "no mgmt role detected. Skip ngcp-panel and ngcp-www-csc reloads" + return + fi + + if [ -x /etc/init.d/ngcp-panel ] ; then + if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then + echo "Force-reloading ngcp-panel to handle schema changes" + invoke-rc.d ngcp-panel force-reload || exit $? + else + echo "Force-reloading ngcp-panel to handle schema changes" + /etc/init.d/ngcp-panel force-reload || exit $? fi + fi - if [ -x /etc/init.d/ngcp-www-csc ] ; then - if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then - echo "Force-reloading ngcp-www-csc to handle schema changes" - invoke-rc.d ngcp-www-csc force-reload || exit $? - else - echo "Force-reloading ngcp-www-csc to handle schema changes" - /etc/init.d/ngcp-www-csc force-reload || exit $? - fi + if [ -x /etc/init.d/ngcp-www-csc ] ; then + if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then + echo "Force-reloading ngcp-www-csc to handle schema changes" + invoke-rc.d ngcp-www-csc force-reload || exit $? + else + echo "Force-reloading ngcp-www-csc to handle schema changes" + /etc/init.d/ngcp-www-csc force-reload || exit $? fi + fi +} + +case "$1" in + configure) + do_reload ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/ngcp-schema.postrm b/debian/ngcp-schema.postrm index 7db0518e..188f38af 100755 --- a/debian/ngcp-schema.postrm +++ b/debian/ngcp-schema.postrm @@ -2,7 +2,19 @@ set -e -if [ "$1" = "remove" ]; then +if [ -e /etc/default/ngcp-roles ]; then + . /etc/default/ngcp-roles +else + NGCP_IS_MGMT="yes" +fi + +do_reload() +{ + if [ "${NGCP_IS_MGMT}" != "yes" ]; then + echo "no mgmt role detected. Skip ngcp-panel and ngcp-www-csc reloads" + return + fi + if [ -x /etc/init.d/ngcp-panel ] ; then if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then echo "Force-reloading ngcp-panel to handle schema changes" @@ -22,4 +34,10 @@ if [ "$1" = "remove" ]; then /etc/init.d/ngcp-www-csc force-reload || exit $? fi fi +} + +if [ "$1" = "remove" ]; then + do_reload fi + +exit 0