1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Update read WifiManaged interface from config. Resolves #323

This commit is contained in:
billz 2019-04-30 18:30:26 +00:00
parent 1a23316abd
commit 93e1fff5d5

View File

@ -5,6 +5,7 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=raspap NAME=raspap
DESC="Service control for RaspAP" DESC="Service control for RaspAP"
CONFIGFILE="/etc/raspap/hostapd.ini"
positional=() positional=()
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
@ -31,16 +32,19 @@ systemctl stop hostapd.service
systemctl stop dnsmasq.service systemctl stop dnsmasq.service
systemctl stop dhcpcd.service systemctl stop dhcpcd.service
if [ -f /etc/raspap/hostapd.ini ]; then if [ -r "$CONFIGFILE" ]; then
source <(grep = /etc/raspap/hostapd.ini | sed 's/ *= */=/g') declare -A config
if [ $WifiAPEnable = 1 ]; then while IFS="=" read -r key value; do
config["$key"]="$value"
done < <(sed -E -e 's/ *= */=/g' "$CONFIGFILE" )
if [[ ${config[WifiAPEnable]} =~ 1 ]]; then
if [ "${interface}" = "uap0" ]; then if [ "${interface}" = "uap0" ]; then
echo "Removing uap0 interface..." echo "Removing uap0 interface..."
iw dev uap0 del iw dev uap0 del
echo "Adding uap0 interface..." echo "Adding uap0 interface to ${config[WifiManaged]}"
iw dev wlan0 interface add uap0 type __ap iw dev wlan0 interface add uap0 type __ap
# Bring up uap0 interface # Bring up uap0 interface
ifconfig uap0 up ifconfig uap0 up
fi fi