bind mount /etc/resolv.conf instead of overwriting/removing

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2016-04-04 21:58:43 +02:00
parent c6e4888c84
commit 1d42e4afcb
2 changed files with 5 additions and 4 deletions

View file

@ -42,7 +42,6 @@ mountpoint -q "${chroot}/dev/pts" \
mountpoint -q "${chroot}/tmp" \ mountpoint -q "${chroot}/tmp" \
|| mount -t tmpfs -o mode=1777,strictatime,nodev,nosuid tmpfs "${chroot}/tmp" || mount -t tmpfs -o mode=1777,strictatime,nodev,nosuid tmpfs "${chroot}/tmp"
if [ ! -f "${chroot}/etc/resolv.conf" ]; then mountpoint -q "${chroot}/etc/resolv.conf" \
cp /etc/resolv.conf "${chroot}/etc/" || mount --bind -o ro /etc/resolv.conf "${chroot}/etc/resolv.conf"
fi
DONE DONE

View file

@ -26,7 +26,9 @@ umount -l "${chroot}/dev/pts"
umount -l "${chroot}/dev" umount -l "${chroot}/dev"
umount -l "${chroot}/sys" umount -l "${chroot}/sys"
umount -l "${chroot}/proc" umount -l "${chroot}/proc"
rm -f "${chroot}/etc/resolv.conf" if mountpoint -q "${chroot}/etc/resolv.conf"; then
umount "${chroot}/etc/resolv.conf"
fi
if [ -d "${chroot}/etc/resolvconf/resolv.conf.d" ]; then if [ -d "${chroot}/etc/resolvconf/resolv.conf.d" ]; then
# ensure /etc/resolvconf/resolv.conf.d/tail is not linked to \ # ensure /etc/resolvconf/resolv.conf.d/tail is not linked to \
# e.g. /etc/resolvconf/resolv.conf.d/original # e.g. /etc/resolvconf/resolv.conf.d/original