Initial dynamic eth0 configuration

This commit is contained in:
Bob Mottram 2018-03-10 12:10:02 +00:00
parent 3180e85973
commit 9fe1f91722
1 changed files with 16 additions and 4 deletions

View File

@ -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 {