From 5eccf45ec4e7bdd1f5dcaa0cd0a87196c3722bd1 Mon Sep 17 00:00:00 2001
From: lissav <lissav@8638fb3e-16cb-4fca-ae20-7b5d299a9bcd>
Date: Wed, 22 Jun 2011 18:55:14 +0000
Subject: [PATCH] add check for 32 bit unixODBC, pam and openssl for Redhat 6
 CNM support defect 3314331

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9899 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
---
 xCAT-client/bin/db2sqlsetup | 73 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/xCAT-client/bin/db2sqlsetup b/xCAT-client/bin/db2sqlsetup
index 9f5b1574a..14e8e6d3d 100755
--- a/xCAT-client/bin/db2sqlsetup
+++ b/xCAT-client/bin/db2sqlsetup
@@ -1424,10 +1424,81 @@ sub setupODBC
     if ($::RUNCMD_RC != 0)
     {
         my $message =
-          "\nunixODBC is not installed.  If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs. If RHEL6 and ppc is being used then both unixODBC.*.ppc64 and unixODBC.*.ppc should be installed. ";
+          "\nunixODBC is not installed.  If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs. If Redhat and ppc is being used then both unixODBC.*.ppc64 and unixODBC.*.ppc should be installed. ";
         xCAT::MsgUtils->message("E", " $cmd failed. $message");
         exit(1);
     }
+    # For CNM you  must have the 32 bit version on Unix ODBC, Pam, 
+    # and openssl installed on Redhat.   Put out a warning.
+    if ($::linuxos =~ /rh.*/) {
+      $cmd = "rpm -qa | grep unixODBC";
+      my @output=xCAT::Utils->runcmd($cmd, 0);
+      # check for two lines one ppc and one ppc64
+      my $foundppc64 =0;
+      my $foundppc =0;
+      foreach my $line (@output)  {
+        if ($line =~ /\.ppc$/i) {
+         $foundppc=1;
+        }
+        if ($line =~ /\.ppc64$/i) {
+         $foundppc64=1;
+        }
+      }
+      if (($foundppc64 !=1) || ($foundppc != 1))
+      {
+        my $message =
+          "If Redhat on power is being used then both unixODBC.*.ppc64 and unixODBC.*.ppc rpms must be installed to run ISNM. ";
+        xCAT::MsgUtils->message("I", "$message");
+    
+      }
+      # check pam 32 and 64 bit installed
+      @output=();
+      $cmd = "rpm -qa | grep \^pam-";
+      @output=xCAT::Utils->runcmd($cmd, 0);
+      # check for two lines one ppc and one ppc64
+      $foundppc64 =0;
+      $foundppc =0;
+      foreach my $line (@output)  {
+        if ($line =~ /\.ppc$/i) {
+         $foundppc=1;
+        }
+        if ($line =~ /\.ppc64$/i) {
+         $foundppc64=1;
+        }
+      }
+      if (($foundppc64 !=1) || ($foundppc != 1))
+      {
+        my $message =
+          "If Redhat on power is being used then both pam-*.ppc64 and pam-*.ppc rpms must be installed to run ISNM. ";
+        xCAT::MsgUtils->message("I", "$message");
+    
+       }
+      # check openssl 32 and 64 bit installed
+      @output=();
+      $cmd = "rpm -qa | grep \^openssl-";
+      @output=xCAT::Utils->runcmd($cmd, 0);
+      # check for two lines one ppc and one ppc64
+      $foundppc64 =0;
+      $foundppc =0;
+      foreach my $line (@output)  {
+        if ($line =~ /\.ppc$/i) {
+         $foundppc=1;
+        }
+        if ($line =~ /\.ppc64$/i) {
+         $foundppc64=1;
+        }
+      }
+      if (($foundppc64 !=1) || ($foundppc != 1))
+      {
+        my $message =
+          "If Redhat on power is being used then both openssl*.ppc64 and openssl*.ppc rpms must be installed to run ISNM. ";
+        xCAT::MsgUtils->message("I", "$message");
+    
+       }
+    }
+
+
+
 
     my @rpmoutput;
     my $odbcinstfile;