diff --git a/MANIFEST.in b/MANIFEST.in index 30dc6af..db8ce7c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,8 @@ recursive-include debian changelog compat control copyright rules -recursive-include debian *.init *.lintian-overrides +recursive-include debian *.lintian-overrides *.service recursive-include test README *.py recursive-include tls README *.sh prune debian/tmp prune debian/msrprelay prune debian/python-module-stampdir include config.ini.sample MANIFEST.in LICENSE INSTALL Changelog diff --git a/debian/msrprelay.init b/debian/msrprelay.init deleted file mode 100644 index 1832074..0000000 --- a/debian/msrprelay.init +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: msrprelay -# Required-Start: $syslog $network $local_fs $remote_fs $time -# Required-Stop: $syslog $network $local_fs $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start the MSRP relay -# Description: Start the MSRP relay -### END INIT INFO - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -INSTALL_DIR="/usr/bin" -RUNTIME_DIR="/var/run/msrprelay" - -SERVER="$INSTALL_DIR/msrprelay" -PID="$RUNTIME_DIR/relay.pid" - -# Options for the MSRP Relay. Do not include --pid -# --pid will be added automatically if needed. -OPTIONS="" - -NAME="msrprelay" -DESC="MSRP Relay" - -test -f $SERVER || exit 0 - -. /lib/lsb/init-functions - -if [ "$PID" != "/var/run/msrprelay/relay.pid" ]; then - OPTIONS="--pid $PID $OPTIONS" -fi - -start() { - echo -n "Starting $DESC: $NAME" - start-stop-daemon --start --quiet --pidfile $PID --exec $SERVER -- $OPTIONS - echo "." -} - -stop () { - echo -n "Stopping $DESC: $NAME" - start-stop-daemon --stop --quiet --oknodo --signal 15 --pidfile $PID - echo "." -} - -reload () { - echo -n "Reloading $DESC: $NAME" - start-stop-daemon --stop --quiet --oknodo --signal 1 --pidfile $PID - echo "." -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - reload) - reload - ;; - restart|force-reload) - stop - #sleep 1 - start - ;; - *) - echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 - diff --git a/debian/msrprelay.service b/debian/msrprelay.service new file mode 100644 index 0000000..ed9ace1 --- /dev/null +++ b/debian/msrprelay.service @@ -0,0 +1,14 @@ +[Unit] +Description=MSRP Relay +After=network.target nss-lookup.target mysqld.service mariadb.service thor-eventserver.service + +[Service] +Type=simple +Environment=PYTHONUNBUFFERED=yes +ExecStart=/usr/bin/msrprelay --systemd +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-abnormal +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/debian/rules b/debian/rules index ff56bb6..99fc056 100644 --- a/debian/rules +++ b/debian/rules @@ -1,19 +1,22 @@ #!/usr/bin/make -f #export DH_VERBOSE=1 %: dh $@ --with python2 --buildsystem=pybuild override_dh_clean: dh_clean rm -rf build dist MANIFEST override_dh_auto_install: dh_auto_install mv debian/msrprelay/etc/msrprelay/config.ini.sample debian/msrprelay/etc/msrprelay/config.ini +override_dh_installsystemd: + dh_installsystemd --no-start + override_dh_fixperms: dh_fixperms chmod 600 debian/msrprelay/etc/msrprelay/config.ini