]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/init.d/hostapd
Load libata prior udev at installer because some SATA doesnt autoload it
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / hostapd
CommitLineData
07603508
CS
1#!/bin/sh
2. /etc/sysconfig/rc
3. ${rc_functions}
4
54359730
CS
5CHANNEL="05"
6TXPOWER="auto"
7INTERFACE="blue0"
b9694349 8eval $(/usr/local/bin/readhash /var/ipfire/wlanap/settings)
54359730 9
54359730
CS
10case "${1}" in
11 start)
54359730 12 mkdir -p /var/run/hostapd
a494df6d
AF
13 if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode:Master")" == "" ]; then
14
15 boot_mesg "Setting wlan $INTERFACE to Master mode... "
54359730 16
a494df6d
AF
17 # Set Atheros Cards to master mode
18 if [ -d /proc/net/madwifi/ath0/ ]; then
43adf098 19 /usr/bin/wlanconfig ath0 destroy > /dev/null
a494df6d 20 fi
54359730 21
a494df6d
AF
22 /usr/bin/wlanconfig $INTERFACE destroy > /dev/null
23 /usr/bin/wlanconfig $INTERFACE create wlandev wifi0 wlanmode ap > /dev/null
54359730 24
a494df6d
AF
25 # Set other cards to master mode
26 #/usr/sbin/iwconfig blue0 mode master
27 fi
28
54359730
CS
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
a494df6d
AF
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... "
54359730 38 /usr/sbin/iwconfig $INTERFACE channel $CHANNEL
b9694349 39 /usr/sbin/iwconfig $INTERFACE txpower $TXPOWER
54359730
CS
40 /usr/bin/hostapd -P /var/run/hostapd /etc/hostapd.conf </dev/tty12 >/dev/tty12 2>&1 &
41 evaluate_retval
42 fi
c2cd9391 43;;
54359730
CS
44
45 stop)
46 boot_mesg "Stopping hostapd..."
47
54359730
CS
48 killproc /usr/bin/hostapd
49 evaluate_retval
50 ;;
51
52 restart)
a494df6d 53 ${0} stop
54359730 54 sleep 1
a494df6d 55 ${0} start
54359730
CS
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