MT#8741 remove init script tricks

mr3.4.2
Victor Seva 12 years ago
parent 824b8baa63
commit 8b3a87eeed

@ -5,9 +5,11 @@ set -e
dpkg-maintscript-helper rm_conffile /etc/default/sems -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init.d/sems -- "$@"
# don't do anything when called with other argument than configure
case "$1" in
configure)
# add sems user
adduser --quiet --system --group --disabled-password --shell /bin/false \
--gecos "SIP Express Media Server" --home /var/run/ngcp-sems sems || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
@ -18,54 +20,6 @@ case "$1" in
;;
esac
restart_handler() {
if [ -x "/etc/init.d/ngcp-sems" ]; then
if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then
invoke-rc.d ngcp-sems restart || exit $?
else
/etc/init.d/ngcp-sems restart || exit $?
fi
fi
}
initscript_handler() {
if [ -x "/etc/init.d/ngcp-sems" ]; then
update-rc.d ngcp-sems defaults >/dev/null
invoke-rc.d ngcp-sems start || exit $?
fi
}
init_handler() {
# just invoke init script wrappers 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
restart_handler
initscript_handler
else # do not restart daemon on inactive node in pro systems
if ngcp-check_active ; then
echo "Active node detected, restarting ngcp-sems"
restart_handler
else
echo "Inactive node detected, ignoring request to restart ngcp-sems"
fi
fi
}
# add sems user
adduser --quiet --system --group --disabled-password --shell /bin/false \
--gecos "SIP Express Media Server" --home /var/run/ngcp-sems sems || true
init_handler
echo ""
echo "***"
echo "Configuration of ngcp-sems has finished."
echo ""
echo "To restart it when configuration has changed use '/etc/init.d/ngcp-sems restart'"
echo ""
echo "To change it's configuration use 'dpkg-reconfigure ngcp-sems'"
echo "***"
echo ""
#DEBHELPER#
exit 0

@ -1,18 +0,0 @@
#!/bin/sh
# postrm script for ngcp-sems
set -e
removal_wrapper() {
# remove the init script only on ce systems, as the
# the pro system handle it inside the monitoring/HA setup
if ! [ -x "$(which ngcp-check_active 2>/dev/null)" ]; then
update-rc.d ngcp-sems remove >/dev/null
fi
}
if [ "$1" = "purge" ] ; then
removal_wrapper
fi
exit 0
Loading…
Cancel
Save