]>
Commit | Line | Data |
---|---|---|
07603508 CS |
1 | #!/bin/sh |
2 | . /etc/sysconfig/rc | |
3 | . ${rc_functions} | |
4 | ||
5 | case "${1}" in | |
6 | start) | |
5f785e71 | 7 | boot_mesg "Starting hostapd... " |
aced02fa | 8 | mkdir -p /var/run/hostapd |
d2c65e37 AF |
9 | # enable wlan module of collectd |
10 | sed -i -e "s|#LoadPlugin wireless|LoadPlugin wireless|g" /etc/collectd.conf | |
5f785e71 AF |
11 | |
12 | # Set Atheros Card to master mode | |
13 | /usr/bin/wlanconfig blue0 destroy > /dev/null | |
14 | /usr/bin/wlanconfig blue0 create wlandev wifi0 wlanmode ap > /dev/null | |
15 | ||
16 | # Set other cards to master mode | |
17 | #/usr/sbin/iwconfig blue0 mode master | |
18 | ||
19 | if [ "$(/usr/sbin/iwconfig blue0 | /bin/grep "Mode:Master")" == "" ]; then | |
20 | boot_mesg "Error! Can't set wlan master mode" | |
21 | echo_failure; | |
22 | exit 1; | |
23 | else | |
24 | /usr/sbin/iwconfig blue0 channel 05 | |
25 | /usr/bin/hostapd -P /var/run/hostapd /etc/hostapd.conf </dev/tty12 >/dev/tty12 2>&1 & | |
26 | evaluate_retval | |
27 | fi | |
07603508 CS |
28 | ;; |
29 | ||
30 | stop) | |
06391e6d | 31 | boot_mesg "Stopping hostapd..." |
5f785e71 AF |
32 | |
33 | # Set Atheros Card to Managed mode | |
34 | /usr/bin/wlanconfig blue0 destroy > /dev/null | |
35 | /usr/bin/wlanconfig blue0 create wlandev wifi0 wlanmode sta > /dev/null | |
36 | ||
37 | # Set other cards to master mode | |
38 | #/usr/sbin/iwconfig blue0 mode Managed | |
39 | ||
07603508 CS |
40 | killproc /usr/bin/hostapd |
41 | evaluate_retval | |
42 | ;; | |
43 | ||
44 | restart) | |
45 | ${0} stop | |
46 | sleep 1 | |
47 | ${0} start | |
48 | ;; | |
49 | ||
50 | status) | |
51 | statusproc /usr/bin/hostapd | |
52 | ;; | |
53 | ||
54 | *) | |
55 | echo "Usage: ${0} {start|stop|restart|status}" | |
56 | exit 1 | |
57 | ;; | |
58 | esac |