diff options
Diffstat (limited to 'net-misc/minidlna/files/minidlna-1.1.0.initd')
-rw-r--r-- | net-misc/minidlna/files/minidlna-1.1.0.initd | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/net-misc/minidlna/files/minidlna-1.1.0.initd b/net-misc/minidlna/files/minidlna-1.1.0.initd new file mode 100644 index 000000000000..d820aef67fc2 --- /dev/null +++ b/net-misc/minidlna/files/minidlna-1.1.0.initd @@ -0,0 +1,53 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/minidlna/files/minidlna-1.1.0.initd,v 1.1 2013/05/11 22:19:45 xmw Exp $ + +depend() { + need net +} + +start() { + ebegin "Starting MiniDLNA" + local params="" + local stop=0 + + checkpath -q -d -m 0755 -o ${M_USER:-minidlna}:${M_GROUP:-minidlna} /var/run/minidlna + + params="$params -P /var/run/minidlna/minidlna.pid" + + if [[ "${RESCAN}" = "true" || "{$RESCAN}" = yes ]]; then + params="$params -R" + 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 \ + --user ${M_USER:-minidlna} --group ${M_GROUP:-minidlna} \ + --exec /usr/sbin/minidlnad -- ${params} + eend $? + fi +} + +stop() { + ebegin "Stopping MiniDLNA" + start-stop-daemon --stop --quiet --exec /usr/sbin/minidlnad + eend $? +} |