if [ "$FAI_ACTION" = "softupdate" ] ; then
echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
- if [ -r /etc/resolv.conf ] ; then
- case "$(chroot $target readlink -f /etc/resolv.conf)" in
- /run/*) # resolvconf with /run
- mkdir -p $target/run/resolvconf
- cat /etc/resolv.conf >> $target/run/resolvconf/resolv.conf
- ;;
- /lib/*) # resolvconf without /run
- # sanity check to avoid "input file is output file",
- # see http://bts.grml.org/grml/issue984
- if ! [ -L $target/etc/resolvconf/run/resolv.conf ] ; then
- cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
- else
- echo "Error: /etc/resolvconf/run/resolv.conf in chroot should not be a symlink." >&2
- echo " Looks like something is wrong, please fix manually." >&2
- exit 1
- fi
- ;;
- *) # no resolvconf
- if ! [ -L $target/etc/resolv.conf ] ; then
- cat /etc/resolv.conf >> $target/etc/resolv.conf
- else
- echo "Error: /etc/resolv.conf in chroot should not be a symlink (resolvconf not installed)." >&2
- exit 1
- fi
- ;;
- esac
- fi
+ # /etc/resolv.conf is usually a symlink, pointing out of the chroot.
+ # Make it a file with known contents.
+ rm -f "${target}"/etc/resolv.conf
+ cat /etc/resolv.conf >> "$target"/etc/resolv.conf
if [ -r $target/etc/policy-rc.d.conf ] ; then
sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf
echo "Warning: resolvconf not installed"
else
echo "Setting up resolvconf"
- if [ -L $target/etc/resolvconf/run ] ; then # resolvconf with /run
- # /etc/resolvconf/run symlinks to /run/resolvconf
- RESOLV_CONF=/run/resolvconf/
- else # no /run present
- RESOLV_CONF=/etc/resolvconf/run/
- fi
-
- rm -rf ${target}/${RESOLV_CONF}
- mkdir -p ${target}/${RESOLV_CONF}
+ if [ ! -L $target/etc/resolvconf/run ] ; then # resolvconf without symlink?!
+ RESOLV_CONF=/etc/resolvconf/run
+ rm -rf ${target}/${RESOLV_CONF}
+ mkdir -p ${target}/${RESOLV_CONF}
- touch ${target}/${RESOLV_CONF}/enable-updates
- mkdir ${target}/${RESOLV_CONF}/interface
+ touch ${target}/${RESOLV_CONF}/enable-updates
+ mkdir ${target}/${RESOLV_CONF}/interface
- cat > ${target}/${RESOLV_CONF}/resolv.conf << EOF
+ cat > ${target}/${RESOLV_CONF}/resolv.conf << EOF
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
EOF
+ fi
+ rm -f ${target}/etc/resolv.conf
+ $ROOTCMD ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf
fi
if ! $ROOTCMD test -x /usr/bin/updatedb ; then