]>
Commit | Line | Data |
---|---|---|
07603508 CS |
1 | #!/bin/sh |
2 | . /etc/sysconfig/rc | |
3 | . ${rc_functions} | |
4 | ||
53d03ef3 MT |
5 | find_interface() { |
6 | local address="${1}" | |
7 | ||
8 | local path | |
9 | for path in /sys/class/net/*; do | |
10 | if [ -s "${path}/address" ] && [ "$(<${path}/address)" = "${address}" ]; then | |
11 | basename "${path}" | |
12 | return 0 | |
13 | fi | |
14 | done | |
15 | ||
16 | return 1; | |
17 | } | |
18 | ||
040ec360 | 19 | CHANNEL="6" |
c3d9a16d | 20 | COUNTRY="00" |
54359730 CS |
21 | TXPOWER="auto" |
22 | INTERFACE="blue0" | |
79ef49bd | 23 | MACMODE="0" |
79ef49bd | 24 | |
b9694349 | 25 | eval $(/usr/local/bin/readhash /var/ipfire/wlanap/settings) |
54359730 | 26 | |
54359730 | 27 | case "${1}" in |
8aa49c15 | 28 | start) |
53d03ef3 MT |
29 | interface="$(find_interface "${INTERFACE}")" |
30 | if [ -z "${interface}" ]; then | |
31 | boot_mesg "Could not find interface with address ${INTERFACE} for wireless access point" | |
32 | echo_failure | |
33 | exit 1 | |
34 | fi | |
35 | ||
7429ec82 | 36 | boot_mesg "Starting hostapd... " |
53d03ef3 | 37 | loadproc /usr/bin/hostapd -B /etc/hostapd.conf -i "${interface}" |
8aa49c15 | 38 | ;; |
54359730 | 39 | |
8aa49c15 | 40 | stop) |
54359730 | 41 | boot_mesg "Stopping hostapd..." |
8aa49c15 CS |
42 | killproc /usr/bin/hostapd |
43 | evaluate_retval | |
44 | ;; | |
54359730 | 45 | |
8aa49c15 CS |
46 | restart) |
47 | ${0} stop | |
48 | sleep 1 | |
49 | ${0} start | |
50 | ;; | |
54359730 | 51 | |
8aa49c15 CS |
52 | status) |
53 | statusproc /usr/bin/hostapd | |
54 | ;; | |
54359730 | 55 | |
8aa49c15 CS |
56 | *) |
57 | echo "Usage: ${0} {start|stop|restart|status}" | |
58 | exit 1 | |
59 | ;; | |
54359730 | 60 | esac |