From c3040939ccc9557f0f44927bf909177fbc1eb589 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 16 Apr 2018 15:55:11 +0200 Subject: [PATCH] TT#26264 Remove obsolete init script Replace old default file to a proper config file. Namespace all package specific debhelper files. Change-Id: I85b92f99b00298f214f2305447d181c5f5432d86 --- debian/control | 1 - debian/install | 1 - debian/lintian-overrides | 1 - debian/mediator.default | 25 ----- debian/mediator.init | 140 ------------------------- debian/ngcp-mediator.conf | 27 +++++ debian/ngcp-mediator.install | 2 + debian/ngcp-mediator.lintian-overrides | 2 + debian/ngcp-mediator.maintscript | 2 + debian/rules | 5 - 10 files changed, 33 insertions(+), 173 deletions(-) delete mode 100644 debian/install delete mode 100644 debian/lintian-overrides delete mode 100644 debian/mediator.default delete mode 100755 debian/mediator.init create mode 100644 debian/ngcp-mediator.conf create mode 100644 debian/ngcp-mediator.install create mode 100644 debian/ngcp-mediator.lintian-overrides create mode 100644 debian/ngcp-mediator.maintscript diff --git a/debian/control b/debian/control index fd85405..3529a15 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,6 @@ Homepage: https://www.sipwise.com/ Package: ngcp-mediator Architecture: any Depends: - lsb-base, ${misc:Depends}, ${shlibs:Depends}, Description: CDR creation tool for NGCP diff --git a/debian/install b/debian/install deleted file mode 100644 index c3af3a5..0000000 --- a/debian/install +++ /dev/null @@ -1 +0,0 @@ -mediator usr/bin/ diff --git a/debian/lintian-overrides b/debian/lintian-overrides deleted file mode 100644 index c4c191e..0000000 --- a/debian/lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -ngcp-mediator: binary-without-manpage usr/bin/mediator diff --git a/debian/mediator.default b/debian/mediator.default deleted file mode 100644 index ca75655..0000000 --- a/debian/mediator.default +++ /dev/null @@ -1,25 +0,0 @@ -RUN_MEDIATOR="yes" -PIDFILE="/var/run/mediator.pid" -FORK="yes" -INTERVAL="10" -SOURCE_HOST="localhost" -SOURCE_PORT="3306" -SOURCE_USER="mediator" -SOURCE_PASS='GimmeAllUr$$$' -SOURCE_DB="accounting" -DEST_HOST="localhost" -DEST_PORT="3306" -DEST_USER="mediator" -DEST_PASS='GimmeAllUr$$$' -DEST_DB="accounting" -PROV_HOST="localhost" -PROV_PORT="3306" -PROV_USER="mediator" -PROV_PASS='GimmeAllUr$$$' -PROV_DB="provisioning" -STATS_HOST="localhost" -STATS_PORT="3306" -STATS_USER="mediator" -STATS_PASS='GimmeAllUr$$$' -STATS_DB="stats" -STATS_PERIOD=1 diff --git a/debian/mediator.init b/debian/mediator.init deleted file mode 100755 index 9cb25a7..0000000 --- a/debian/mediator.init +++ /dev/null @@ -1,140 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: mediator -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Should-Start: mysql -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Ngcp Mediator -# Description: Create accounting CDRs -### END INIT INFO - - -PATH=/sbin:/bin:/usr/sbin:/usr/bin -NAME=mediator -DESC="ACC mediator" -RUN_MEDIATOR=no - -DAEMON=/usr/bin/mediator -DEFAULTS=/etc/default/mediator - -test -f "$DAEMON" || exit 0 - -# Load startup options if available -if [ -f $DEFAULTS ]; then - . $DEFAULTS || true -fi - -if [ "$RUN_MEDIATOR" != "yes" ]; then - echo "mediator not yet configured. Edit $DEFAULTS first." - exit 0 -fi -[ -z "$PIDFILE" ] && PIDFILE="/var/run/mediator.pid" - -. /lib/lsb/init-functions - - -OPTIONS="" - -[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS -D $PIDFILE" -[ -z "$INTERVAL" ] || OPTIONS="$OPTIONS -i $INTERVAL" -[ -z "$SOURCE_HOST" ] || OPTIONS="$OPTIONS -h $SOURCE_HOST" -[ -z "$SOURCE_PORT" ] || OPTIONS="$OPTIONS -o $SOURCE_PORT" -[ -z "$SOURCE_USER" ] || OPTIONS="$OPTIONS -u $SOURCE_USER" -[ -z "$SOURCE_PASS" ] || OPTIONS="$OPTIONS -p $SOURCE_PASS" -[ -z "$SOURCE_DB" ] || OPTIONS="$OPTIONS -b $SOURCE_DB" -[ -z "$DEST_HOST" ] || OPTIONS="$OPTIONS -H $DEST_HOST" -[ -z "$DEST_PORT" ] || OPTIONS="$OPTIONS -O $DEST_PORT" -[ -z "$DEST_USER" ] || OPTIONS="$OPTIONS -U $DEST_USER" -[ -z "$DEST_PASS" ] || OPTIONS="$OPTIONS -P $DEST_PASS" -[ -z "$DEST_DB" ] || OPTIONS="$OPTIONS -B $DEST_DB" -[ -z "$PROV_HOST" ] || OPTIONS="$OPTIONS -S $PROV_HOST" -[ -z "$PROV_PORT" ] || OPTIONS="$OPTIONS -T $PROV_PORT" -[ -z "$PROV_USER" ] || OPTIONS="$OPTIONS -R $PROV_USER" -[ -z "$PROV_PASS" ] || OPTIONS="$OPTIONS -A $PROV_PASS" -[ -z "$PROV_DB" ] || OPTIONS="$OPTIONS -N $PROV_DB" -[ -z "$STATS_HOST" ] || OPTIONS="$OPTIONS -Z $STATS_HOST" -[ -z "$STATS_PORT" ] || OPTIONS="$OPTIONS -z $STATS_PORT" -[ -z "$STATS_USER" ] || OPTIONS="$OPTIONS -W $STATS_USER" -[ -z "$STATS_PASS" ] || OPTIONS="$OPTIONS -w $STATS_PASS" -[ -z "$STATS_DB" ] || OPTIONS="$OPTIONS -X $STATS_DB" -[ -z "$STATS_PERIOD" ] || OPTIONS="$OPTIONS -x $STATS_PERIOD" -[ "$MAINTENANCE" = yes ] && OPTIONS="$OPTIONS -m" -if test "$FORK" = "yes" ; then - OPTIONS="$OPTIONS -d" -fi - - -case "$1" in - start) - if [ -x "/usr/sbin/ngcp-check_active" ]; then - /usr/sbin/ngcp-check_active -q - status=$? - case "${status}" in - 0|3) - echo "Active node or transition." - ;; - *) - echo "Ignored start action in inactive node ($status)" - exit 0 - ;; - esac - fi - set -e - - log_daemon_msg "Starting $DESC: $NAME" - # shellcheck disable=SC2086 - start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" \ - --exec "$DAEMON" -- $OPTIONS || log_progress_msg " already running" - log_end_msg $? - ;; - stop) - log_daemon_msg "Stopping $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --pidfile "$PIDFILE" \ - --exec "$DAEMON" --retry 5 - if [ "$?" -ne 0 ]; then - return $? - fi - rm -f $PIDFILE - log_end_msg $? - ;; - restart|force-reload) - log_daemon_msg "Restarting $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --pidfile \ - "$PIDFILE" --exec "$DAEMON" --retry 5 - if [ "$?" -ne 0 ]; then - return $? - fi - rm -f "$PIDFILE" - - if [ -x "/usr/sbin/ngcp-check_active" ]; then - /usr/sbin/ngcp-check_active -q - status=$? - case "${status}" in - 0|3) - echo "Active node or transition." - ;; - *) - echo "Ignored start action in inactive node ($status)" - exit 0 - ;; - esac - fi - set -e - # shellcheck disable=SC2086 - start-stop-daemon --start --quiet --pidfile \ - "$PIDFILE" --exec "$DAEMON" -- $OPTIONS - log_end_msg $? - ;; - status) - status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? - ;; - *) - echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 - exit 1 - ;; -esac - -exit 0 - diff --git a/debian/ngcp-mediator.conf b/debian/ngcp-mediator.conf new file mode 100644 index 0000000..dc5338a --- /dev/null +++ b/debian/ngcp-mediator.conf @@ -0,0 +1,27 @@ +loglevel=6 +pidfile=/run/mediator.pid +interval=10 +med-host=localhost +med-port=3306 +med-user=mediator +med-pass=GimmeAllUr$$$ +med-db=accounting +cdr-host=localhost +cdr-port=3306 +cdr-user=mediator +cdr-pass=GimmeAllUr$$$ +cdr-db=accounting +prov-host=localhost +prov-port=3306 +prov-user=mediator +prov-pass=GimmeAllUr$$$ +prov-db=provisioning +stats-host=localhost +stats-port=3306 +stats-user=mediator +stats-pass=GimmeAllUr$$$ +stats-db=stats +stats-period=1 +redis-host=localhost +redis-port=6379 +redis-db=21 diff --git a/debian/ngcp-mediator.install b/debian/ngcp-mediator.install new file mode 100644 index 0000000..000ae49 --- /dev/null +++ b/debian/ngcp-mediator.install @@ -0,0 +1,2 @@ +debian/ngcp-mediator.conf etc/ngcp-mediator/ +mediator usr/bin/ diff --git a/debian/ngcp-mediator.lintian-overrides b/debian/ngcp-mediator.lintian-overrides new file mode 100644 index 0000000..a284469 --- /dev/null +++ b/debian/ngcp-mediator.lintian-overrides @@ -0,0 +1,2 @@ +ngcp-mediator: binary-without-manpage usr/bin/mediator +ngcp-mediator: init.d-script-not-included-in-package etc/init.d/ngcp-mediator diff --git a/debian/ngcp-mediator.maintscript b/debian/ngcp-mediator.maintscript new file mode 100644 index 0000000..bc77164 --- /dev/null +++ b/debian/ngcp-mediator.maintscript @@ -0,0 +1,2 @@ +rm_conffile /etc/default/mediator 6.3.0.0+1~mr6.3.0.0 +rm_conffile /etc/init.d/mediator 6.3.0.0+1~mr6.3.0.0 diff --git a/debian/rules b/debian/rules index e2f099b..657234c 100755 --- a/debian/rules +++ b/debian/rules @@ -5,8 +5,3 @@ %: dh $@ - -override_dh_installinit: - dh_installinit --name=mediator - -.PHONY: override_dh_installinit