summaryrefslogtreecommitdiffstats
path: root/perl-install/modules/interactive.pm
blob: b4ce5280e7a669a71f4e19aee4e56cae0dfc7903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package modules::interactive;
use interactive;
use common;

sub config_window {
    my ($in, $data) = @_;
    require modules;
    modules::mergein_conf('/etc/modules.conf');
    my %conf = modules::get_parameters($data->{driver});
    require modparm;
    my @l;
    foreach (modparm::parameters($data->{driver})) {
	   my ($name, $format, $description) = @$_;
	   push @l, { label => $name, help => "$description\n[$format]", val => \$conf{$name} };
    }
    if ($in->ask_from("Module configuration", N("You can configure each parameter of the module here."), \@l)) {
	   my $options = join(' ', map { if_($conf{$_}, "$_=$conf{$_}") } keys %conf);
	   if ($options) {
		  modules::set_options($_->{driver}, $options);
		    modules::write_conf;
		}
    }
}

1;