don't fail if nslookup is not found
authorChristian Kujau <lists@nerdbynature.de>
Mon, 20 Jul 2009 09:31:39 +0000 (11:31 +0200)
committerChristoph Hellwig <hch@brick.lst.de>
Mon, 20 Jul 2009 09:31:39 +0000 (11:31 +0200)
When nslookup is not available, execution would stop. This patch moves the
check for nslookup and the _get_fqdn function into the ./new script (since
this is the only place where it's used) and we don't fail any more but try
to find out our FQDN without nslookup.

Signed-off-by: Christian Kujau <lists@nerdbynature.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
common.config
common.rc
new

index 15c7976e6958b9f4632b0d31c426f4b49075f810..fecbabe1c0ae3de8047a741210d283171008e1b8 100644 (file)
@@ -120,9 +120,6 @@ export UMOUNT_PROG="`set_prog_path umount`"
 export FSSTRESS_PROG="`set_prog_path fsstress $PWD/ltp/fsstress`"
 [ "$FSSTRESS_PROG" = "" ] && _fatal "fsstress not found"
 
-export NSLOOKUP_PROG="`set_prog_path nslookup`"
-[ "$NSLOOKUP_PROG" = "" ] && _fatal "nslookup not found"
-
 export PERL_PROG="`set_prog_path perl`"
 [ "$PERL_PROG" = "" ] && _fatal "perl not found"
 
index 74a4900c7123af3d630a99be2aa8267dd27b11b9..0d655ca70395cf87f561511b6e0bd4f48c3953aa 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -330,14 +330,6 @@ _get_pids_by_name()
        -e "/[0-9]:[0-9][0-9]  *$1 /s/ .*//p"
 }
 
-# fqdn for localhost
-#
-_get_fqdn()
-{
-    host=`hostname`
-    $NSLOOKUP_PROG $host | $AWK_PROG '{ if ($1 == "Name:") print $2 }'
-}
-
 # fix malloc libs output
 #
 _fix_malloc()
diff --git a/new b/new
index 8e32824b0074e23c0cd42e6f5f28dfb9af9f8b64..08fc401e4dc58bc6e1916b7114999daeb05093fc 100755 (executable)
--- a/new
+++ b/new
@@ -32,6 +32,17 @@ _cleanup()
     :
 }
 
+# fqdn for localhost
+_get_fqdn()
+{
+    NSLOOKUP_PROG="`set_prog_path nslookup`"
+    if [ "$NSLOOKUP_PROG" = "" ]; then
+       getent hosts `uname -n` | awk '{print $2}'
+    else
+       $NSLOOKUP_PROG `hostname` | $AWK_PROG '{ if ($1 == "Name:") print $2 }'
+    fi
+}
+
 if [ ! -f group ]
 then
     echo "Creating the group index ..."