|
@@ -1685,6 +1685,10 @@ Enter a static local IP address for this system.\n\nIt will typically be 192.168
|
1685
|
1685
|
}
|
1686
|
1686
|
|
1687
|
1687
|
function wifi_settings {
|
|
1688
|
+ if [ -f /etc/hostapd/hostapd.conf ]; then
|
|
1689
|
+ return
|
|
1690
|
+ fi
|
|
1691
|
+
|
1688
|
1692
|
TEMP_WIFI_NETWORKS_FILE=~/.temp-${PROJECT_NAME}-wifi.cfg
|
1689
|
1693
|
${PROJECT_NAME}-wifi --networksinteractive $TEMP_WIFI_NETWORKS_FILE
|
1690
|
1694
|
if [ -f $TEMP_WIFI_NETWORKS_FILE ]; then
|
|
@@ -1696,6 +1700,16 @@ function wifi_settings {
|
1696
|
1700
|
fi
|
1697
|
1701
|
}
|
1698
|
1702
|
|
|
1703
|
+function wifi_edit_networks {
|
|
1704
|
+ if [ -f /etc/hostapd/hostapd.conf ]; then
|
|
1705
|
+ return
|
|
1706
|
+ fi
|
|
1707
|
+ editor $WIFI_NETWORKS_FILE
|
|
1708
|
+ if [ -f $WIFI_NETWORKS_FILE ]; then
|
|
1709
|
+ ${PROJECT_NAME}-wifi --networks $WIFI_NETWORKS_FILE
|
|
1710
|
+ fi
|
|
1711
|
+}
|
|
1712
|
+
|
1699
|
1713
|
function hotspot_settings {
|
1700
|
1714
|
data=$(tempfile 2>/dev/null)
|
1701
|
1715
|
trap "rm -f $data" 0 1 2 5 15
|
|
@@ -1947,19 +1961,23 @@ function wifi_enable {
|
1947
|
1961
|
${PROJECT_NAME}-wifi --disable $disable_wifi
|
1948
|
1962
|
}
|
1949
|
1963
|
|
1950
|
|
-function menu_wifi {
|
1951
|
|
- hotspot_state=$'off'
|
1952
|
|
- if [ -f /etc/hostapd/hostapd.conf ]; then
|
1953
|
|
- hotspot_state=$'on'
|
1954
|
|
- fi
|
1955
|
|
-
|
|
1964
|
+function menu_wifi {
|
1956
|
1965
|
while true
|
1957
|
1966
|
do
|
|
1967
|
+ status_str=$'Wifi OFF'
|
|
1968
|
+ if [ -f /etc/hostapd/hostapd.conf ]; then
|
|
1969
|
+ status_str=$'Hotspot ON'
|
|
1970
|
+ else
|
|
1971
|
+ if grep -q "# wifi enabled" /etc/network/interfaces; then
|
|
1972
|
+ status_str=$'Wifi ON'
|
|
1973
|
+ fi
|
|
1974
|
+ fi
|
|
1975
|
+
|
1958
|
1976
|
data=$(tempfile 2>/dev/null)
|
1959
|
1977
|
trap "rm -f $data" 0 1 2 5 15
|
1960
|
1978
|
dialog --backtitle $"Freedombone Control Panel" \
|
1961
|
1979
|
--title $"Wifi Menu" \
|
1962
|
|
- --radiolist $"Choose an operation:" 13 70 5 \
|
|
1980
|
+ --radiolist $"${status_str}\n\nChoose an operation:" 14 70 6 \
|
1963
|
1981
|
1 $"Enable or disable Wifi" off \
|
1964
|
1982
|
2 $"Configure wifi networks" off \
|
1965
|
1983
|
3 $"Manually edit wifi networks file" off \
|
|
@@ -1973,7 +1991,7 @@ function menu_wifi {
|
1973
|
1991
|
case $(cat $data) in
|
1974
|
1992
|
1) wifi_enable;;
|
1975
|
1993
|
2) wifi_settings;;
|
1976
|
|
- 3) editor $WIFI_NETWORKS_FILE;;
|
|
1994
|
+ 3) wifi_edit_networks;;
|
1977
|
1995
|
4) hotspot_settings;;
|
1978
|
1996
|
5) break;;
|
1979
|
1997
|
esac
|