Enabling or disabling wifi
This commit is contained in:
parent
91871787cd
commit
e1a82b205f
|
@ -1932,6 +1932,21 @@ function menu_media {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wifi_enable {
|
||||||
|
disable_wifi='yes'
|
||||||
|
dialog --title $"Enable Wifi" \
|
||||||
|
--backtitle $"Freedombone Control Panel" \
|
||||||
|
--defaultno \
|
||||||
|
--yesno $"\nDo you wish to enable wifi?" 10 50
|
||||||
|
sel=$?
|
||||||
|
case $sel in
|
||||||
|
0) disable_wifi='no';;
|
||||||
|
1) disable_wifi='yes';;
|
||||||
|
255) return;;
|
||||||
|
esac
|
||||||
|
${PROJECT_NAME}-wifi --disable $disable_wifi
|
||||||
|
}
|
||||||
|
|
||||||
function menu_wifi {
|
function menu_wifi {
|
||||||
hotspot_state=$'off'
|
hotspot_state=$'off'
|
||||||
if [ -f /etc/hostapd/hostapd.conf ]; then
|
if [ -f /etc/hostapd/hostapd.conf ]; then
|
||||||
|
@ -1944,21 +1959,23 @@ function menu_wifi {
|
||||||
trap "rm -f $data" 0 1 2 5 15
|
trap "rm -f $data" 0 1 2 5 15
|
||||||
dialog --backtitle $"Freedombone Control Panel" \
|
dialog --backtitle $"Freedombone Control Panel" \
|
||||||
--title $"Wifi Menu" \
|
--title $"Wifi Menu" \
|
||||||
--radiolist $"Choose an operation:" 12 70 4 \
|
--radiolist $"Choose an operation:" 13 70 5 \
|
||||||
1 $"Configure wifi networks" off \
|
1 $"Enable or disable Wifi" off \
|
||||||
2 $"Manually edit wifi networks file" off \
|
2 $"Configure wifi networks" off \
|
||||||
3 $"Hotspot settings" off \
|
3 $"Manually edit wifi networks file" off \
|
||||||
4 $"Exit" on 2> $data
|
4 $"Hotspot settings" off \
|
||||||
|
5 $"Exit" on 2> $data
|
||||||
sel=$?
|
sel=$?
|
||||||
case $sel in
|
case $sel in
|
||||||
1) break;;
|
1) break;;
|
||||||
255) break;;
|
255) break;;
|
||||||
esac
|
esac
|
||||||
case $(cat $data) in
|
case $(cat $data) in
|
||||||
1) wifi_settings;;
|
1) wifi_enable;;
|
||||||
2) editor $WIFI_NETWORKS_FILE;;
|
2) wifi_settings;;
|
||||||
3) hotspot_settings;;
|
3) editor $WIFI_NETWORKS_FILE;;
|
||||||
4) break;;
|
4) hotspot_settings;;
|
||||||
|
5) break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,12 +309,16 @@ function create_networks_interactive {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function disable {
|
function disable_wifi {
|
||||||
hotspot_off
|
if [[ ${1} == 'yes' || ${1} == 'y' ]]; then
|
||||||
echo '# interfaces(5) file used by ifup(8) and ifdown(8)' > /etc/network/interfaces
|
hotspot_off
|
||||||
echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
|
echo '# interfaces(5) file used by ifup(8) and ifdown(8)' > /etc/network/interfaces
|
||||||
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
|
echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
|
||||||
systemctl restart network-manager
|
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
|
||||||
|
systemctl restart network-manager
|
||||||
|
else
|
||||||
|
networks_from_file
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_help {
|
function show_help {
|
||||||
|
@ -384,8 +388,8 @@ do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $WIFI_DISABLE == $'yes' || $WIFI_DISABLE == $'y' ]]; then
|
if [ $WIFI_DISABLE ]; then
|
||||||
disable
|
disable_wifi $WIFI_DISABLE
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue