Option to disable wifi
This commit is contained in:
parent
14cc474649
commit
91871787cd
|
@ -44,6 +44,7 @@ WIFI_HOTSPOT='no'
|
||||||
WIFI_CONFIG=/etc/wpa_supplicant/wpa_supplicant.conf
|
WIFI_CONFIG=/etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
|
WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
|
||||||
NETWORKS_INTERACTIVE=
|
NETWORKS_INTERACTIVE=
|
||||||
|
WIFI_DISABLE=
|
||||||
|
|
||||||
function wifi_get_psk {
|
function wifi_get_psk {
|
||||||
ssid=$1
|
ssid=$1
|
||||||
|
@ -308,6 +309,14 @@ function create_networks_interactive {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function disable {
|
||||||
|
hotspot_off
|
||||||
|
echo '# interfaces(5) file used by ifup(8) and ifdown(8)' > /etc/network/interfaces
|
||||||
|
echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
|
||||||
|
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
|
||||||
|
systemctl restart network-manager
|
||||||
|
}
|
||||||
|
|
||||||
function show_help {
|
function show_help {
|
||||||
echo ''
|
echo ''
|
||||||
echo $"${PROJECT_NAME}-wifi -i [interface] -t [type] -s [ssid] -p [passphrase]"
|
echo $"${PROJECT_NAME}-wifi -i [interface] -t [type] -s [ssid] -p [passphrase]"
|
||||||
|
@ -322,6 +331,7 @@ function show_help {
|
||||||
echo $' --hotspot [yes|no] Create a hotspot'
|
echo $' --hotspot [yes|no] Create a hotspot'
|
||||||
echo $' --networks [filename] File containing wifi networks'
|
echo $' --networks [filename] File containing wifi networks'
|
||||||
echo $' --createnetworks [filename] Create file containing wifi networks'
|
echo $' --createnetworks [filename] Create file containing wifi networks'
|
||||||
|
echo $' --disable [yes/no] Disable wifi'
|
||||||
echo ''
|
echo ''
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -363,6 +373,10 @@ do
|
||||||
NETWORKS_INTERACTIVE='yes'
|
NETWORKS_INTERACTIVE='yes'
|
||||||
WIFI_NETWORKS_FILE=${1}
|
WIFI_NETWORKS_FILE=${1}
|
||||||
;;
|
;;
|
||||||
|
--disable)
|
||||||
|
shift
|
||||||
|
WIFI_DISABLE=${1}
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
|
@ -370,6 +384,11 @@ do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $WIFI_DISABLE == $'yes' || $WIFI_DISABLE == $'y' ]]; then
|
||||||
|
disable
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $NETWORKS_INTERACTIVE ]; then
|
if [ $NETWORKS_INTERACTIVE ]; then
|
||||||
create_networks_interactive
|
create_networks_interactive
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue