From 36ac1e7fc40214f592dcf464dc7bbec53a81a77d Mon Sep 17 00:00:00 2001 From: Stew Benedict Date: Mon, 15 Sep 2003 19:37:07 +0000 Subject: New, improved, compact code, courtesy of Thierry. --- perl-install/standalone/drakbug | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'perl-install/standalone') 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 -- cgit v1.2.1