[SCM] gerbera/master: Update sysvinit scripts
jcowgill at users.alioth.debian.org
jcowgill at users.alioth.debian.org
Sat Sep 23 17:48:16 UTC 2017
The following commit has been merged in the master branch:
commit ba8170ffd8a99f6ef6f9f3d9431f8a5bebbdbe6b
Author: James Cowgill <jcowgill at debian.org>
Date: Sat Sep 16 16:52:23 2017 +0100
Update sysvinit scripts
- Remove /etc/default/gerbera. Most options here can be set in the main
config file /etc/gerbers/config.xml. It might also confuse users using
systemd because the systemd service does not use this file.
- Don't setup any multicast routes in the init script. These routes are
only needed for obscure network setups (I think).
- Log files have a .log suffix.
- Remove unneeded overrides in rules file.
- Have stop-start-daemon handle users and pid file. Gerbera upstream no
longer supports some daemon related settings used before.
diff --git a/debian/gerbera.default b/debian/gerbera.default
deleted file mode 100644
index bec758a..0000000
--- a/debian/gerbera.default
+++ /dev/null
@@ -1,34 +0,0 @@
-## This is a sambel configuration file for the MediaTomb daemon script
-## used on Fedora Core
-## also used by Debian, since Jessie release
-
-## By default the configuration will be created in /etc/mediatomb
-
-## Network interface on which the server will run, you need to edit this!
-MT_INTERFACE="lo"
-
-## User defined command line options that may be passed to the server
-MT_OPTIONS=""
-
-## 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"
diff --git a/debian/gerbera.init b/debian/gerbera.init
index 5c44e54..90190ca 100644
--- a/debian/gerbera.init
+++ b/debian/gerbera.init
@@ -1,42 +1,34 @@
#! /bin/sh
+# Gerbera init script
#
-# MediaTomb initscript
-#
-# Original Author: Tor Krill <tor at excito.com>.
-# Modified by: Leonhard Wimmer <leo at mediatomb.cc>
-# Modified again by Andres Mejia <mcitadel at gmail.com> to
-# base it off of /etc/init.d/skeleton
-#
-#
+# Based off old mediatomb init script written by:
+# Tor Krill <tor at excito.com>,
+# Leonhard Wimmer <leo at mediatomb.cc>,
+# Andres Mejia <mcitadel at gmail.com>
### BEGIN INIT INFO
-# Provides: mediatomb
-# Required-Start: $local_fs $network $remote_fs
-# Required-Stop: $local_fs $network $remote_fs
+# Provides: gerbera
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
-# Short-Description: upnp media server
-# Description: Debian init script for the upnp media server
+# Short-Description: Run the Gerbera UPnP media server
+# Description: Run the Gerbera UPnP media server
### END INIT INFO
-# Do NOT "set -e"
+DESC="Gerbera UPnP media server"
+NAME=gerbera
+GERBERA_CONFIG=/etc/gerbera/config.xml
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
-DESC="upnp media server"
-NAME=mediatomb
DAEMON=/usr/bin/$NAME
-MT_PIDFILE=/var/run/$NAME.pid
-MT_LOGFILE=/var/log/$NAME
+PIDFILE=/var/run/$NAME.pid
+LOGFILE=/var/log/$NAME.log
SCRIPTNAME=/etc/init.d/$NAME
-DEFAULT=/etc/default/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
-# Read configuration variable file if it is present
-[ -r $DEFAULT ] && . $DEFAULT
-
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
@@ -44,40 +36,7 @@ DEFAULT=/etc/default/$NAME
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
-# Start the daemon if NO_START is disabled in DEFAULT
-if [ "$NO_START" = "yes" ] && [ "$1" != "stop" ]; then
- log_warning_msg "$NAME: Not starting $DESC."
- log_warning_msg "$NAME: Disabled in $DEFAULT."
- exit 0
-fi
-
-# Run as root if USER not specified
-if [ ! $MT_USER ]; then
- log_failure_msg "$NAME: No user '$MT_USER' specified in $DEFAULT file."
- log_failure_msg "Configuration variables have been renamed to add a MT_ prefix"
- log_failure_msg "Please update configuration file in $DEFAULT."
- exit 1
-fi
-
-# Check for an invalid user or one without a home directory
-eval USERHOME=~$MT_USER
-if [ "${USERHOME#/}" = "${USERHOME}" ]; then
- 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 $MT_GROUP ]; then
- MT_GROUP="$USER"
-fi
-
-if [ "$MT_INTERFACE" != "" ] ; then
- INTERFACE_ARG="-e $MT_INTERFACE"
-else
- INTERFACE_ARG=""
-fi
-
-DAEMON_ARGS="-c /etc/mediatomb/config.xml -d -u $MT_USER -g $MT_GROUP -P $MT_PIDFILE -l $MT_LOGFILE $INTERFACE_ARG $OPTIONS"
+DAEMON_ARGS="-c $GERBERA_CONFIG -l $LOGFILE"
#
# Function that starts the daemon/service.
@@ -87,15 +46,15 @@ do_start() {
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
- 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 \
+ touch $LOGFILE
+ chmod 640 $LOGFILE
+ chown gerbera:adm $LOGFILE
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
--test > /dev/null \
|| return 1
- start-stop-daemon --start --quiet --pidfile $MT_PIDFILE --exec $DAEMON -- \
- $DAEMON_ARGS \
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
+ --chuid gerbera:gerbera \
+ --background --make-pidfile -- $DAEMON_ARGS \
|| return 2
}
@@ -108,10 +67,11 @@ 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 $MT_PIDFILE --name $NAME
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
+ --pidfile $PIDFILE --remove-pidfile --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
- rm -f $MT_PIDFILE
+ rm -f $PIDFILE
return "$RETVAL"
}
@@ -119,28 +79,12 @@ do_stop() {
# Function that sends a SIGHUP to the daemon/service.
#
do_reload() {
- start-stop-daemon --stop --signal 1 --quiet --pidfile $MT_PIDFILE --name $NAME
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
- 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 $MT_INTERFACE \
- && log_action_end_msg 0
- } || {
- true && \
- log_warning_msg "Failed to add multicast route. skipping."
- }
- else
- $ROUTE_ADD $MT_INTERFACE >/dev/null 2>&1 || true
- fi
- fi
log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
@@ -153,26 +97,7 @@ case "$1" in
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
- 0)
- log_end_msg 0
- 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 $MT_INTERFACE \
- && log_action_end_msg 0
- } || {
- true && \
- log_warning_msg \
- "Failed to delete multicast route. skipping."
- }
- else
- $ROUTE_DEL $MT_INTERFACE >/dev/null 2>&1 || true
- fi
- fi
- ;;
+ 0) log_end_msg 0 ;;
1) log_warning_msg "$DESC" "'$NAME'" "was already stopped" ;;
2) log_end_msg 1 ;;
esac
@@ -186,11 +111,6 @@ case "$1" in
log_end_msg $?
;;
restart)
- #
- # If the "reload" option is implemented, move the "force-reload"
- # option to the "reload" entry above. If not, "force-reload" is
- # just the same as "restart".
- #
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
@@ -210,8 +130,7 @@ case "$1" in
esac
;;
*)
- #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
exit 3
;;
esac
diff --git a/debian/gerbera.postrm b/debian/gerbera.postrm
index 94477de..7e187f4 100644
--- a/debian/gerbera.postrm
+++ b/debian/gerbera.postrm
@@ -8,8 +8,8 @@ fi
if [ "$1" = "purge" ] ; then
invoke-rc.d gerbera stop || true
- rm -rf /var/log/gerbera /var/log/gerbera* \
- /var/run/gerbera.pid /var/lib/gerbera
+ rm -rf /var/lib/gerbera
+ rm -rf /var/log/gerbera.log* /var/run/gerbera.pid
dpkg-statoverride --remove /etc/gerbera/config.xml
dpkg-statoverride --remove /var/lib/gerbera
deluser --system gerbera || true
diff --git a/debian/rules b/debian/rules
index d72e110..b8796e6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,12 +1,5 @@
#!/usr/bin/make -f
# -*- makefile -*-
-override_dh_installinit:
- dh_installinit --name=mediatomb \
- --update-rcd-params='defaults 98 02'
-
-override_dh_installlogrotate:
- dh_installlogrotate --name=gerbera
-
%:
dh $@
--
gerbera packaging
More information about the pkg-multimedia-commits
mailing list