Add DIB_APT_MINIMAL_CREATE_INTERFACES toggle

Add a DIB_APT_MINIMAL_CREATE_INTERFACES boolean to the debootstrap
element which functions identically to
DIB_YUM_MINIMAL_CREATE_INTERFACES in the yum-minimal element.

This can be used to disable the creation of the
/etc/network/interfaces.d/eth[01] dhcp configuration files, which
are not needed on systems where cloud-init or other means are used
to configure networking.

The flag is enabled by default to keep creating the dhcp interface
files, maintaining backwards compatibility.

Change-Id: I1fdaca8350a5ceefd9e437af4fd000ce6a3ee7f3
This commit is contained in:
Logan V 2019-02-27 17:42:33 -06:00 committed by Ian Wienand
parent 703549412d
commit 8756cbea1b
2 changed files with 23 additions and 9 deletions

View File

@ -63,6 +63,14 @@ For further information about ``DIB_DEBIAN_DEBOOTSTRAP_SCRIPT`` ,
``DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE`` and ``DIB_DEBOOTSTRAP_EXTRA_ARGS`` ``DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE`` and ``DIB_DEBOOTSTRAP_EXTRA_ARGS``
please consult "README.rst" of the debootstrap element. please consult "README.rst" of the debootstrap element.
----------
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``.
------------------- -------------------
Note on ARM systems Note on ARM systems
------------------- -------------------

View File

@ -24,7 +24,12 @@ set -o pipefail
# It would be eversogreat if we didn't need to do crap like this # It would be eversogreat if we didn't need to do crap like this
echo $DISTRO_NAME > /etc/hostname echo $DISTRO_NAME > /etc/hostname
# cloud images expect eth0 and eth1 to use dhcp. # If you want eth0 and eth1 created as DHCP based interfaces, enable
# this. You don't want this if systemd is going to call the
# interfaces on the real system something else, or if you're using a
# network-manager like cloud-init, glean or systemd-networkd that will
# handle the interfaces dynamically.
if [[ "${DIB_APT_MINIMAL_CREATE_INTERFACES:-1}" -eq "1" ]]; then
mkdir -p /etc/network/interfaces.d mkdir -p /etc/network/interfaces.d
if ! grep -E -q '^source(|-directory) /etc/network/interfaces.d/\*' /etc/network/interfaces; then if ! grep -E -q '^source(|-directory) /etc/network/interfaces.d/\*' /etc/network/interfaces; then
echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces
@ -36,3 +41,4 @@ auto $interface
iface $interface inet dhcp iface $interface inet dhcp
EOF EOF
done done
fi