~fginther/vmbuilder/new-artful-builder

« back to all changes in this revision

Viewing changes to templates/img-azure.tmpl

  • Committer: Dimitri John Ledkov
  • Date: 2017-10-10 22:34:03 UTC
  • Revision ID: xnox@ubuntu.com-20171010223403-za59rzuifbvk199g
Correctly backup and restore /etc/resolv.conf

During chroot operations the host resolv.conf is needed, but the final
image should preserve the original resolv.conf symlink which maybe
either resolveconf, or stub resolved.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    chmod 0755 "${mp}/usr/sbin/policy-rc.d" ||
69
69
        fail "Unable to make policy-rc.d executable"
70
70
 
71
 
    rm "${mp}/etc/resolv.conf" ||
72
 
        fail "Unable to remove /etc/resolv.conf"
 
71
    mv "${mp}/etc/resolv.conf" "${mp}/etc/resolv.conf.orig" ||
 
72
        fail "Unable to backup /etc/resolv.conf"
73
73
 
74
74
    cp /etc/resolv.conf "${mp}/etc/resolv.conf" &&
75
75
        debug "Placed resolv.conf in image" ||
98
98
    rm "${mp}/etc/resolv.conf" ||
99
99
        fail "Failed to remove /etc/resolv.conf"
100
100
 
101
 
    chroot "${mp}" ln -snf ../run/resolvconf/resolv.conf /etc/resolv.conf
 
101
    mv "${mp}/etc/resolv.conf.orig" "${mp}/etc/resolv.conf" ||
 
102
        fail "Unable to revert /etc/resolv.conf"
102
103
}
103
104
 
104
105
build_chroot() {