summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-02 02:08:06 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-02 02:08:06 +0000
commitc7f7e91919ee72b885d5b3253c608393279945ae (patch)
treedf8b892cd5327a89000d39d33824c556e90aaf2a
parente5c9364696dd1de43b51b39cd9f3792c2a50a3cf (diff)
downloaddrakx-backup-do-not-use-c7f7e91919ee72b885d5b3253c608393279945ae.tar
drakx-backup-do-not-use-c7f7e91919ee72b885d5b3253c608393279945ae.tar.gz
drakx-backup-do-not-use-c7f7e91919ee72b885d5b3253c608393279945ae.tar.bz2
drakx-backup-do-not-use-c7f7e91919ee72b885d5b3253c608393279945ae.tar.xz
drakx-backup-do-not-use-c7f7e91919ee72b885d5b3253c608393279945ae.zip
create detect_devices::probe_name() & detect_devices::probe_unique_name() and use them
-rw-r--r--perl-install/Xconfig/monitor.pm7
-rw-r--r--perl-install/detect_devices.pm12
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/install_interactive.pm4
-rw-r--r--perl-install/modules.pm2
5 files changed, 19 insertions, 10 deletions
diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm
index 251f384c8..eda0ff5ad 100644
--- a/perl-install/Xconfig/monitor.pm
+++ b/perl-install/Xconfig/monitor.pm
@@ -230,11 +230,8 @@ sub probe_using_X {
}
sub probe_DMI() {
- my ($res) = my @res = uniq(map { if_($_->{driver} =~ /^Resolution:(.*)/, $1) } detect_devices::probeall()) or return;
- if (@res > 1) {
- log::l("oops, more than one resolution from DMI and pci probe: ", join(' ', @res));
- }
- generic_flat_panel($res);
+ my $res = detect_devices::probe_unique_name('Resolution');
+ $res && generic_flat_panel($res);
}
sub generic_flat_panel {
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index a73b24598..2b3e3ff4c 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -779,6 +779,18 @@ sub matching_driver {
my (@list) = @_;
grep { member($_->{driver}, @list) } probeall();
}
+sub probe_name {
+ my ($name) = @_;
+ map { $_->{driver} =~ /^$name:(.*)/ } probeall();
+}
+sub probe_unique_name {
+ my ($name) = @_;
+ my @l = uniq(probe_name($name));
+ if (@l > 1) {
+ log::l("oops, more than one $name from probe: ", join(' ', @l));
+ }
+ $l[0];
+}
sub stringlist() {
map {
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index a44a98685..70ab8285f 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -768,7 +768,7 @@ sub rpmsrate_always_flags {
my $rpmsrate_flags_chosen = {};
$rpmsrate_flags_chosen->{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia');
- $rpmsrate_flags_chosen->{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall();
+ $rpmsrate_flags_chosen->{uc($_)} = 1 foreach detect_devices::probe_name('Flag');
$rpmsrate_flags_chosen->{DOCS} = !$o->{excludedocs};
$rpmsrate_flags_chosen->{UTF8} = $o->{locale}{utf8};
$rpmsrate_flags_chosen->{BURNER} = 1 if detect_devices::burners();
@@ -814,7 +814,7 @@ sub default_packages {
push @l, "mdadm" if !is_empty_array_ref($o->{all_hds}{raids});
push @l, "lvm2" if !is_empty_array_ref($o->{all_hds}{lvms});
push @l, "alsa", "alsa-utils" if any { $o->{modules_conf}->get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4;
- push @l, map { if_($_->{driver} =~ /^Pkg:(.*)/, $1) } detect_devices::probeall();
+ push @l, detect_devices::probe_name('Pkg');
my $dmi_BIOS = detect_devices::dmidecode_category('BIOS');
my $dmi_Base_Board = detect_devices::dmidecode_category('Base Board');
diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm
index 8cc936d3d..e5a0ebcb7 100644
--- a/perl-install/install_interactive.pm
+++ b/perl-install/install_interactive.pm
@@ -17,10 +17,10 @@ use log;
sub tellAboutProprietaryModules {
my ($o) = @_;
- my @l = grep { $_ } map { $_->{driver} =~ /^Bad:(.*)/ && $1 } detect_devices::probeall();
+ my @l = detect_devices::probe_name('Bad') or return;
$o->ask_warn('', formatAlaTeX(
N("Some hardware on your computer needs ``proprietary'' drivers to work.
-You can find some information about them at: %s", join(", ", @l)))) if @l;
+You can find some information about them at: %s", join(", ", @l))));
}
#- unit of $mb is mega bytes, min and max are in sectors, this
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 2351bd556..e0f02f927 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -188,7 +188,7 @@ sub write_preload_conf {
my ($conf) = @_;
my @l;
push @l, 'scsi_hostadapter' if $conf->get_probeall('scsi_hostadapter');
- push @l, map { if_($_->{driver} =~ /^Module:(.*)/, $1) } detect_devices::probeall();
+ push @l, detect_devices::probe_name('Module');
push @l, 'nvram' if detect_devices::isLaptop();
push @l, map { $_->{driver} } probe_category($_) foreach qw(multimedia/dvb multimedia/tv various/laptop input/joystick various/crypto);
push @l, 'padlock' if cat_("/proc/cpuinfo") =~ /rng_en/;