diff --git a/src/freedombone-utils-network b/src/freedombone-utils-network index 95d6ba89..a6e91ea9 100755 --- a/src/freedombone-utils-network +++ b/src/freedombone-utils-network @@ -54,21 +54,33 @@ function install_static_network { if [[ $INSTALLING_ON_BBB == "yes" ]]; then return fi - if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then - return - fi 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 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces + if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then + + { echo 'auto eth0'; + echo 'iface eth0 inet dhcp'; } > /etc/network/interfaces.d/dynamic + + if [ -f /etc/network/interfaces.d/static ]; then + rm /etc/network/interfaces.d/static + fi + + mark_completed "${FUNCNAME[0]}" + return + fi + { echo 'auto eth0'; echo 'iface eth0 inet static'; echo " address $LOCAL_NETWORK_STATIC_IP_ADDRESS"; echo ' netmask 255.255.255.0'; echo " gateway $ROUTER_IP_ADDRESS"; } > /etc/network/interfaces.d/static - mark_completed "${FUNCNAME[0]}" + if [ -f /etc/network/interfaces.d/dynamic ]; then + rm /etc/network/interfaces.d/dynamic + fi } function get_external_ipv4_address {