minimalist-pcproxy: Added.
[lede-routing/.git] / hnetd / files / hnetd.init
1 #!/bin/sh /etc/rc.common
2
3 # XXX - is there something that should cause reload? or can we just
4 # use info from netifd and let it handle dynamic changes? let's hope
5 # so..
6
7 START=90
8 STOP=10
9 USE_PROCD=1
10
11 DNSMASQ_DIR=/tmp/dnsmasq.d
12 DNSMASQ_SCRIPT=/etc/init.d/dnsmasq
13 OHP_SCRIPT=/usr/sbin/hnetd-ohp-script
14 OHP_BINARY=/usr/sbin/ohybridproxy
15 PCP_SCRIPT=/usr/sbin/hnetd-pcp-script
16 PCP_BINARY=/usr/sbin/minimalist-pcproxy
17
18 start_service() {
19     mkdir -p $DNSMASQ_DIR
20     procd_open_instance
21     procd_set_param command /usr/sbin/hnetd
22
23     # SD parts are here (make configurable?)
24     if [ -f $OHP_BINARY -a -f $DNSMASQ_SCRIPT ]
25     then
26         mkdir -p $DNSMASQ_DIR
27         procd_append_param command -d $DNSMASQ_SCRIPT
28         procd_append_param command -f $DNSMASQ_DIR/hnet.conf
29         procd_append_param command -o $OHP_SCRIPT
30         HOSTNAME=`cat /proc/sys/kernel/hostname`
31         if [ -n "$HOSTNAME" ]
32         then
33             procd_append_param command -n "$HOSTNAME"
34         fi
35     fi
36
37     # Enable PCP, if it's present
38     if [ -f $PCP_BINARY -a -f $PCP_SCRIPT ]
39     then
40         procd_append_param command -c $PCP_SCRIPT
41     fi
42
43     # State file
44     procd_append_param command -s /tmp/hnetd.pa_state
45
46     # Routing script
47     procd_append_param command -r /usr/sbin/hnetd-routing
48
49     procd_set_param respawn
50     procd_close_instance
51 }