From 93e1fff5d539c7ccd1190672f9db7e48f7ed1a65 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Apr 2019 18:30:26 +0000 Subject: [PATCH] Update read WifiManaged interface from config. Resolves #323 --- installers/servicestart.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/installers/servicestart.sh b/installers/servicestart.sh index fa58a8d5..af2c9eda 100755 --- a/installers/servicestart.sh +++ b/installers/servicestart.sh @@ -5,6 +5,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=raspap DESC="Service control for RaspAP" +CONFIGFILE="/etc/raspap/hostapd.ini" positional=() while [[ $# -gt 0 ]] @@ -31,16 +32,19 @@ systemctl stop hostapd.service systemctl stop dnsmasq.service systemctl stop dhcpcd.service -if [ -f /etc/raspap/hostapd.ini ]; then - source <(grep = /etc/raspap/hostapd.ini | sed 's/ *= */=/g') - if [ $WifiAPEnable = 1 ]; then +if [ -r "$CONFIGFILE" ]; then + declare -A config + 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 echo "Removing uap0 interface..." iw dev uap0 del - echo "Adding uap0 interface..." + echo "Adding uap0 interface to ${config[WifiManaged]}" iw dev wlan0 interface add uap0 type __ap - # Bring up uap0 interface ifconfig uap0 up fi