blob: f16a01253696b9b60fd4a21346c1c258ceae66ac (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#!/sbin/openrc-run
depend() {
before miniupnpd minidlna
after net
}
### The following configuration settings can be set in /etc/conf.d/minissdpd -- note that "_IFACE" _must_ be set there!, for the others "minissdpd" has defaults:
# _IFACE -- Where to listen on -- specify either an IPv4 address with mask (e.g. "192.168.1.42/255.255.255.0"), or a network interface name (e.g. "eth0"). Can be multiple entries, specified as a bash array.
# _DAEMON -- The daemon to run
# _PIDFILE -- Use the following PID-file:
# _SOCKET -- Communicate via the following socket:
# _IP6 -- Should we enable IPv6 in addidion to IPv4?
# _TTL -- TTL of the package. By default 2 is used according to UDA.
# _DEVFILTER -- search/filter a specific device type. Leave unset out to not apply the filter.
# _DEBUG -- Should we generate log/ debug output?
# _LOGFILE -- Logfile whis is used in case $_DEBUG is true
if [ -z "${_DAEMON}" ]; then
_DAEMON="/usr/bin/minissdpd"
fi
if [ -z "${_SOCKET}" ]; then
_SOCKET='/var/run/minissdpd.sock'
fi
if [ -z "${_PIDFILE}" ]; then
_PIDFILE='/var/run/minissdpd.pid'
fi
# The options for the daemon
_DAEMON_ARGS=(
'-s' "${_SOCKET}"
'-p' "${_PIDFILE}"
)
if [ -n "${_TTL}" ]; then
_DAEMON_ARGS+=('-t' "${_TTL}")
fi
if [ -n "${_DEVFILTER}" ]; then
_DAEMON_ARGS+=('-f' "${_DEVFILTER}")
fi
for _if in "${_IFACE[@]}"; do
_DAEMON_ARGS+=('-i' "${_if}")
done
if "${_IP6}"; then
_DAEMON_ARGS+=('-6')
fi
if "${_DEBUG}"; then
if [ "${_DEBUG}" == "true" ]; then
_DAEMON_ARGS+=('-d')
_STARTSTOPDAEMON_DEBUG_ARGS=(
'--background'
'-1' "${_LOGFILE}" '-2' "${_LOGFILE}"
)
fi
else
_STARTSTOPDAEMON_DEBUG_ARGS=()
fi
start() {
ebegin "Starting $(basename "${_DAEMON}")"
if [ -z "${_IFACE}" ]; then
printf '%s\n' "Error: Variable '_IFACE' must be set in '/etc/conf.d/'."
fi
# Create $_PIDFILE
touch "${_PIDFILE}"
start-stop-daemon --pidfile "${_PIDFILE}" --start --verbose "${_STARTSTOPDAEMON_DEBUG_ARGS[@]}" --exec "${_DAEMON}" -- "${_DAEMON_ARGS[@]}"
eend "$?"
}
stop() {
ebegin "Stopping $(basename "${_DAEMON}")"
start-stop-daemon --pidfile "${_PIDFILE}" --stop --verbose
eend "$?"
}
|