Skip to content
Snippets Groups Projects
Commit d32ada32 authored by Bob Mottram's avatar Bob Mottram
Browse files

Setting static IP with wifi

parent b068fa94
No related branches found
No related tags found
No related merge requests found
......@@ -1203,12 +1203,6 @@ function change_system_name {
}
function set_dynamic_IP {
NETWORK_IS_STATIC=0
read_config_param "NETWORK_IS_STATIC"
if [ ${NETWORK_IS_STATIC} -eq 0 ]; then
return
fi
revert_to_dynamic=
dialog --title $"Return to using a dynamic IP address" \
--backtitle $"Freedombone Control Panel" \
......@@ -1293,8 +1287,22 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_
email_change_relay "$NEW_STATIC_IP"
if [[ $(config_param_exists "WIFI_INTERFACE") == "0" ]]; then
static_wifi_address=
if [[ $(config_param_exists "WIFI_INTERFACE") == "1" ]]; then
dialog --title $"Static local IP address" \
--backtitle $"Freedombone Control Panel" \
--yesno $"\nSet a static address for the wifi adapter?\n\nIf you select 'no' then wired ethernet will be used." 10 60
sel=$?
case $sel in
0) static_wifi_address=1
write_config_param "NETWORK_IS_STATIC" "1"
;;
esac
fi
if [ ! $static_wifi_address ]; then
# wired network
remove_wifi_startup_script
echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
echo '' >> /etc/network/interfaces
......@@ -1330,6 +1338,9 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_
echo '# netmask 255.255.255.0' >> /etc/network/interfaces
echo '# network 192.168.7.0' >> /etc/network/interfaces
echo '# gateway 192.168.7.1' >> /etc/network/interfaces
else
# wifi network
wifi_settings
fi
clear
......
......@@ -573,6 +573,19 @@ function count_wlan {
echo $ctr
}
function remove_wifi_startup_script {
remove_config_param "WIFI_INTERFACE"
systemd_file=/etc/systemd/system/wifistart.service
if [ -f $systemd_file ]; then
systemctl stop wifistart
systemctl disable wifistart
rm $systemd_file
fi
if [ -f $HOME/${PROJECT_NAME}-wifi.cfg ]; then
rm $HOME/${PROJECT_NAME}-wifi.cfg
fi
}
function create_wifi_startup_script {
systemd_file=/etc/systemd/system/wifistart.service
echo '[Unit]' > $systemd_file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment