summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-09-07 16:04:35 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-09-07 16:04:35 +0000
commitb8f3f1d37183e4ba45a173f1c9800e56daa1fa3a (patch)
tree040821895050aa4365c9e9e72a142dcc5fa3de87
parent5d31c65a29a5be64fe46946651108e0e13242037 (diff)
downloaddrakx-b8f3f1d37183e4ba45a173f1c9800e56daa1fa3a.tar
drakx-b8f3f1d37183e4ba45a173f1c9800e56daa1fa3a.tar.gz
drakx-b8f3f1d37183e4ba45a173f1c9800e56daa1fa3a.tar.bz2
drakx-b8f3f1d37183e4ba45a173f1c9800e56daa1fa3a.tar.xz
drakx-b8f3f1d37183e4ba45a173f1c9800e56daa1fa3a.zip
no_comment
-rw-r--r--docs/TODO7
-rw-r--r--perl-install/install2.pm1
-rw-r--r--perl-install/install_steps_interactive.pm42
-rw-r--r--perl-install/interactive.pm13
-rw-r--r--perl-install/modparm.pm65
-rw-r--r--perl-install/modules.pm3
6 files changed, 50 insertions, 81 deletions
diff --git a/docs/TODO b/docs/TODO
index 5266faf6a..10dd17197 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -1,6 +1,3 @@
-dd the different xmodmaps for every languages (maybe gnome-core xmodmaps can help)
-xmodmap needed even for english as the backspace is not what it should
-
merge the install(1) of redhat
try detect_devices::floppies (and how are scsi floppies handled?)
@@ -74,3 +71,7 @@ look at SuperProbe
timezone using a picture (pb: how to delimit zones)
suggested partition tables must be better foreach installClass
+
+Done_ZZZ:EEE:Pixel: dd the different xmodmaps for every languages (maybe gnome-core xmodmaps can help)
+xmodmap needed even for english as the backspace is not what it should
+
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 4fccfd454..4f2ca84b2 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -554,6 +554,7 @@ sub main {
modules::load_deps("/modules/modules.dep");
modules::get_stage1_conf("/tmp/conf.modules");
modules::read_already_loaded();
+ modparm::read_modparm_file("/usr/share/modparm.lst");
while (@_) {
local $_ = shift;
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index f09040eda..9a98e16bb 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -534,38 +534,30 @@ sub loadModule {
[ modules::text_of_type($type) ]) or return;
my $m = modules::text2driver($l);
- if ($o->ask_from_list('',
+ my @names = modparm::get_options_name($m);
+
+ if ((!defined @names || @names > 0) && $o->ask_from_list('',
_("In some cases, the %s driver needs to have extra information to work
properly, although it normally works fine without. Would you like to specify
extra options for it or allow the driver to probe your machine for the
information it needs? Occasionally, probing will hang a computer, but it should
not cause any damage.", $l),
- [ __("Autoprobe"), __("Specify options") ], "Autoprobe") ne "Autoprobe") {
+ [ __("Autoprobe"), __("Specify options") ], "Autoprobe") ne "Autoprobe") {
ASK:
- my $rnames = modparm::get_options_name($m);
- my $rvalues = modparm::get_options_value($m);
-
- $o->ask_from_entries_ref('',
+ if (defined @names) {
+ my @l = $o->ask_from_entries('',
_("Here must give the different options for the module %s.", $l),
- $rnames, $rvalues);
-
- @options = split ' ', modparm::get_options_result($m, $rvalues);
-# @options = split ' ',
-# $o->ask_from_entry('',
-#_("Here must give the different options for the module %s.
-#Options are in format ``name=value name2=value2 ...''.
-#For example you can have ``io=0x300 irq=7''", $l),
-# _("Module options:"),
-# );
-#=======
-# ASK:
-# @options = split ' ',
-# $o->ask_from_entry('',
-#_("Here must give the different options for the module %s.
-#Options are in format ``name=value name2=value2 ...''.
-#For example you can have ``io=0x300 irq=7''", $l),
-# _("Module options:"),
-# );
+ \@names) or return;
+ @options = modparm::get_options_result($m, @l);
+ } else {
+ @options = split ' ',
+ $o->ask_from_entry('',
+_("Here must give the different options for the module %s.
+Options are in format ``name=value name2=value2 ...''.
+For example you can have ``io=0x300 irq=7''", $l),
+ _("Module options:"),
+ );
+ }
}
eval { modules::load($m, $type, @options) };
if ($@) {
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index fe941bd30..8a9c73ade 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -89,22 +89,21 @@ sub ask_many_from_list($$$$;$) {
[ map { $$_ } @$val ] : undef;
}
-sub ask_from_entry($$$;$%) {
- my ($o, $title, $message, $def, %callback) = @_;
+sub ask_from_entry {
+ my ($o, $title, $message, $label, $def, %callback) = @_;
-
$message = ref $message ? $message : [ $message ];
- $o->ask_from_entries($title, $message, [$def], %callback);
-# $o->ask_from_entryW($title, $message, $def);
+ $o->ask_from_entries($title, $message, [ $label ], [ $def ], %callback);
}
sub ask_from_entries($$$$;$%) {
my ($o, $title, $message, $l, $def, %callback) = @_;
my $val = [ map { my $i = $_; \$i } @$def ];
- $o->ask_from_entries_ref($title, $message, $l, $val, %callback) ?
- [ map { $$_ } @$val ] : undef;
+ $o->ask_from_entries_ref($title, $message, $l, $val, %callback) ?
+ map { $$_ } @$val :
+ undef;
}
# can get a hash of callback: focus_out changed and complete
# moreove if you pass a hash with a field list -> combo
diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm
index a630cdd5c..cfbd063b5 100644
--- a/perl-install/modparm.pm
+++ b/perl-install/modparm.pm
@@ -1,14 +1,20 @@
package modparm;
+use diagnostics;
+use strict;
+
+use common qw(:common);
use log;
+
my %modparm_hash;
sub read_modparm_file($) {
my ($file) = @_;
my @line;
- open F, $file;
+ local *F;
+ open F, $file or log::l("missing $file: $!"), return;
while (<F>) {
chomp;
@line = split ':';
@@ -19,60 +25,29 @@ sub read_modparm_file($) {
desc => $line [4],
};
}
- close F;
}
-sub get_options_result($;$) {
- my ($module,$value) = @_;
- my @names = keys %{$modparm_hash{$module}};
- my $options;
- my $result;
- my $i;
+sub get_options_result($@) {
+ my ($module, @value) = @_;
- for $i (0..$#$value) {
- $result = $ {$value->[$i]};
-
- if ($result != "") {
- $options .= "$names[$i]=$result ";
- }
- }
-
- return $options;
+ mapn {
+ my ($a, $b) = @_;
+ $a ? "$b=$a" : ()
+ } \@value, [ keys %{$modparm_hash{$module}} ];
}
sub get_options_name($) {
my ($module) = @_;
- my @names = keys %{$modparm_hash{$module}};
- my @result;
- my $opttype;
- my $default;
+ my @names;
- foreach (@names) {
- $opttype = $modparm_hash{$module}{$_}{type};
- $default = $modparm_hash{$module}{$_}{default};
+ %modparm_hash or return;
- if (defined($default)) {
- push @result, _("$_ ($opttype)[$default]");
- } else {
- push @result, _("$_ ($opttype)");
- }
+ while (my ($k, $v) = each %{$modparm_hash{$module} || {}}) {
+ my $opttype = $v->{type};
+ my $default = $v->{default};
+ push @names, "$k ($v->{type})" . (defined($v->{default}) && "[$v->{default}]");
}
-
- return \@result;
-}
-
-sub get_options_value($) {
- my ($module) = @_;
- my @names = keys %{$modparm_hash{$module}};
- my @result;
-
- for $i (0..$#names) {
- my $value = "";
-
- $result[$i] = \$value;
- }
-
- return \@result;
+ @names;
}
read_modparm_file("/tmp/modparm.txt");
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 6124c11b0..46ff2b068 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -244,7 +244,8 @@ sub load($;$@) {
my ($name, $type, @options) = @_;
if ($::testing) {
- log::l("i try to install $name module");
+ print join ",", @options, "\n";
+ log::l("i try to install $name module (@options)");
} else {
$conf{$name}{loaded} and return;