test for $interface before changing daemon, chk status of br0

This commit is contained in:
billz 2020-03-29 14:14:12 +00:00
parent 17d62acdd6
commit 892a88e3cc
2 changed files with 9 additions and 6 deletions

View File

@ -16,7 +16,7 @@ After=multi-user.target
[Service] [Service]
Type=oneshot 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 RemainAfterExit=no
[Install] [Install]

View File

@ -48,7 +48,7 @@ if [ "${action}" = "stop" ]; then
exit 0 exit 0
fi fi
if [ -f "$DAEMONPATH" ]; then if [ -f "$DAEMONPATH" ] && [ ! -z "$interface" ]; then
echo "Changing RaspAP Daemon --interface to $interface" echo "Changing RaspAP Daemon --interface to $interface"
sed -i "s/\(--interface \)[[:alnum:]]*/\1$interface/" "$DAEMONPATH" sed -i "s/\(--interface \)[[:alnum:]]*/\1$interface/" "$DAEMONPATH"
fi fi
@ -77,11 +77,14 @@ if [ -r "$CONFIGFILE" ]; then
fi fi
else else
echo "Disabling systemd-networkd" echo "Disabling systemd-networkd"
- systemctl disable systemd-networkd systemctl disable systemd-networkd
ip link ls up | grep -q 'br0' &> /dev/null
if [ $? == 0 ]; then
echo "Removing br0 interface..." echo "Removing br0 interface..."
ip link set down br0 ip link set down br0
ip link del dev br0 ip link del dev br0
fi
if [ "${config[WifiAPEnable]}" = 1 ]; then if [ "${config[WifiAPEnable]}" = 1 ]; then
if [ "${interface}" = "uap0" ]; then if [ "${interface}" = "uap0" ]; then