[SCM] mediatomb/master: daemon: switch envvars to use MT_ prefix from upstream configuration.

zumbi at users.alioth.debian.org zumbi at users.alioth.debian.org
Mon Oct 13 15:08:33 UTC 2014


The following commit has been merged in the master branch:
commit 5acd74434fbe71aa638529720fc5f11d14a857db
Author: Héctor Orón Martínez <zumbi at debian.org>
Date:   Sun Oct 12 14:05:57 2014 +0200

    daemon: switch envvars to use MT_ prefix from upstream configuration.
    
    Signed-off-by: Héctor Orón Martínez <zumbi at debian.org>

diff --git a/debian/mediatomb-daemon.mediatomb.default b/debian/mediatomb-daemon.mediatomb.default
index 8805025..bec758a 100644
--- a/debian/mediatomb-daemon.mediatomb.default
+++ b/debian/mediatomb-daemon.mediatomb.default
@@ -1,28 +1,34 @@
-# Defaults for MediaTomb initscript
-# sourced by /etc/init.d/mediatomb
-# installed at /etc/default/mediatomb by the maintainer scripts
+## This is a sambel configuration file for the MediaTomb daemon script
+## used on Fedora Core
+## also used by Debian, since Jessie release
 
-#
-# This is a POSIX shell fragment
-#
+## By default the configuration will be created in /etc/mediatomb
 
-# Set whether the daemon should be started. Set this value to anything
-# but 'yes' to enable the daemon
-NO_START="no"
+## Network interface on which the server will run, you need to edit this!
+MT_INTERFACE="lo"
 
-# Additional options that are passed to the daemon.
-OPTIONS=""
+## User defined command line options that may be passed to the server
+MT_OPTIONS=""
 
-# The network interface for MediaTomb to bind to and for which the multicast
-# routing entry should be added; "" if the route shouldn't be added at all.
-# For example: INTERFACE="eth0"
-INTERFACE=""
+## MediaTomb will be started on port 50500
+MT_PORT="50500"
 
+## MediaTomb will run as mediatomb
+MT_USER="mediatomb"
+MT_GROUP="mediatomb"
+
+## Location of the PID file
+MT_PIDFILE="/var/run/mediatomb.pid"
+
+## Location of the log file
+MT_LOGFILE="/var/log/mediatomb"
+
+## Location of the config file/database
+MT_HOME="/etc"
+MT_CFGDIR="mediatomb"
+
+# Debian: keep for compat with old sysv init script
 # The route command and arguments to be used if INTERFACE is defined.
 # These variables should normally be left unmodified.
 ROUTE_ADD="/sbin/route add -net 239.0.0.0 netmask 255.0.0.0"
 ROUTE_DEL="/sbin/route del -net 239.0.0.0 netmask 255.0.0.0"
-
-# The user and group that MediaTomb should be run as.
-USER="mediatomb"
-GROUP="mediatomb"
diff --git a/debian/mediatomb-daemon.mediatomb.init b/debian/mediatomb-daemon.mediatomb.init
index 8880321..5268a35 100644
--- a/debian/mediatomb-daemon.mediatomb.init
+++ b/debian/mediatomb-daemon.mediatomb.init
@@ -28,8 +28,8 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 DESC="upnp media server"
 NAME=mediatomb
 DAEMON=/usr/bin/$NAME
-PIDFILE=/var/run/$NAME.pid
-LOGFILE=/var/log/$NAME.log
+MT_PIDFILE=/var/run/$NAME.pid
+MT_LOGFILE=/var/log/$NAME
 SCRIPTNAME=/etc/init.d/$NAME
 DEFAULT=/etc/default/$NAME
 
@@ -54,29 +54,29 @@ if [ "$NO_START" = "yes" ] && [ "$1" != "stop" ]; then
 fi
 
 # Run as root if USER not specified
-if [ ! $USER ]; then
-	USER=root
+if [ ! $MT_USER ]; then
+	MT_USER=root
 fi
 
 # Check for an invalid user or one without a home directory
-eval USERHOME=~$USER
+eval USERHOME=~$MT_USER
 if [ "${USERHOME#/}" = "${USERHOME}" ]; then
-	log_failure_msg "$NAME: The user '$USER' specified in $DEFAULT is invalid."
+	log_failure_msg "$NAME: The user '$MT_USER' specified in $DEFAULT is invalid."
 	exit 1
 fi
 
 # Check if group is not specified and assign a proper group
