summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2003-09-15 19:37:07 +0000
committerStew Benedict <stewb@mandriva.org>2003-09-15 19:37:07 +0000
commit36ac1e7fc40214f592dcf464dc7bbec53a81a77d (patch)
treef126e3d0cceee3a6c8b127f0143ea1062d851d7e
parent78318af8dad1a7518cefaa5595bee409ac066b03 (diff)
downloaddrakx-36ac1e7fc40214f592dcf464dc7bbec53a81a77d.tar
drakx-36ac1e7fc40214f592dcf464dc7bbec53a81a77d.tar.gz
drakx-36ac1e7fc40214f592dcf464dc7bbec53a81a77d.tar.bz2
drakx-36ac1e7fc40214f592dcf464dc7bbec53a81a77d.tar.xz
drakx-36ac1e7fc40214f592dcf464dc7bbec53a81a77d.zip
New, improved, compact code, courtesy of Thierry.
-rwxr-xr-xperl-install/standalone/drakbug31
1 files changed, 6 insertions, 25 deletions
diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug
index caacf1297..d5b0dee0b 100755
--- a/perl-install/standalone/drakbug
+++ b/perl-install/standalone/drakbug
@@ -238,21 +238,14 @@ sub get_pkg_name {
my ($executable) = @_;
my $which_app = chomp_(`which '$executable' 2> /dev/null`);
my $rpm_package;
- my @tmp;
if ($which_app eq "") {
$rpm_package = chomp_(`rpm -q '$executable' --qf '%{NAME}' 2>&1`);
} else {
$rpm_package = chomp_(`rpm -qf '$which_app' --qf '%{NAME}' 2>&1`);
}
- $rpm_package = "" if $rpm_package =~ /not installed$/;
- if ($rpm_package eq "") {
- $rpm_package = chomp_(`rpm -qf '$executable' --qf '%{NAME}' 2>&1`);
- }
- if ($rpm_package =~ /^kernel/) {
- @tmp = split(/-2/, $rpm_package);
- $rpm_package = $tmp[0];
- }
- $rpm_package = N("NOT FOUND") if $rpm_package eq "";
+ $rpm_package = chomp_(`rpm -qf '$executable' --qf '%{NAME}' 2>&1`) if $rpm_package =~ /not installed$/;
+ $rpm_package = (split(/-2/, $rpm_package))[0] if $rpm_package =~ /^kernel/;
+ $rpm_package ||= N("NOT FOUND");
$rpm_package;
}
@@ -320,21 +313,9 @@ sub write_anthill_file() {
}
print F "-" x 80 . "\n";
- if ($kversion->get_active == 1) {
- $bugdesc = "Kernel: $kernel_release\n";
- $bugdesc .= "Uname: " . `uname -a` . "\n";
- print F $bugdesc;
- }
- if ($cpuinfo->get_active == 1) {
- $bugdesc = "Cpuinfo: \n";
- $bugdesc .= cat_("/proc/cpuinfo");
- print F $bugdesc;
- }
- if ($lspci->get_active == 1) {
- $bugdesc = "Lspci Output:\n";
- $bugdesc .= `lspci`;
- print F $bugdesc;
- }
+ print F "Kernel: $kernel_release\n" . "Uname: " . `uname -a` . "\n" if $kversion->get_active;
+ print F "Cpuinfo: \n" . cat_("/proc/cpuinfo") if $cpuinfo->get_active;
+ print F "Lspci Output:\n" . `lspci` if $lspci->get_active;
print F "--- END DRAKBUG REPORT ---\n";
close F or return 1;
return 0