diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index a70108a2..26785439 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -1256,6 +1256,37 @@ function change_system_name { esac } +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" \ + --yesno $"\nDo you wish to go back to using a dynamic IP address?" 8 60 + sel=$? + case $sel in + 0) revert_to_dynamic=1 + ;; + esac + + if [ $revert_to_dynamic ]; then + remove_config_param "NETWORK_IS_STATIC" + if [ -f /etc/network/interfaces_original ]; then + cp /etc/network/interfaces_original /etc/network/interfaces + fi + clear + echo '' + echo $'Changing to a dynamic IP address.' + echo '' + echo $"System is rebooting. You may need to close this terminal and log in from a new one." + reboot + fi +} + function set_static_IP { IPv4_address=$(get_ipv4_address) IPv4_address_base=$(echo "$IPv4_address" | awk -F '.' '{print $1"."$2"."$3}') @@ -1280,6 +1311,7 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_ case $sel in 0) NEW_STATIC_IP=$(<$data) if [[ "$NEW_STATIC_IP" != *"."* ]]; then + set_dynamic_IP return fi ;;