diff --git a/host_cleanup.sh b/host_cleanup.sh index 40a50dd7d..e7182e6b5 100755 --- a/host_cleanup.sh +++ b/host_cleanup.sh @@ -40,6 +40,7 @@ if systemctl is-active --quiet NetworkManager; then else sudo systemctl restart NetworkManager fi +mv /etc/resolv.conf.dev-scripts.backup /etc/resolv.conf # There was a bug in this file, it may need to be recreated. # delete the interface as it can cause issues when not rebooting diff --git a/utils.sh b/utils.sh index 7fc8a443a..1bfc95234 100755 --- a/utils.sh +++ b/utils.sh @@ -587,6 +587,9 @@ function write_pull_secret() { } function switch_to_internal_dns() { + # Create backup of the current resolv.conf in case user is using a manual configuration. This + # file will be used in host_cleanup to revert the initial DNS configuration of the host. + cp /etc/resolv.conf /etc/resolv.conf.dev-scripts.backup sudo mkdir -p /etc/NetworkManager/conf.d/ ansible localhost -b -m ini_file -a "path=/etc/NetworkManager/conf.d/dnsmasq.conf section=main option=dns value=dnsmasq" if [ "$ADDN_DNS" ] ; then