summaryrefslogtreecommitdiff
path: root/net-misc/minidlna/files/minidlna-1.1.5.initd
blob: 416f122fa904f42845945cf6a129b6bb1273eef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

: ${CONFIG:=/etc/minidlna.conf}
: ${M_USER:=minidlna}
: ${M_GROUP:=minidlna}

name="MiniDLNA"

pidfile="/run/minidlna/minidlna.pid"
command="/usr/sbin/minidlnad"
command_args="-P $pidfile -f $CONFIG"
start_stop_daemon_args="--user ${M_USER}:${M_GROUP}"

required_files="$CONFIG"

depend() {
	need net
}

start_pre() {
	if [ "$M_USER" = "root" ]; then
		eerror "It's not a good idea to run minidlna as root!"
	fi

	if yesno "$RESCAN"; then
		command_args="$command_args -R"
	fi

	checkpath -q -d -m 0750 -o "${M_USER}:${M_GROUP}" "$(dirname "$pidfile")"
}