From 73cad9dee2c7c361d2dcacf5daa94b6bf7c74d42 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 4 Apr 2016 23:31:38 +0200 Subject: [PATCH] backcompat Signed-off-by: Steven Armstrong --- cdist/conf/type/__chroot_mount/gencode-remote | 10 ++++++++-- cdist/conf/type/__chroot_umount/gencode-remote | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__chroot_mount/gencode-remote b/cdist/conf/type/__chroot_mount/gencode-remote index 14da81ee..7ec41f28 100755 --- a/cdist/conf/type/__chroot_mount/gencode-remote +++ b/cdist/conf/type/__chroot_mount/gencode-remote @@ -42,6 +42,12 @@ mountpoint -q "${chroot}/dev/pts" \ mountpoint -q "${chroot}/tmp" \ || mount -t tmpfs -o mode=1777,strictatime,nodev,nosuid tmpfs "${chroot}/tmp" -mountpoint -q "${chroot}/etc/resolv.conf" \ - || mount --bind -o ro /etc/resolv.conf "${chroot}/etc/resolv.conf" +if [ -f "${chroot}/etc/resolv.conf" ]; then + # if file exists, bind mount over it + mountpoint -q "${chroot}/etc/resolv.conf" \ + || mount --bind -o ro /etc/resolv.conf "${chroot}/etc/resolv.conf" +else + # otherwise copy + cp /etc/resolv.conf "${chroot}/etc/resolv.conf" +fi DONE diff --git a/cdist/conf/type/__chroot_umount/gencode-remote b/cdist/conf/type/__chroot_umount/gencode-remote index ad06a0a2..cbcdeff2 100755 --- a/cdist/conf/type/__chroot_umount/gencode-remote +++ b/cdist/conf/type/__chroot_umount/gencode-remote @@ -28,6 +28,8 @@ umount -l "${chroot}/sys" umount -l "${chroot}/proc" if mountpoint -q "${chroot}/etc/resolv.conf"; then umount "${chroot}/etc/resolv.conf" +else + rm -rf "${chroot}/etc/resolv.conf" fi if [ -d "${chroot}/etc/resolvconf/resolv.conf.d" ]; then # ensure /etc/resolvconf/resolv.conf.d/tail is not linked to \