From 6c00c3c1fd1e3fee0d10c1f1b4f6257d21d663d9 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sun, 29 May 2011 12:03:12 +0200 Subject: [PATCH] Update resolv.conf handling to properly support /run (see issue984). --- etc/grml/fai/config/hooks/instsoft.GRMLBASE | 8 ++++++-- etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs | 20 ++++++++++++-------- etc/grml/fai/grml/grml_cleanup_chroot | 13 ++++++++++--- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/etc/grml/fai/config/hooks/instsoft.GRMLBASE b/etc/grml/fai/config/hooks/instsoft.GRMLBASE index cf8c3be..c787334 100755 --- a/etc/grml/fai/config/hooks/instsoft.GRMLBASE +++ b/etc/grml/fai/config/hooks/instsoft.GRMLBASE @@ -21,7 +21,7 @@ if [ "$FAI_ACTION" = "softupdate" ] ; then echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running" if [ -r /etc/resolv.conf ] ; then - if [ -d $target/etc/resolvconf/run ] ; then # resolvconf + if [ -d $target/etc/resolvconf/run ] ; then # 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 @@ -31,6 +31,10 @@ if [ "$FAI_ACTION" = "softupdate" ] ; then echo " Looks like something is wrong, please fix manually." >&2 exit 1 fi + elif [ -L $target/etc/resolvconf/run ] ; then # resolvconf with /run + # /etc/resolvconf/run symlinks to /run/resolvconf + mkdir -p $target/run/resolvconf + cat /etc/resolv.conf >> $target/run/resolvconf/resolv.conf else # no resolvconf installed in chroot if ! [ -L $target/etc/resolv.conf ] ; then cat /etc/resolv.conf >> $target/etc/resolv.conf @@ -153,4 +157,4 @@ if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then fi ## END OF FILE ################################################################# -# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs b/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs index bbe6117..65a1f53 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs +++ b/etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs @@ -22,22 +22,26 @@ if ifclass RELEASE ; then [ -n "$HOSTNAME" ] || HOSTNAME=grml if [ -r /etc/resolv.conf ] ; then - if [ -d $target/etc/resolvconf/run ] ; then # resolvconf + if [ -d $target/etc/resolvconf/run ] ; then # 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 + 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 + 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 + elif [ -L $target/etc/resolvconf/run ] ; then # resolvconf with /run + # /etc/resolvconf/run symlinks to /run/resolvconf + mkdir -p $target/run/resolvconf + cat /etc/resolv.conf >> $target/run/resolvconf/resolv.conf else # no resolvconf installed in chroot if ! [ -L $target/etc/resolv.conf ] ; then - cat /etc/resolv.conf >> $target/etc/resolv.conf + 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 + echo "Error: /etc/resolv.conf in chroot should not be a symlink (resolvconf not installed)." >&2 + exit 1 fi fi fi diff --git a/etc/grml/fai/grml/grml_cleanup_chroot b/etc/grml/fai/grml/grml_cleanup_chroot index 2ad900b..074e60e 100755 --- a/etc/grml/fai/grml/grml_cleanup_chroot +++ b/etc/grml/fai/grml/grml_cleanup_chroot @@ -306,10 +306,17 @@ fi # installation of resolvconf in chroot *with* /proc # is different from an installation without /proc, -# so make sure it is OK in any case; don't use /dev/shm +# so make sure it is OK in any case if [ -d /etc/resolvconf ] ; then - rm -rf /etc/resolvconf/run - mkdir /etc/resolvconf/run + if [ -L /etc/resolvconf/run ] ; then # resolvconf with /run + # /etc/resolvconf/run symlinks to /run/resolvconf + rm -rf /run/resolvconf + mkdir -p /run/resolvconf + else # no /run present + rm -rf /etc/resolvconf/run + mkdir /etc/resolvconf/run + fi + touch /etc/resolvconf/run/enable-updates mkdir /etc/resolvconf/run/interface cat > /etc/resolvconf/run/resolv.conf << EOF -- 2.1.4