openocd: avoid documentation rebuild to fix build issues
[buildroot-gz.git] / package / igd2-for-linux / S99upnpd
blobc023fa47465061553716462f9bcb320b1a367ad1
1 #!/bin/sh
3 NAME=upnpd
4 PIDFILE=/var/run/$NAME.pid
5 DAEMON=/usr/sbin/$NAME
6 CFGFILE=/etc/default/$NAME
8 LAN=eth0
9 WAN=eth0
11 # For the UPnP library to function correctly, networking must be configured
12 # properly for multicasting as described in
13 # https://sourceforge.net/p/pupnp/code/ci/master/tree/README.
14 # Without this addition, device advertisements and control point searches will
15 # not function.
16 # However, the route has to be configured once for all UPnP applications
17 # (igd2-for-linux, ushare, ...) so do not manage UPnP route by default
18 MANAGE_UPNP_MULTICAST_ROUTE_ON_LAN=0
20 # Read configuration variable file if it is present
21 if [ -f $CFGFILE ]; then
22 . $CFGFILE
25 DAEMON_ARGS="-f $WAN $LAN"
27 start() {
28 if [ $MANAGE_UPNP_MULTICAST_ROUTE_ON_LAN != 0 ]; then
29 printf "Add UPnP multicast route on $LAN\n"
30 route add -net 239.0.0.0 netmask 255.0.0.0 $LAN
32 printf "Starting $NAME: "
33 start-stop-daemon -S -q -m -b -p $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
34 [ $? = 0 ] && echo "OK" || echo "FAIL"
37 stop() {
38 printf "Stopping $NAME: "
39 start-stop-daemon -K -q -p $PIDFILE
40 [ $? = 0 ] && echo "OK" || echo "FAIL"
41 if [ $MANAGE_UPNP_MULTICAST_ROUTE_ON_LAN != 0 ]; then
42 printf "Remove UPnP multicast route on $LAN\n"
43 route del -net 239.0.0.0 netmask 255.0.0.0 $LAN
47 restart() {
48 stop
49 start
52 case "$1" in
53 start)
54 start
56 stop)
57 stop
59 restart|reload)
60 restart
63 echo "Usage: $0 {start|stop|restart|reload}"
64 exit 1
65 esac
67 exit $?