From 892a88e3cc526259391f42279b28fca5e0ad285b Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 29 Mar 2020 14:14:12 +0000 Subject: [PATCH] test for $interface before changing daemon, chk status of br0 --- installers/raspapd.service | 2 +- installers/servicestart.sh | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/installers/raspapd.service b/installers/raspapd.service index c5738465..a87832c0 100644 --- a/installers/raspapd.service +++ b/installers/raspapd.service @@ -16,7 +16,7 @@ After=multi-user.target [Service] Type=oneshot -ExecStart=/bin/bash /etc/raspap/hostapd/servicestart.sh --interface uap0 --seconds 3 +ExecStart=/bin/bash /etc/raspap/hostapd/servicestart.sh --seconds 3 RemainAfterExit=no [Install] diff --git a/installers/servicestart.sh b/installers/servicestart.sh index 4504e43e..0d6ea4de 100755 --- a/installers/servicestart.sh +++ b/installers/servicestart.sh @@ -48,7 +48,7 @@ if [ "${action}" = "stop" ]; then exit 0 fi -if [ -f "$DAEMONPATH" ]; then +if [ -f "$DAEMONPATH" ] && [ ! -z "$interface" ]; then echo "Changing RaspAP Daemon --interface to $interface" sed -i "s/\(--interface \)[[:alnum:]]*/\1$interface/" "$DAEMONPATH" fi @@ -77,11 +77,14 @@ if [ -r "$CONFIGFILE" ]; then fi else echo "Disabling systemd-networkd" -- systemctl disable systemd-networkd + systemctl disable systemd-networkd - echo "Removing br0 interface..." - ip link set down br0 - ip link del dev br0 + ip link ls up | grep -q 'br0' &> /dev/null + if [ $? == 0 ]; then + echo "Removing br0 interface..." + ip link set down br0 + ip link del dev br0 + fi if [ "${config[WifiAPEnable]}" = 1 ]; then if [ "${interface}" = "uap0" ]; then