diff options
author | Francois Pons <fpons@mandriva.com> | 1999-09-07 13:38:46 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 1999-09-07 13:38:46 +0000 |
commit | 5d31c65a29a5be64fe46946651108e0e13242037 (patch) | |
tree | 31a9081dedce7b89bb8260ffb6f0256ec9ec60b6 /perl-install | |
parent | 13cafe674927c9f8b8feaadd0c4b6bc9e5104fb7 (diff) | |
download | drakx-5d31c65a29a5be64fe46946651108e0e13242037.tar drakx-5d31c65a29a5be64fe46946651108e0e13242037.tar.gz drakx-5d31c65a29a5be64fe46946651108e0e13242037.tar.bz2 drakx-5d31c65a29a5be64fe46946651108e0e13242037.tar.xz drakx-5d31c65a29a5be64fe46946651108e0e13242037.zip |
*** empty log message ***
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/install_steps_interactive.pm | 32 | ||||
-rw-r--r-- | perl-install/modparm.pm | 80 |
2 files changed, 105 insertions, 7 deletions
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index c23fb4ab6..f09040eda 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -21,6 +21,7 @@ use lang; use pkgs; use keyboard; use fs; +use modparm; use log; use printer; @@ -541,13 +542,30 @@ information it needs? Occasionally, probing will hang a computer, but it should not cause any damage.", $l), [ __("Autoprobe"), __("Specify options") ], "Autoprobe") ne "Autoprobe") { 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:"), - ); + my $rnames = modparm::get_options_name($m); + my $rvalues = modparm::get_options_value($m); + + $o->ask_from_entries_ref('', +_("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:"), +# ); } eval { modules::load($m, $type, @options) }; if ($@) { diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm new file mode 100644 index 000000000..a630cdd5c --- /dev/null +++ b/perl-install/modparm.pm @@ -0,0 +1,80 @@ +package modparm; + +use log; + +my %modparm_hash; + +sub read_modparm_file($) { + my ($file) = @_; + my @line; + + open F, $file; + while (<F>) { + chomp; + @line = split ':'; + + $modparm_hash{$line[0]}{$line[1]} = { + type => $line[2], + default => $line[3], + desc => $line [4], + }; + } + close F; +} + +sub get_options_result($;$) { + my ($module,$value) = @_; + my @names = keys %{$modparm_hash{$module}}; + my $options; + my $result; + my $i; + + for $i (0..$#$value) { + $result = $ {$value->[$i]}; + + if ($result != "") { + $options .= "$names[$i]=$result "; + } + } + + return $options; +} + +sub get_options_name($) { + my ($module) = @_; + my @names = keys %{$modparm_hash{$module}}; + my @result; + my $opttype; + my $default; + + foreach (@names) { + $opttype = $modparm_hash{$module}{$_}{type}; + $default = $modparm_hash{$module}{$_}{default}; + + if (defined($default)) { + push @result, _("$_ ($opttype)[$default]"); + } else { + push @result, _("$_ ($opttype)"); + } + } + + 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; +} + +read_modparm_file("/tmp/modparm.txt"); + +1; |