[Pkg-voip-commits] [janus] 02/06: Fix and modernize SysV init script. Recommend recent sysvinit-utils.

Jonas Smedegaard dr at jones.dk
Sat Mar 25 13:10:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository janus.

commit c4907daf328615f3006f81f8881957d162bf11be
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Sat Mar 25 11:18:22 2017 +0100

    Fix and modernize SysV init script. Recommend recent sysvinit-utils.
---
 debian/control    |  1 +
 debian/janus.init | 63 +++++++++----------------------------------------------
 2 files changed, 11 insertions(+), 53 deletions(-)

diff --git a/debian/control b/debian/control
index f309bcb..3c86c05 100644
--- a/debian/control
+++ b/debian/control
@@ -45,6 +45,7 @@ Depends:
  ${shlibs:Depends},
 Recommends:
  ssl-cert,
+ sysvinit-utils (>= 2.88dsf-50),
 Suggests:
  janus-tools,
  janus-doc,
diff --git a/debian/janus.init b/debian/janus.init
index f5f0879..a528603 100644
--- a/debian/janus.init
+++ b/debian/janus.init
@@ -1,5 +1,8 @@
 #!/bin/sh
-
+# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
+if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
+    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
+fi
 ### BEGIN INIT INFO
 # Provides:          janus
 # Required-Start:    $remote_fs $syslog
@@ -7,59 +10,13 @@
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: Janus WebRTC gateway
-# Description:       Janus WebRTC gateway
+# Description:       General purpose WebRTC Gateway.
 ### END INIT INFO
 
-DEFAULTS=/etc/default/janus
-DESC=janus
-DAEMON=/usr/bin/janus
-DAEMON_NAME=janus
-DAEMON_USER=root
-PIDFILE="/var/run/$DAEMON_NAME.pid"
-LOGFILE="/var/log/$DAEMON_NAME.log"
-
-test -r $DEFAULTS && . $DEFAULTS
-
-if [ "$START_JANUS" != "yes" ]; then
-    log_failure_msg "$DESC not yet configured. Edit $DEFAULTS first."
-    exit 0
-fi
-
-. /lib/lsb/init-functions
+# Author: Jonas Smedegaard <dr at jones.dk>
 
-do_start () {
-    log_daemon_msg "Starting system $DAEMON_NAME daemon"
-    start-stop-daemon --start --background --no-close --pidfile $PIDFILE \
-        --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER \
-        --startas $DAEMON -- $DAEMON_OPTS >> $LOGFILE 2>&1
-    log_end_msg $?
-}
-do_stop () {
-    log_daemon_msg "Stopping system $DAEMON_NAME daemon"
-    start-stop-daemon --stop --pidfile $PIDFILE --retry 10
-    log_end_msg $?
-}
-
-case "$1" in
-
-    start|stop)
-        do_${1}
-        ;;
-
-    restart|reload|force-reload)
-        do_stop
-        do_start
-        ;;
-
-    status)
-        status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
-        ;;
-
-    *)
-        echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
-        exit 1
-        ;;
-
-esac
-exit 0
+DESC="Janus WebRTC gateway"
+DAEMON=/usr/bin/janus
 
+# This may be overridden in /etc/default/janus
+DAEMON_ARGS=${DAEMON_ARGS:---pid-file=$PIDFILE --disable-colors}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/janus.git



More information about the Pkg-voip-commits mailing list