aboutsummaryrefslogtreecommitdiffstats
path: root/testing/minidlna/minidlna.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/minidlna/minidlna.initd')
-rw-r--r--testing/minidlna/minidlna.initd50
1 files changed, 12 insertions, 38 deletions
diff --git a/testing/minidlna/minidlna.initd b/testing/minidlna/minidlna.initd
index bb20626138..a31c5aea97 100644
--- a/testing/minidlna/minidlna.initd
+++ b/testing/minidlna/minidlna.initd
@@ -1,48 +1,22 @@
#!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/minidlna/files/minidlna.initd,v 1.1 2010/12/29 16:59:25 xmw Exp $
+
+name="MiniDLNA"
+configfile="${CONFIG:-/etc/minidlna.conf}"
+start_stop_daemon_args="--user ${M_USER:-minidlna} --group ${M_GROUP:-minidlna}"
+command=/usr/sbin/minidlna
+command_args="-f ${configfile}"
depend() {
need net
}
-start() {
- ebegin "Starting MiniDLNA"
- local params=""
- local stop=0
-
- if [[ "${RESCAN}" = "true" || "{$RESCAN}" = yes ]]; then
- params="$params -R"
+start_pre() {
+ if ! [ -f "${configfile}" ]; then
+ eerror "${configfile} is missing"
+ return 1
fi
-
- #set the config file and check if it exists
- if [ -z "${CONFIG}" ]; then
- if [ ! -f "/etc/minidlna.conf" ]; then
- ewarn "You did not set the config file correctly"
- stop=1
- fi
- params="$params -f /etc/minidlna.conf"
- else
- if [ ! -f "${CONFIG}" ]; then
- ewarn "The specified config file does not exist"
- stop=1
- fi
- params="$params -f ${CONFIG}"
- fi
-
-
- if [ $stop -eq 1 ]; then
- eend 1
- else
- start-stop-daemon --start \
- --exec /usr/sbin/minidlna -- ${params}
- eend $?
+ if yesno "${RESCAN}"; then
+ command_args="$command_args -R"
fi
}
-stop() {
- ebegin "Stopping MiniDLNA"
- start-stop-daemon --stop --quiet --exec /usr/sbin/minidlna
- eend $?
-}