-if [ -z $GROUP ]; then
-    GROUP="$USER"
+if [ -z $MT_GROUP ]; then
+    MT_GROUP="$USER"
 fi
 
-if [ "$INTERFACE" != "" ] ; then
-    INTERFACE_ARG="-e $INTERFACE"
+if [ "$MT_INTERFACE" != "" ] ; then
+    INTERFACE_ARG="-e $MT_INTERFACE"
 else
     INTERFACE_ARG=""
 fi
 
-DAEMON_ARGS="-c /etc/mediatomb/config.xml -d -u $USER -g $GROUP -P $PIDFILE -l $LOGFILE $INTERFACE_ARG $OPTIONS"
+DAEMON_ARGS="-c /etc/mediatomb/config.xml -d -u $MT_USER -g $MT_GROUP -P $MT_PIDFILE -l $MT_LOGFILE $INTERFACE_ARG $OPTIONS"
 
 #
 #       Function that starts the daemon/service.
@@ -86,14 +86,14 @@ do_start() {
 	#   0 if daemon has been started
 	#   1 if daemon was already running
 	#   2 if daemon could not be started
-	touch $PIDFILE
-	chown $USER:$GROUP $PIDFILE
-	touch $LOGFILE
-	chown $USER:$GROUP $LOGFILE
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
+	touch $MT_PIDFILE
+	chown $MT_USER:$MT_GROUP $MT_PIDFILE
+	touch $MT_LOGFILE
+	chown $MT_USER:$MT_GROUP $MT_LOGFILE
+	start-stop-daemon --start --quiet --pidfile $MT_PIDFILE --exec $DAEMON \
 		--test > /dev/null \
 		|| return 1
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+	start-stop-daemon --start --quiet --pidfile $MT_PIDFILE --exec $DAEMON -- \
 		$DAEMON_ARGS \
 		|| return 2
 }
@@ -107,10 +107,10 @@ do_stop() {
 	#   1 if daemon was already stopped
 	#   2 if daemon could not be stopped
 	#   other if a failure occurred
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $MT_PIDFILE --name $NAME
 	RETVAL="$?"
 	[ "$RETVAL" = 2 ] && return 2
-	rm -f $PIDFILE
+	rm -f $MT_PIDFILE
 	return "$RETVAL"
 }
 
@@ -118,26 +118,26 @@ do_stop() {
 #       Function that sends a SIGHUP to the daemon/service.
 #
 do_reload() {
-	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+	start-stop-daemon --stop --signal 1 --quiet --pidfile $MT_PIDFILE --name $NAME
 	return 0
 }
 
 case "$1" in
   start)
-	if [ -n "$INTERFACE" ]; then
+	if [ -n "$MT_INTERFACE" ]; then
 		# try to add the multicast route
 		if [ "$VERBOSE" != no ]; then
 			{
 				log_action_begin_msg \
 				"$NAME: Trying to add the multicast route"
-				$ROUTE_ADD $INTERFACE \
+				$ROUTE_ADD $MT_INTERFACE \
 				&& log_action_end_msg 0
 			} || {
 				true && \
 				log_warning_msg "Failed to add multicast route. skipping."
 			}
 		else
-			$ROUTE_ADD $INTERFACE >/dev/null 2>&1 || true
+			$ROUTE_ADD $MT_INTERFACE >/dev/null 2>&1 || true
 		fi
 	fi
 	log_daemon_msg "Starting $DESC" "$NAME"
@@ -154,13 +154,13 @@ case "$1" in
 	case "$?" in
 		0)
 			log_end_msg 0
-			if [ -n "$INTERFACE" ]; then
+			if [ -n "$MT_INTERFACE" ]; then
 				# try to add the multicast route
 				if [ "$VERBOSE" != no ]; then
 				{
 					log_action_begin_msg \
 					"$NAME: Trying to delete the multicast route"
-					$ROUTE_DEL $INTERFACE \
+					$ROUTE_DEL $MT_INTERFACE \
 					&& log_action_end_msg 0
 				} || {
 					true && \
@@ -168,7 +168,7 @@ case "$1" in
 					"Failed to delete multicast route. skipping."
 				}
 				else
-					$ROUTE_DEL $INTERFACE >/dev/null 2>&1 || true
+					$ROUTE_DEL $MT_INTERFACE >/dev/null 2>&1 || true
 				fi
 			fi
 			;;

-- 
MediaTomb packaging



More information about the pkg-multimedia-commits mailing list