Update resolv.conf handling to properly support /run (see issue984).
authorMichael Prokop <mika@grml.org>
Sun, 29 May 2011 10:03:12 +0000 (12:03 +0200)
committerMichael Prokop <mika@grml.org>
Sat, 4 Jun 2011 10:59:29 +0000 (12:59 +0200)
etc/grml/fai/config/hooks/instsoft.GRMLBASE
etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs
etc/grml/fai/grml/grml_cleanup_chroot

index cf8c3be..c787334 100755 (executable)
@@ -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
index bbe6117..65a1f53 100755 (executable)
@@ -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
index 2ad900b..074e60e 100755 (executable)
@@ -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