[ewg] Patch for install.pl

Aleksey Senin alekseys at voltaire.com
Mon Nov 3 05:38:52 PST 2008


You probably want move section with distro recognition before first time
using dpkg/rpm command.

>From ac6622367065157285db96232494b943fc1b764a Mon Sep 17 00:00:00 2001
From: Aleksey Senin <alekseys at voltaire.com>
Date: Mon, 3 Nov 2008 15:26:06 +0200
Subject: [PATCH] Fix for empty $distro

Section with distro recognition should be used before first
time using dpkg or rpm command

Signed-off-by: Aleksey Senin <alekseys at voltaire.com>
---
:100755 100755 6550ecc... 0a9f362... M	install.pl
 install.pl |   58 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/install.pl b/install.pl
index 6550ecc..0a9f362 100755
--- a/install.pl
+++ b/install.pl
@@ -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;
-- 
1.5.6.dirty





More information about the ewg mailing list