From 7ad61bb451ecdc738d6057cf1b2f736a33630774 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Fri, 6 Jul 2018 15:59:26 -0700 Subject: [PATCH] Remove unnecessary interface configurations The image building process adds some unnecessary network interface configuration files to /etc/network/interfaces.d. This element cleans those out as they are not needed because cloud-init will create the required configuration file. Change-Id: If5fbfc34ff0e91608f402811aa2b78c9cbcb00ec --- diskimage-create/diskimage-create.sh | 1 + elements/remove-default-ints/README.rst | 6 ++++++ .../post-install.d/91-remove-default-ints | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 elements/remove-default-ints/README.rst create mode 100755 elements/remove-default-ints/post-install.d/91-remove-default-ints diff --git a/diskimage-create/diskimage-create.sh b/diskimage-create/diskimage-create.sh index a0014d0d7a..f4c4414781 100755 --- a/diskimage-create/diskimage-create.sh +++ b/diskimage-create/diskimage-create.sh @@ -407,6 +407,7 @@ AMP_element_sequence="$AMP_element_sequence no-resolvconf" AMP_element_sequence="$AMP_element_sequence amphora-agent" AMP_element_sequence="$AMP_element_sequence sos" AMP_element_sequence="$AMP_element_sequence cloud-init-datasources" +AMP_element_sequence="$AMP_element_sequence remove-default-ints" if [ "$AMP_ENABLE_FULL_MAC_SECURITY" -ne 1 ]; then # SELinux systems diff --git a/elements/remove-default-ints/README.rst b/elements/remove-default-ints/README.rst new file mode 100644 index 0000000000..9769f1a848 --- /dev/null +++ b/elements/remove-default-ints/README.rst @@ -0,0 +1,6 @@ +This element removes any default network interfaces from the interface +configuration in the image. These are not needed in the amphora as cloud-init +will create the required default interface configuration files. + +For Ubuntu this element will remove the network +configuration files from /etc/network/interfaces.d. diff --git a/elements/remove-default-ints/post-install.d/91-remove-default-ints b/elements/remove-default-ints/post-install.d/91-remove-default-ints new file mode 100755 index 0000000000..dfc355ac47 --- /dev/null +++ b/elements/remove-default-ints/post-install.d/91-remove-default-ints @@ -0,0 +1,8 @@ +#!/bin/bash + +set -eu +set -o xtrace + +if [[ "$DISTRO_NAME" == "ubuntu" ]]; then + sudo rm -f /etc/network/interfaces.d/* +fi