From 5e34db6b31a2dd2707e8c6824dad9edfc837acfe Mon Sep 17 00:00:00 2001 From: Robert Nelson <robertcnelson@gmail.com> Date: Fri, 27 Jul 2018 14:17:59 -0500 Subject: [PATCH] chroot: backup /etc/resolv.conf Signed-off-by: Robert Nelson <robertcnelson@gmail.com> --- scripts/chroot.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/chroot.sh b/scripts/chroot.sh index 181c58c7c..dfd86e2f0 100755 --- a/scripts/chroot.sh +++ b/scripts/chroot.sh @@ -586,17 +586,20 @@ cat > "${DIR}/chroot_script.sh" <<-__EOF__ rm -f /tmp/${repo_flat_key} || true fi - echo "debug: networking: --------------" - cat /etc/resolv.conf || true - echo "---------------------------------" + if [ -f /etc/resolv.conf ] ; then + echo "debug: networking: --------------" + cat /etc/resolv.conf || true + echo "---------------------------------" + cp -v /etc/resolv.conf /etc/resolv.conf.bak + fi apt-get update apt-get upgrade -y apt-get dist-upgrade -y - echo "debug: networking: --------------" - cat /etc/resolv.conf || true - echo "---------------------------------" + if [ ! -f /etc/resolv.conf ] ; then + cp -v /etc/resolv.conf.bak /etc/resolv.conf + fi if [ "x${chroot_very_small_image}" = "xenable" ] ; then if [ -f /bin/busybox ] ; then @@ -1294,6 +1297,7 @@ cat > "${DIR}/cleanup_script.sh" <<-__EOF__ cleanup if [ -f /usr/bin/connmanctl ] ; then + rm -rf /etc/resolv.conf.bak || true rm -rf /etc/resolv.conf || true ln -s /run/connman/resolv.conf /etc/resolv.conf fi -- GitLab