]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame_incremental - src/initscripts/init.d/hostapd
Fixed hostap backup routine
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / hostapd
... / ...
CommitLineData
1#!/bin/sh
2. /etc/sysconfig/rc
3. ${rc_functions}
4
5CHANNEL="05"
6TXPOWER="auto"
7INTERFACE="blue0"
8eval $(/usr/local/bin/readhash /var/ipfire/wlanap/settings)
9
10case "${1}" in
11 start)
12 mkdir -p /var/run/hostapd
13 if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode:Master")" == "" ]; then
14
15 boot_mesg "Setting wlan $INTERFACE to Master mode... "
16
17 # Set Atheros Cards to master mode
18 if [ -d /proc/net/madwifi/ath0/ ]; then
19 /usr/bin/wlanconfig ath0 destroy > /dev/null
20 fi
21
22 /usr/bin/wlanconfig $INTERFACE destroy > /dev/null
23 /usr/bin/wlanconfig $INTERFACE create wlandev wifi0 wlanmode ap > /dev/null
24
25 # Set other cards to master mode
26 #/usr/sbin/iwconfig blue0 mode master
27 fi
28
29 if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode:Master")" == "" ]; then
30 boot_mesg "Error! Can't set wlan master mode"
31 echo_failure;
32 exit 1;
33 else
34 # enable wlan module of collectd
35 sed -i -e "s|#LoadPlugin wireless|LoadPlugin wireless|g" /etc/collectd.conf
36
37 boot_mesg "Starting hostapd... "
38 /usr/sbin/iwconfig $INTERFACE channel $CHANNEL
39 /usr/sbin/iwconfig $INTERFACE txpower $TXPOWER
40 /usr/bin/hostapd -P /var/run/hostapd /etc/hostapd.conf </dev/tty12 >/dev/tty12 2>&1 &
41 evaluate_retval
42 fi
43;;
44
45 stop)
46 boot_mesg "Stopping hostapd..."
47
48 killproc /usr/bin/hostapd
49 evaluate_retval
50 ;;
51
52 restart)
53 ${0} stop
54 sleep 1
55 ${0} start
56 ;;
57
58 status)
59 statusproc /usr/bin/hostapd
60 ;;
61
62 *)
63 echo "Usage: ${0} {start|stop|restart|status}"
64 exit 1
65 ;;
66esac