Hi,
I'm not using Wifi all the time.
And when not using it, i bring it down.
This for security and personal reasons.
My kids love to use wifi and start it up if possible.
For now i have created a user and made a .profile starting a ash-script, witch gives the possibility to start wifi or stop wifi
##
.profile
#! /bin/ash
./wifi.sh
###
wifi.sh
#! /bin/ash
#! file is in /home/user
#! because off backup up config files, this file is in /etc/config
while true
do
clear
echo " "
echo " "
echo " "
echo " ============================================================================ "
echo " "
echo " Wifi "
echo " "
echo " ============================================================================ "
echo " "
echo " "
echo " "
echo " <1> Turn Wifi ON"
echo " <2> Turn Wifi OFF"
echo " "
echo " "
echo " "
read -p " Your choise " value
case $value in
1) /etc/config/wifiswitch.sh radio0 on; break;;
2) /etc/config/wifiswitch.sh radio0 off; break;;
*) echo "Invalid choise. Enter 1 or 2";;
esac
done
kill -HUP $PPID
###
##
wifiswitch.sh
#! /bin/ash
./wifi.sh
root@OpenWrt:/etc/config# cat wifiswitch.sh
#!/bin/ash
#! wifiswitch to put on or off wifi
#! file is in /etc/config
if [ `uci get wireless.${1}` ] ; then
if [ $2 == "on" ] ; then
# radio on
# delete disbled on first 3 interfaces; if exists
value="x"$(uci show wireless | grep -F "wireless.@wifi-iface[0]=")"x"
if [ ! $value == "xx" ] ; then uci set wireless.@wifi-iface[0].disabled='0' ; fi
value="x"$(uci show wireless | grep -F "wireless.@wifi-iface[1]=")"x"
if [ ! $value == "xx" ] ; then uci set wireless.@wifi-iface[1].disabled='0' ; fi
value="x"$(uci show wireless | grep -F "wireless.@wifi-iface[2]=")"x"
if [ ! $value == "xx" ] ; then uci set wireless.@wifi-iface[2].disabled='0' ; fi
uci set wireless.${1}.disabled='0'
uci commit wireless
wifi
else
if [ $2 == "off" ] ; then
# radio off
#uci set wireless.@wifi-iface[0].disabled='1'
uci set wireless.${1}.disabled='1'
uci commit wireless
wifi
else
# usage
echo "Usage wifiswitch.sh radioX on|off"
fi
fi
else
echo "Invalid radio device: ${1}"
fi
I have saved this config in /etc/config, so it will be saved after an update.
Of course this is a solution,
but my question is;
"Is it possible to make a user in the webinterface
The user can than be authorized to enable or disable a specific network, for example wifi.
This is also easy for the guest network.
Thanks