[Fai-commit] r6770 - trunk/bin

Michael Prokop mika at alioth.debian.org
Mon Oct 24 12:36:28 UTC 2011


Author: mika
Date: 2011-10-24 12:36:28 +0000 (Mon, 24 Oct 2011)
New Revision: 6770

Modified:
   trunk/bin/make-fai-nfsroot
Log:
make-fai-nfsroot: do not error out if getent hosts fails

Since we're running under set -e the command might file
and errors out without indicating what went wrong.

So instead do not error out silently but instead warn the user about
the fact that the hostname couldn't be found and continue execution.

From: Michael Prokop <mika at grml.org>

Modified: trunk/bin/make-fai-nfsroot
===================================================================
--- trunk/bin/make-fai-nfsroot	2011-10-23 18:39:05 UTC (rev 6769)
+++ trunk/bin/make-fai-nfsroot	2011-10-24 12:36:28 UTC (rev 6770)
@@ -273,8 +273,12 @@
 
     local line
     for eth in $ips; do
-	line=$(getent hosts $eth)
-	ainsl -v $NFSROOT/etc/hosts "$line"
+	line=$(getent hosts $eth || true)
+	if [ -n "$line" ] ; then
+	  ainsl -v $NFSROOT/etc/hosts "$line"
+        else
+	  echo "Warning: no hostname for $eth found, not adding to /etc/hosts."
+        fi
     done
 
     if [ -f /etc/resolv.conf ]; then




More information about the Fai-commit mailing list