Merge pull request #26 from Noltari/mcproxy-next
[feed/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
16 start_service() {
17 mkdir -p $DNSMASQ_DIR
18 procd_open_instance
19 procd_set_param command /usr/sbin/hnetd
20
21 # SD parts are here (make configurable?)
22 if [ -f $OHP_BINARY -a -f $DNSMASQ_SCRIPT ]
23 then
24 mkdir -p $DNSMASQ_DIR
25 procd_append_param command -d $DNSMASQ_SCRIPT
26 procd_append_param command -f $DNSMASQ_DIR/hnet.conf
27 procd_append_param command -o $OHP_SCRIPT
28 HOSTNAME=`cat /proc/sys/kernel/hostname`
29 if [ -n "$HOSTNAME" ]
30 then
31 procd_append_param command -n "$HOSTNAME"
32 fi
33 fi
34 # State file
35 procd_append_param command -s /tmp/hnetd.pa_state
36
37 # Routing script
38 procd_append_param command -r /usr/sbin/hnetd-routing
39
40 procd_set_param respawn
41 procd_close_instance
42 }