updated on Mon Jan 16 12:07:49 UTC 2012
[aur-mirror.git] / coova-chilli-arch / coova-chilli
blobdccfc06afb60ae11b4ced48520c5f9f89f83e625
1 #!/bin/bash
3 daemon_name=coova-chilli
5 . /etc/rc.conf
6 . /etc/rc.d/functions
7 . /etc/chilli/functions
9 DAEMON=/usr/sbin/chilli
10 NAME=chilli
11 DESC=chilli
12 START_CHILLI=1
14 if [ "$START_CHILLI" != "1" ] ; then
15 echo "Chilli default off. Look at /etc/default/chilli"
16 exit 0
19 test -f $DAEMON || exit 0
21 MULTI=$(ls /etc/chilli/*/chilli.conf 2>/dev/null)
22 [ -z "$DHCPIF" ] && [ -n "$MULTI" ] && {
23 for c in $MULTI;
25 echo "Found configuration $c"
26 DHCPIF=$(basename $(echo $c|sed 's#/chilli.conf##'))
27 export DHCPIF
28 echo "Running DHCPIF=$DHCPIF $0 $*"
29 sh $0 $*
30 done
31 exit
34 if [ -n "$DHCPIF" ]; then
35 CONFIG=/etc/chilli/$DHCPIF/chilli.conf
36 else
37 CONFIG=/etc/chilli.conf
40 [ -f $CONFIG ] || {
41 echo "$CONFIG Not found"
42 exit 0
46 case "$1" in
47 start)
48 stat_busy "Starting Coovachilli"
49 /sbin/modprobe tun >/dev/null 2>&1
50 echo 1 > /proc/sys/net/ipv4/ip_forward
52 writeconfig
53 radiusconfig
55 test ${HS_ADMINTERVAL:-0} -gt 0 && {
56 (crontab -l 2>&- | grep -v $0
57 echo "*/$HS_ADMINTERVAL * * * * $0 radconfig"
58 ) | crontab - 2>&-
61 ifconfig $HS_LANIF 0.0.0.0
63 [ ! -d /var/run/coovachilli ] && install -d /var/run/coovachilli
64 if $DAEMON start >/dev/null ; then
65 add_daemon $daemon_name
66 stat_done
67 else
68 stat_fail
69 exit 1
73 stop)
74 stat_busy "Stopping Coovachilli"
75 crontab -l 2>&- | grep -v $0 | crontab -
76 if $DAEMON stop >/dev/null ; then
77 rm_daemon $daemon_name
78 stat_done
79 else
80 stat_fail
81 exit 1
87 restart)
88 stat_busy "Restarting Coovachilli"
89 if $DAEMON restart >/dev/null ; then
90 add_daemon $daemon_name
91 stat_done
92 else
93 stat_fail
94 exit 1
98 condrestart)
99 stat_busy "Restarting Coovachilli"
100 if DAEMON restart >/dev/null ; then
101 add_daemon $daemon_name
102 stat_done
103 else
104 stat_fail
105 exit 1
109 status)
110 stat_busy "Checking Coovachilli status";
111 ck_status $daemon_name
114 reload)
115 stat_busy "Reloading Coovachilli"
116 if $DAEMON graceful >/dev/null ; then
117 add_daemon $daemon_name
118 stat_done
119 else
120 stat_fail
121 exit 1
125 radconfig)
126 [ -e $MAIN_CONF ] || writeconfig
127 radiusconfig
133 echo "usage: $0 {start|stop|restart|condrestart|status|reload|radconfig}"
134 esac
136 exit 0