]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/hostapd
Change persistant network rules to work with atheros/hostapd without removing the...
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / hostapd
1 #!/bin/sh
2 . /etc/sysconfig/rc
3 . ${rc_functions}
4
5 case "${1}" in
6 start)
7 boot_mesg "Starting hostapd... "
8 mkdir -p /var/run/hostapd
9 # enable wlan module of collectd
10 sed -i -e "s|#LoadPlugin wireless|LoadPlugin wireless|g" /etc/collectd.conf
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
28 ;;
29
30 stop)
31 boot_mesg "Stopping hostapd..."
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
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