Merge "Add DIB_APT_MINIMAL_CREATE_INTERFACES toggle"
This commit is contained in:
commit
186db05ffb
@ -63,6 +63,14 @@ For further information about ``DIB_DEBIAN_DEBOOTSTRAP_SCRIPT`` ,
|
||||
``DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE`` and ``DIB_DEBOOTSTRAP_EXTRA_ARGS``
|
||||
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
|
||||
-------------------
|
||||
|
@ -24,15 +24,21 @@ set -o pipefail
|
||||
# It would be eversogreat if we didn't need to do crap like this
|
||||
echo $DISTRO_NAME > /etc/hostname
|
||||
|
||||
# cloud images expect eth0 and eth1 to use dhcp.
|
||||
mkdir -p /etc/network/interfaces.d
|
||||
if ! grep -E -q '^source(|-directory) /etc/network/interfaces.d/\*' /etc/network/interfaces; 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
|
||||
cat << EOF | tee /etc/network/interfaces.d/$interface
|
||||
# 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
|
||||
if ! grep -E -q '^source(|-directory) /etc/network/interfaces.d/\*' /etc/network/interfaces; 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
|
||||
cat << EOF | tee /etc/network/interfaces.d/$interface
|
||||
auto $interface
|
||||
iface $interface inet dhcp
|
||||
EOF
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user