From: Aleksey Senin Date: Mon, 3 Nov 2008 13:38:52 +0000 (+0200) Subject: Fix for empty $distro X-Git-Tag: vofed-1.4-rc4~2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=d08e59dde104cea3c1e9a1843e882f3aa4f89c31;p=~vlad%2Fofed_scripts.git Fix for empty $distro Section with distro recognition should be used before first time using dpkg or rpm command Signed-off-by: Aleksey Senin --- diff --git a/install.pl b/install.pl index b076c0d..d12cff7 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 () { - 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 () { + 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;