#!/bin/sh # postinst script for ngcp-mediaproxy-ng-daemon set -e # DEBHELPER like wrapper init_wrapper() { if [ -x "/etc/init.d/ngcp-mediaproxy-ng-daemon" ]; then if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then invoke-rc.d ngcp-mediaproxy-ng-daemon restart || exit $? else /etc/init.d/ngcp-mediaproxy-ng-daemon restart || exit $? fi fi } restart_daemon() { # just invoke init script wrapper on ce systems since # they do not provide ngcp-check_active and we don't # have to handle inactive nodes if ! [ -x "$(which ngcp-check_active 2>/dev/null)" ]; then init_wrapper else # do not restart daemon on inactive node in pro systems if ngcp-check_active ; then echo "Active node detected, restarting ngcp-mediaproxy-ng-daemon" init_wrapper else echo "Inactive node detected, ignoring request to restart ngcp-mediaproxy-ng-daemon" fi fi } case "$1" in configure) restart_daemon ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac