]>
Commit | Line | Data |
---|---|---|
07603508 | 1 | #!/bin/sh |
66c36198 PM |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
07603508 CS |
22 | . /etc/sysconfig/rc |
23 | . ${rc_functions} | |
24 | ||
45b1fc5c MT |
25 | find_interface() { |
26 | local address="${1}" | |
27 | ||
28 | local path | |
29 | for path in /sys/class/net/*; do | |
30 | if [ -s "${path}/address" ] && [ "$(<${path}/address)" = "${address}" ]; then | |
31 | basename "${path}" | |
32 | return 0 | |
33 | fi | |
34 | done | |
35 | ||
36 | return 1; | |
37 | } | |
38 | ||
040ec360 | 39 | CHANNEL="6" |
c3d9a16d | 40 | COUNTRY="00" |
54359730 CS |
41 | TXPOWER="auto" |
42 | INTERFACE="blue0" | |
79ef49bd | 43 | MACMODE="0" |
79ef49bd | 44 | |
b9694349 | 45 | eval $(/usr/local/bin/readhash /var/ipfire/wlanap/settings) |
54359730 | 46 | |
54359730 | 47 | case "${1}" in |
8aa49c15 | 48 | start) |
45b1fc5c MT |
49 | interface="$(find_interface "${INTERFACE}")" |
50 | if [ -z "${interface}" ]; then | |
51 | boot_mesg "Could not find interface with address ${INTERFACE} for wireless access point" | |
52 | echo_failure | |
53 | exit 1 | |
54 | fi | |
55 | ||
7429ec82 | 56 | boot_mesg "Starting hostapd... " |
45b1fc5c | 57 | loadproc /usr/bin/hostapd -B /etc/hostapd.conf -i "${interface}" |
8aa49c15 | 58 | ;; |
54359730 | 59 | |
8aa49c15 | 60 | stop) |
54359730 | 61 | boot_mesg "Stopping hostapd..." |
8aa49c15 CS |
62 | killproc /usr/bin/hostapd |
63 | evaluate_retval | |
64 | ;; | |
54359730 | 65 | |
8aa49c15 CS |
66 | restart) |
67 | ${0} stop | |
68 | sleep 1 | |
69 | ${0} start | |
70 | ;; | |
54359730 | 71 | |
8aa49c15 CS |
72 | status) |
73 | statusproc /usr/bin/hostapd | |
74 | ;; | |
54359730 | 75 | |
8aa49c15 CS |
76 | *) |
77 | echo "Usage: ${0} {start|stop|restart|status}" | |
78 | exit 1 | |
79 | ;; | |
54359730 | 80 | esac |