Hi Brian,

I'm using your "whatami" in the MPI Testing Tool (MTT), but
I think a recent change to it broke for our sles10 system.
We have an lsb-release file that is different from what
"whatami" expects:

  $ cat /etc/lsb-release
  LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64"
  $ uname -a
  Linux burl-ct-v20z-6 2.6.16.46-0.12-smp #1 SMP Thu May 17 14:00:09 UTC 2007 
x86_64 x86_64 x86_64 GNU/Linux

I attached a patch.

Regards,
Ethan
diff -r cd64a2d41b67 client/whatami/whatami
--- a/client/whatami/whatami    Thu Oct 30 10:22:08 2008 -0500
+++ b/client/whatami/whatami    Thu Oct 30 14:27:57 2008 -0500
@@ -86,6 +86,8 @@
 #   2008.10.14 Brian Finley <fin...@anl.gov>
 #       - Add generic lsb_release support
 #         - includes CentOS 5.x
+#   2008.10.30 Ethan Mallove <ethan.mall...@sun.com>
+#       - Support two different SuSE 10 lsb-release file formats
 #
 #   Authors -- Be sure to increment the version number appropriately!
 #
@@ -121,7 +123,7 @@
 # ===========================================================================

 program=`echo $0 | sed 's:.*/::'` 
-version="2008.04.07"
+version="2008.10.30"

 
################################################################################
 #
@@ -167,19 +169,27 @@
         #          NOTES: But, make sure that newer programatic tests don't 
override
         #                 older tests with different results. -BEF-
         #
-        if [ -f /etc/lsb-release ]; then
+        lsb_release_file1="/etc/lsb-release"
+        lsb_release_file2="/usr/bin/lsb-release"
+        if [ -f $lsb_release_file1 ]; then
             #
-            # Example contents of /etc/lsb-release:
+            # 1) Example contents of /etc/lsb-release:
             #   DISTRIB_ID=Ubuntu
             #   DISTRIB_RELEASE=8.04
             #   DISTRIB_CODENAME=hardy
             #   DISTRIB_DESCRIPTION="Ubuntu hardy (development branch)"
-            . /etc/lsb-release
-            distro=${DISTRIB_ID}_${DISTRIB_RELEASE}
+            #
+            # 2) Example contents of /etc/lsb-release:
+            #   
LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64"
+            . $lsb_release_file1

-        elif [ -x /usr/bin/lsb_release ]; then
-            DISTRIB_ID=$(/usr/bin/lsb_release -i | sed -e 's/^Distributor 
ID:[[:space:]]//')
-            DISTRIB_RELEASE=$(/usr/bin/lsb_release -r | sed -e 
's/^Release:[[:space:]]//')
+        elif [ -x $lsb_release_file2 ]; then
+            DISTRIB_ID=$($lsb_release_file2 -i | sed -e 's/^Distributor 
ID:[[:space:]]//')
+            DISTRIB_RELEASE=$($lsb_release_file2 -r | sed -e 
's/^Release:[[:space:]]//')
+        fi
+
+        # If lsb-release contains the DISTRIB* variables we need - use them
+        if [ "${DISTRIB_ID}" != "" -a "${DISTRIB_RELEASE}" != "" ]; then
             distro=${DISTRIB_ID}_${DISTRIB_RELEASE}

         elif [ -f /etc/issue ]; then

Reply via email to