diff --git a/elements/remove-resolvconf/README.md b/elements/remove-resolvconf/README.md new file mode 100644 index 00000000..d692e821 --- /dev/null +++ b/elements/remove-resolvconf/README.md @@ -0,0 +1,7 @@ +================== +remove-resolveconf +================== + +Clears an existing ``/etc/resolv.conf`` from the resulting image, so that it +it will be managed via the network configuration. + diff --git a/elements/remove-resolvconf/cleanup.d/90-remove-resolvconf b/elements/remove-resolvconf/cleanup.d/90-remove-resolvconf new file mode 100755 index 00000000..66278ac9 --- /dev/null +++ b/elements/remove-resolvconf/cleanup.d/90-remove-resolvconf @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +# Clear the resolv.conf so that the nameserver configuration does not inherit +# any incorrect nameservers from the image. LP#1749756 +# NOTE: This relies on the fact the DIB copies the original resolv.conf and +# during the finalise_base function in img-functions (in DIB) copies the old +# one back in place after the build process completes. +sudo sed -i '/nameserver/d' $TARGET_ROOT/etc/resolv.conf.ORIG