debootstrap: make default network interface names configurable

Nowadays, in the time of Predictable Network Interface Names, the
network interface names 'ethX' are not used that often any more.
Depending on the virtualization layer and the guest OS names like
'ens3', 'enp1s0' or 'enp0s31f6' are used.
This patch enables the user to set DIB_NETWORK_INTERFACE_NAMES to a
list of network interfaces which are brought up using DHCP during
(first) boot.

Change-Id: I04cc2ee710f0389a8085b1c91d9329784cb28048
Signed-off-by: Andreas Florath <Andreas.Florath@telekom.de>
This commit is contained in:
Andreas Florath 2019-06-12 13:53:38 +00:00
parent 928c6e61f0
commit 05af0fc863
3 changed files with 10 additions and 2 deletions

View File

@ -69,7 +69,14 @@ Networking
By default ``/etc/network/interfaces.d/eth[0|1]`` files will be
created and enabled with DHCP networking. If you do not wish this to
be done, set ``DIB_APT_MINIMAL_CREATE_INTERFACES`` to ``0``.
be done, set ``DIB_APT_MINIMAL_CREATE_INTERFACES`` to ``0``. If you
need different interface names than ``eth[0|1]`` set
``DIB_NETWORK_INTERFACE_NAMES`` to a space separated list of network
interface names like:
.. code-block:: bash
export DIB_NETWORK_INTERFACE_NAMES="ens3 ens4"
-------------------
Note on ARM systems

View File

@ -0,0 +1 @@
export DIB_NETWORK_INTERFACE_NAMES=${DIB_NETWORK_INTERFACE_NAMES:-eth0 eth1}

View File

@ -35,7 +35,7 @@ if [[ "${DIB_APT_MINIMAL_CREATE_INTERFACES:-1}" -eq "1" ]]; then
echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces
echo 'Network configuration set to source /etc/network/interfaces.d/*'
fi
for interface in eth0 eth1; do
for interface in ${DIB_NETWORK_INTERFACE_NAMES}; do
cat << EOF | tee /etc/network/interfaces.d/$interface
auto $interface
iface $interface inet dhcp