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``
|
``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
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -24,15 +24,21 @@ 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
|
||||||
mkdir -p /etc/network/interfaces.d
|
# this. You don't want this if systemd is going to call the
|
||||||
if ! grep -E -q '^source(|-directory) /etc/network/interfaces.d/\*' /etc/network/interfaces; then
|
# interfaces on the real system something else, or if you're using a
|
||||||
echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces
|
# network-manager like cloud-init, glean or systemd-networkd that will
|
||||||
echo 'Network configuration set to source /etc/network/interfaces.d/*'
|
# handle the interfaces dynamically.
|
||||||
fi
|
if [[ "${DIB_APT_MINIMAL_CREATE_INTERFACES:-1}" -eq "1" ]]; then
|
||||||
for interface in eth0 eth1; do
|
mkdir -p /etc/network/interfaces.d
|
||||||
cat << EOF | tee /etc/network/interfaces.d/$interface
|
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
|
auto $interface
|
||||||
iface $interface inet dhcp
|
iface $interface inet dhcp
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user