@Net Noob try this:
1. Variable interface name (dynamic)
Hardcoded "wgs1_enable" (not dynamic)
ENABLED=$(nvram get wgs1_enable)
to
ENABLED=$(nvram get "${IF}_enable")
2. Incorrect NVRAM Check (s/b 1 or 0)
Checking for value "2"
if [ -z "$2" ] || [ -z "$ENABLED" ] || [ "$ENABLED" -ne "2" ] ; then
to
if [ "$ENABLED" -eq 1 ]; then
3. Cleanup/simplify
if [ -z "$1" ] || [ -z "$ENABLED" ] || [ "$ENABLED" -ne "1" ] ; then
# ...
if [ -z "$1" ] ; then
# ...
fi
fi
to
if [ "$ENABLED" -ne 1 ]; then
# Deactivate
else
# Activate
fi
4. Add service restart
service restart_wgs
service restart_dnsmasq
5. Act/Deact hardcoded to variable
nvram set wgs1_enable=0
nvram set wgs1_enable=1
to
nvram set "${IF}_enable=0"
nvram set "${IF}_enable=1"
1. Variable interface name (dynamic)
Hardcoded "wgs1_enable" (not dynamic)
ENABLED=$(nvram get wgs1_enable)
to
ENABLED=$(nvram get "${IF}_enable")
2. Incorrect NVRAM Check (s/b 1 or 0)
Checking for value "2"
if [ -z "$2" ] || [ -z "$ENABLED" ] || [ "$ENABLED" -ne "2" ] ; then
to
if [ "$ENABLED" -eq 1 ]; then
3. Cleanup/simplify
if [ -z "$1" ] || [ -z "$ENABLED" ] || [ "$ENABLED" -ne "1" ] ; then
# ...
if [ -z "$1" ] ; then
# ...
fi
fi
to
if [ "$ENABLED" -ne 1 ]; then
# Deactivate
else
# Activate
fi
4. Add service restart
service restart_wgs
service restart_dnsmasq
5. Act/Deact hardcoded to variable
nvram set wgs1_enable=0
nvram set wgs1_enable=1
to
nvram set "${IF}_enable=0"
nvram set "${IF}_enable=1"
Last edited: