]> git.openfabrics.org - ~vlad/ofed_scripts.git/commitdiff
Fix for empty $distro
authorAleksey Senin <alekseys@voltaire.com>
Mon, 3 Nov 2008 13:38:52 +0000 (15:38 +0200)
committerVladimir Sokolovsky <vlad@mellanox.co.il>
Mon, 3 Nov 2008 14:17:59 +0000 (16:17 +0200)
Section with distro recognition should be used before first
time using dpkg or rpm command

Signed-off-by: Aleksey Senin <alekseys@voltaire.com>
install.pl

index b076c0d6a8d6dc9b24824caa77ac6ce8c4118181..d12cff7dfa5b0cc0c42689803b077d2adfd12818 100755 (executable)
@@ -89,35 +89,6 @@ my $dist_rpm;
 my $dist_rpm_ver = 0;
 my $dist_rpm_rel = 0;
 
-if (-f "/etc/issue") {
-    if (-f "/usr/bin/dpkg") {
-        if (-f "/etc/lsb-release") {
-            open (LSB, "/etc/lsb-release") || die "";
-            while (<LSB>) {
-                if (/DISTRIB_DESCRIPTION/) {
-                    $dist_rpm = (split '=', $_)[1];
-                    $dist_rpm =~ s/"//g;
-                    $dist_rpm =~ s/ /_/g;
-                }
-            }
-            close LSB;
-        }
-        else {
-            $dist_rpm = "debian";
-        }
-    }
-    else {
-        $dist_rpm = `rpm -qf /etc/issue | head -1`;
-        chomp $dist_rpm;
-        $dist_rpm_ver = get_rpm_ver_inst($dist_rpm);
-        $dist_rpm_rel = get_rpm_rel_inst($dist_rpm);
-    }
-}
-else {
-    $dist_rpm = "unsupported";
-}
-chomp $dist_rpm;
-
 # Set Linux Distribution
 if ( -f "/etc/SuSE-release" ) {
     $distro = "SuSE";
@@ -161,6 +132,35 @@ else {
     $distro = "unsupported";
 }
 
+if (-f "/etc/issue") {
+    if (-f "/usr/bin/dpkg") {
+        if (-f "/etc/lsb-release") {
+            open (LSB, "/etc/lsb-release") || die "";
+            while (<LSB>) {
+                if (/DISTRIB_DESCRIPTION/) {
+                    $dist_rpm = (split '=', $_)[1];
+                    $dist_rpm =~ s/"//g;
+                    $dist_rpm =~ s/ /_/g;
+                }
+            }
+            close LSB;
+        }
+        else {
+            $dist_rpm = "debian";
+        }
+    }
+    else {
+        $dist_rpm = `rpm -qf /etc/issue | head -1`;
+        chomp $dist_rpm;
+        $dist_rpm_ver = get_rpm_ver_inst($dist_rpm);
+        $dist_rpm_rel = get_rpm_rel_inst($dist_rpm);
+    }
+}
+else {
+    $dist_rpm = "unsupported";
+}
+chomp $dist_rpm;
+
 my $WDIR    = dirname($0);
 chdir $WDIR;
 my $CWD     = getcwd;