diff --git a/debian/ngcp-sems.default b/debian/ngcp-sems.default deleted file mode 100644 index b9846ee2..00000000 --- a/debian/ngcp-sems.default +++ /dev/null @@ -1,26 +0,0 @@ -# configuration for SEMS - SIP Express Media Server -# -# this file is sourced by SEMS init script /etc/init.d/ngcp-sems - -# Don't start with default config as we need to deploy the ngcp-templates first -SEMS_RUN="no" - -# ser configuration file -SEMS_CFG_FILE="/etc/ngcp-sems/sems.conf" - -# user to run ser as -SEMS_USER="sems" - -# group to run ser as -SEMS_GROUP="sems" - -SEMS_RUNDIR="/var/run/ngcp-sems" - -# sems pidfile -SEMS_PIDFILE="$SEMS_RUNDIR/ngcp-sems.pid" - -# set if you want to create core files -SEMS_CREATE_CORE="yes" - -SEMS_CACHEDIR="/var/cache/ngcp-sems" -SEMS_CACHEDIR_EXTRADIRS="audio_cache callingcard" diff --git a/debian/ngcp-sems.init b/debian/ngcp-sems.init deleted file mode 100644 index 3b8d24c9..00000000 --- a/debian/ngcp-sems.init +++ /dev/null @@ -1,146 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: ngcp-sems sems -# Required-Start: $local_fs $remote_fs $network $syslog -# Required-Stop: $local_fs $remote_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Should-Start: mysql -# Should-Stop: mysql -# Short-Description: Start/stop SEMS Application Server -### END INIT INFO - -umask 0022 - -SEMS_CACHEDIR="/var/cache/ngcp-sems" - -# read configuration from /etc/default/ngcp-sems file -if test -f /etc/default/ngcp-sems ; then - . /etc/default/ngcp-sems -fi - - -if test "$SEMS_RUN" = "no" ; then - echo "Sems start disabled by default file" - exit 0 -fi - -PATH=/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/sbin/ngcp-sems -NAME=ngcp-sems -DESC=ngcp-sems - -PARAMS="" - -if ! test -d $SEMS_CACHEDIR ; then - mkdir -m 0755 -p $SEMS_CACHEDIR -fi - -for dir in $SEMS_CACHEDIR_EXTRADIRS ; do - if ! test -d ${SEMS_CACHEDIR}/${dir} ; then - mkdir -m 0755 -p ${SEMS_CACHEDIR}/${dir} - fi -done - -if ! test -d $SEMS_RUNDIR ; then - mkdir -m 0755 -p $SEMS_RUNDIR -fi -chown -R $SEMS_USER:$SEMS_GROUP $SEMS_RUNDIR $SEMS_CACHEDIR - -if test "$SEMS_PIDFILE" ; then - PARAMS="$PARAMS -P $SEMS_PIDFILE" -fi - -if test "$SEMS_USER" ; then - PARAMS="$PARAMS -u $SEMS_USER" -fi - -if test "$SEMS_GROUP" ; then - PARAMS="$PARAMS -g $SEMS_GROUP" -fi - -if test "$SEMS_CFG_FILE" ; then - PARAMS="$PARAMS -f $SEMS_CFG_FILE" - CFGPARAMS="-f $SEMS_CFG_FILE" -fi - -if [ -x /usr/sbin/ngcp-virt-identify ]; then - if /usr/sbin/ngcp-virt-identify --type container; then - VIRT="yes" - fi -fi - -if test "$SEMS_CREATE_CORE" = "yes" ; then - if [ "$VIRT" = "yes" ]; then - echo "Container environment detected. Skipping core dump configuration." - else - ulimit -c unlimited - fi -fi - -if [ "$VIRT" = "yes" ]; then - echo "Container environment detected. Skipping file descriptors limit configuration." -else - # raise file descriptors limit - call hold consumes two fds for RTP ports and one for moh file - ulimit -n 100000 -fi - -if ! test -f $DAEMON ; then - echo "Error: cannot find $DAEMON" - exit 0 -fi - -LD_LIBRARY_PATH=/usr/lib/ngcp-sems -export LD_LIBRARY_PATH - -set -e - -. /lib/lsb/init-functions - -case "$1" in - start) - if [ -x /usr/sbin/ngcp-check_active ]; then - if ! /usr/sbin/ngcp-check_active -q; then - echo "Ignored start action in inactive node" - exit 0 - fi - fi - echo "Starting $DESC: $NAME" - start-stop-daemon --start --quiet --oknodo --pidfile $SEMS_PIDFILE \ - --exec $DAEMON -- $PARAMS - log_end_msg $? - ;; - stop) - echo -n "Stopping $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --pidfile $SEMS_PIDFILE \ - --signal 9 --exec $DAEMON - log_end_msg $? - ;; - restart|force-reload) - echo "Restarting $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --pidfile \ - $SEMS_PIDFILE --signal 9 --exec $DAEMON - if [ -x /usr/sbin/ngcp-check_active ]; then - if ! /usr/sbin/ngcp-check_active -q; then - echo "Ignored start action in inactive node" - exit 0 - fi - fi - sleep 5 - start-stop-daemon --oknodo --start --quiet --pidfile \ - $SEMS_PIDFILE --exec $DAEMON -- $PARAMS - echo "." - ;; - status) - status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? - ;; - *) - N=/etc/init.d/$NAME - # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 - exit 1 - ;; -esac - -exit 0 - diff --git a/debian/ngcp-sems.links b/debian/ngcp-sems.links new file mode 100644 index 00000000..47d6acad --- /dev/null +++ b/debian/ngcp-sems.links @@ -0,0 +1 @@ +lib/systemd/system/ngcp-sems.service lib/systemd/system/sems.service diff --git a/debian/ngcp-sems.lintian-overrides b/debian/ngcp-sems.lintian-overrides index 9b7c52b8..8de5065b 100644 --- a/debian/ngcp-sems.lintian-overrides +++ b/debian/ngcp-sems.lintian-overrides @@ -1 +1,2 @@ ngcp-sems: possible-gpl-code-linked-with-openssl +ngcp-sems: init.d-script-not-included-in-package etc/init.d/ngcp-sems diff --git a/debian/ngcp-sems.maintscript b/debian/ngcp-sems.maintscript new file mode 100644 index 00000000..fea423b9 --- /dev/null +++ b/debian/ngcp-sems.maintscript @@ -0,0 +1,2 @@ +rm_conffile /etc/default/ngcp-sems 1:1.6.0-1+0~mr6.3.0.0+0~ ngcp-sems +rm_conffile /etc/init.d/ngcp-sems 1:1.6.0-1+0~mr6.3.0.0+0~ ngcp-sems diff --git a/debian/ngcp-sems.postinst b/debian/ngcp-sems.postinst index 73acc76d..c7717538 100644 --- a/debian/ngcp-sems.postinst +++ b/debian/ngcp-sems.postinst @@ -2,14 +2,11 @@ set -e -dpkg-maintscript-helper rm_conffile /etc/default/sems -- "$@" -dpkg-maintscript-helper rm_conffile /etc/init.d/sems -- "$@" - 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 + --gecos "SIP Express Media Server" --home /run/ngcp-sems sems || true ;; abort-upgrade|abort-remove|abort-deconfigure) exit 0 diff --git a/debian/ngcp-sems.preinst b/debian/ngcp-sems.preinst deleted file mode 100644 index d91d7457..00000000 --- a/debian/ngcp-sems.preinst +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -if [ -x "/etc/init.d/sems" ]; then - update-rc.d sems remove >/dev/null -fi - -dpkg-maintscript-helper rm_conffile /etc/default/sems -- "$@" -dpkg-maintscript-helper rm_conffile /etc/init.d/sems -- "$@" - -#DEBHELPER# - -exit 0 diff --git a/debian/ngcp-sems.service b/debian/ngcp-sems.service new file mode 100644 index 00000000..3b4c695f --- /dev/null +++ b/debian/ngcp-sems.service @@ -0,0 +1,25 @@ +[Unit] +Description=NGCP SIP Express Media Server (SEMS) +After=mariadb.service +After=network-online.target +After=remote-fs.target +Requires=mariadb.service +Requires=remote-fs.target +Wants=network-online.target + +[Service] +Type=simple +User=sems +Group=sems +Environment=LD_LIBRARY_PATH=/usr/lib/sems-pbx +PassEnvironment=LD_LIBRARY_PATH +PIDFile=/run/ngcp-sems/ngcp-sems.pid +Restart=always +StartLimitInterval=10 +StartLimitBurst=5 +ExecStart=/usr/sbin/ngcp-sems -E -u sems -g sems -P /run/ngcp-sems/ngcp-sems.pid -f /etc/ngcp-sems/sems.conf +LimitNOFILE=100000 + +[Install] +WantedBy=multi-user.target +Alias=sems.service diff --git a/debian/ngcp-sems.tmpfiles.d.conf b/debian/ngcp-sems.tmpfiles.d.conf new file mode 100644 index 00000000..cc7cec4d --- /dev/null +++ b/debian/ngcp-sems.tmpfiles.d.conf @@ -0,0 +1,4 @@ +d /run/ngcp-sems 0755 sems sems +d /var/cache/ngcp-sems 0755 sems sems +d /var/cache/ngcp-sems/audio_cache 0755 sems sems +d /var/cache/ngcp-sems/callingcard 0755 sems sems diff --git a/debian/rules b/debian/rules index 85d01ab8..30639dff 100755 --- a/debian/rules +++ b/debian/rules @@ -45,6 +45,11 @@ override_dh_auto_install: dh_python2 dh_python2 /usr/lib/$(APP_NAME) + # config file needed to create cache and run dirs with tmpfiles.d (there + # is no .install file to make ) + mkdir -p $(CURDIR)/debian/$(APP_NAME)/usr/lib/tmpfiles.d/ + cp $(CURDIR)/debian/ngcp-sems.tmpfiles.d.conf $(CURDIR)/debian/$(APP_NAME)/usr/lib/tmpfiles.d/ngcp-sems.conf + override_dh_strip: dh_strip --dbgsym-migration='$(APP_NAME)-dbg (<= 1:1.6.0-1+0~mr6.0.0.0)' # MT#7431 those binaries aren't automatically stripped