summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-07-21 00:16:04 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-07-21 00:16:04 +0000
commit7e8fa9773839843c9d8def81ec2ef1315115825a (patch)
treeb20f63ae9f67b2d9c7e8aa6a2b86d56e0d953743 /perl-install/harddrake
parent54b71cdf438434e4693aa6064596f4fdb4aac59e (diff)
downloaddrakx-backup-do-not-use-7e8fa9773839843c9d8def81ec2ef1315115825a.tar
drakx-backup-do-not-use-7e8fa9773839843c9d8def81ec2ef1315115825a.tar.gz
drakx-backup-do-not-use-7e8fa9773839843c9d8def81ec2ef1315115825a.tar.bz2
drakx-backup-do-not-use-7e8fa9773839843c9d8def81ec2ef1315115825a.tar.xz
drakx-backup-do-not-use-7e8fa9773839843c9d8def81ec2ef1315115825a.zip
- %modules::conf is no more a global, so many functions need passing $modules_conf
- $modules_conf is a class choosing modules.conf or modprobe.conf (esp. useful after install) (but not working yet!) - modules::load() doesn't use $modules_conf, use modules::load_and_configure() - modules::load() doesn't allow options, use either modules::load_raw() or modules::load_and_configure() - some functions used to want an array ref for modules options and some a string, now every functions use a string - many functions (like modules::get_alias()) are now methods on $modules_conf - some functions in mouse.pm needed a $in where a $do_pkgs is enough - some perl_checker compliance - small fixes
Diffstat (limited to 'perl-install/harddrake')
-rw-r--r--perl-install/harddrake/autoconf.pm8
-rw-r--r--perl-install/harddrake/data.pm8
-rw-r--r--perl-install/harddrake/sound.pm41
-rw-r--r--perl-install/harddrake/v4l.pm6
4 files changed, 34 insertions, 29 deletions
diff --git a/perl-install/harddrake/autoconf.pm b/perl-install/harddrake/autoconf.pm
index 985fecb4e..c347955ba 100644
--- a/perl-install/harddrake/autoconf.pm
+++ b/perl-install/harddrake/autoconf.pm
@@ -4,24 +4,24 @@ use common;
use any;
sub xconf {
- my ($o) = @_;
+ my ($modules_conf, $o) = @_;
log::l('automatic XFree configuration');
require Xconfig::default;
- $o->{raw_X} = Xconfig::default::configure(keyboard::read());
+ $o->{raw_X} = Xconfig::default::configure();
require Xconfig::main;
require class_discard;
Xconfig::main::configure_everything_auto_install($o->{raw_X}, class_discard->new, {}, { allowFB => 1 });
- modules::load_category('various/agpgart');
+ modules::load_category($modules_conf, 'various/agpgart');
}
sub network_conf {
my ($o) = @_;
require network::network;
- network::network::easy_dhcp($o->{netc}, $o->{intf}) and $o->{netcnx}{type} = 'lan';
+ network::network::easy_dhcp($o->{modules_conf}, $o->{netc}, $o->{intf}) and $o->{netcnx}{type} = 'lan';
}
1;
diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm
index ca1b30b40..911db832f 100644
--- a/perl-install/harddrake/data.pm
+++ b/perl-install/harddrake/data.pm
@@ -46,6 +46,7 @@ sub set_removable_remover {
return "/usr/sbin/drakupdate_fstab --no-flag --del $device->{device}" if is_removable($class);
}
+my $modules_conf = modules::any_conf->read;
# Format is (HW class ID, l18n class name, icon, config tool , is_to_be_detected_on_boot)
our @tree =
@@ -183,7 +184,7 @@ our @tree =
string => N("ISDN adapters"),
icon => "modem.png",
configurator => "$sbindir/drakconnect",
- detector => sub { require network::isdn; my $isdn = network::isdn::detect_backend(); if_(@$isdn, f(@$isdn)) },
+ detector => sub { require network::isdn; my $isdn = network::isdn::detect_backend($modules_conf); if_(@$isdn, f(@$isdn)) },
checked_on_boot => 0,
},
@@ -208,7 +209,7 @@ our @tree =
string => N("Modem"),
icon => "modem.png",
configurator => "$sbindir/drakconnect",
- detector => sub { detect_devices::getModem() },
+ detector => sub { detect_devices::getModem($modules_conf) },
checked_on_boot => 0,
},
@@ -260,8 +261,7 @@ our @tree =
detector => sub {
require mouse;
require modules;
- modules::mergein_conf();
- &mouse::detect();
+ mouse::detect($modules_conf);
},
checked_on_boot => 1,
},
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index 94f3ac5f9..438d4b8b0 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -137,7 +137,10 @@ sub rooted { run_program::rooted($::prefix, @_) }
sub unload { modules::unload(@_) if $::isStandalone || $blacklisted }
-sub load { modules::load(@_) if $::isStandalone || $blacklisted }
+sub load {
+ my ($modules_conf, $name) = @_;
+ modules::load_and_configure($modules_conf, $name) if $::isStandalone || $blacklisted;
+}
sub get_alternative {
my ($driver) = @_;
@@ -145,7 +148,7 @@ sub get_alternative {
}
sub do_switch {
- my ($in, $old_driver, $new_driver, $index) = @_;
+ my ($in, $modules_conf, $old_driver, $new_driver, $index) = @_;
return if $old_driver eq $new_driver;
my $_wait = $in->wait_message(N("Please wait"), N("Please Wait... Applying the configuration"));
log::explanations("removing old $old_driver\n");
@@ -154,14 +157,14 @@ sub do_switch {
rooted("service alsa stop") if $old_driver =~ /^snd-/ && !$blacklisted;
unload($old_driver); # run_program("/sbin/modprobe -r $driver"); # just in case ...
}
- modules::remove_module($old_driver);
- modules::set_sound_slot("sound-slot-$index", $new_driver);
- modules::write_conf();
+ $modules_conf->remove_module($old_driver);
+ $modules_conf->set_sound_slot("sound-slot-$index", $new_driver);
+ $modules_conf->write;
if ($new_driver =~ /^snd-/) { # new driver is an alsa one
$in->do_pkgs->ensure_is_installed('alsa-utils', '/usr/sbin/alsactl');
rooted("service alsa start") if $::isStandalone && !$blacklisted;
rooted("/sbin/chkconfig --add alsa") if $::isStandalone;
- load($new_driver) if $::isStandalone; # service alsa is buggy
+ load($modules_conf, $new_driver) if $::isStandalone; # service alsa is buggy
} else { rooted("/sbin/chkconfig --del alsa") }
log::explanations("loading new $new_driver\n");
rooted("/sbin/chkconfig --add sound"); # just in case ...
@@ -169,7 +172,7 @@ sub do_switch {
}
sub switch {
- my ($in, $device) = @_;
+ my ($in, $modules_conf, $device) = @_;
my $driver = $device->{current_driver} || $device->{driver};
foreach (@blacklist) { $blacklisted = 1 if $driver eq $_ }
@@ -187,7 +190,7 @@ sub switch {
N("There's no known OSS/ALSA alternative driver for your sound card (%s) which currently uses \"%s\"",
$device->{description}, $driver),
[
- &get_any_driver_entry($in, $driver, $device),
+ get_any_driver_entry($in, $modules_conf, $driver, $device),
]
);
} elsif ($in->ask_from_({ title => N("Sound configuration"),
@@ -218,7 +221,7 @@ To use alsa, one can either use:
val => N("Trouble shooting"), disabled => sub {},
clicked => sub { &trouble($in) }
},
- &get_any_driver_entry($in, $driver, $device),
+ get_any_driver_entry($in, $modules_conf, $driver, $device),
]))
{
return if $new_driver eq $device->{current_driver};
@@ -226,7 +229,7 @@ To use alsa, one can either use:
$in->ask_warn(N("Warning"), N("The old \"%s\" driver is blacklisted.\n
It has been reported to oops the kernel on unloading.\n
The new \"%s\" driver'll only be used on next bootstrap.", $device->{current_driver}, $new_driver)) if $blacklisted;
- do_switch($in, $device->{current_driver}, $new_driver, $device->{sound_slot_index});
+ do_switch($in, $modules_conf, $device->{current_driver}, $new_driver, $device->{sound_slot_index});
$device->{current_driver} = $new_driver;
}
} elsif ($driver =~ /^Bad:/) {
@@ -238,7 +241,7 @@ The new \"%s\" driver'll only be used on next bootstrap.", $device->{current_dri
$in->ask_from(N("No known driver"),
N("There's no known driver for your sound card (%s)",
$device->{description}),
- [ &get_any_driver_entry($in, $driver, $device) ]);
+ [ get_any_driver_entry($in, $modules_conf, $driver, $device) ]);
} else {
$in->ask_warn(N("Unknown driver"),
N("Error: The \"%s\" driver for your sound card is unlisted",
@@ -248,7 +251,8 @@ The new \"%s\" driver'll only be used on next bootstrap.", $device->{current_dri
}
sub config {
- switch(@_);
+ my ($in, $modules_conf, $device) = @_;
+ switch($in, $modules_conf, $device);
}
@@ -278,7 +282,7 @@ initlevel 3
}
sub get_any_driver_entry {
- my ($in, $driver, $device) = @_;
+ my ($in, $modules_conf, $driver, $device) = @_;
return () if $::isInstall;
+{
val => N("Let me pick any driver"), disabled => sub {},
@@ -293,7 +297,7 @@ The current driver for your \"%s\" sound card is \"%s\" ", $device->{description
{ label => N("Driver:"), val => \$driver, list => [ category2modules("multimedia/sound") ], type => 'combo', default => $driver, sort =>1, separator => '|' },
]
)) {
- do_switch($in, $old_driver, $driver, $device->{sound_slot_index});
+ do_switch($in, $modules_conf, $old_driver, $driver, $device->{sound_slot_index});
goto end;
}
}
@@ -301,16 +305,17 @@ The current driver for your \"%s\" sound card is \"%s\" ", $device->{description
}
-sub configure_sound_slots() {
+sub configure_sound_slots {
+ my ($modules_conf) = @_;
my $altered = 0;
each_index {
- my $default_driver = modules::get_alias("sound-slot-$::i");
+ my $default_driver = $modules_conf->get_alias("sound-slot-$::i");
if (!member($default_driver, @{get_alternative($_->{driver})}, $_->{driver})) {
$altered ||= $default_driver;
- modules::set_sound_slot("sound-slot-$::i", $_->{driver});
+ $modules_conf->set_sound_slot("sound-slot-$::i", $_->{driver});
}
} detect_devices::getSoundDevices();
- modules::write_conf() if $altered && $::isStandalone;
+ $modules_conf->write if $altered && $::isStandalone;
}
diff --git a/perl-install/harddrake/v4l.pm b/perl-install/harddrake/v4l.pm
index 9d4feaa14..9b331d6ee 100644
--- a/perl-install/harddrake/v4l.pm
+++ b/perl-install/harddrake/v4l.pm
@@ -279,7 +279,7 @@ my %pll_lst =
);
sub config {
- my ($in, $driver) = @_;
+ my ($in, $modules_conf, $driver) = @_;
my $min_gbuffers = 2;
my $max_gbuffers = 32;
@@ -290,7 +290,7 @@ sub config {
my %rvs_cards_list = reverse %cards_list;
# get the existing options (if there are any)
- my $current = modules::get_options($driver);
+ my $current = $modules_conf->get_options($driver);
foreach (split(/\s+/,$current)) {
$conf{$1} = $2 if /^(gbuffers|tuner|radio|pll)=(.+)/;
@@ -326,7 +326,7 @@ If your card is misdetected, you can force the right tuner and card types here.
if ($options) {
log::l(qq([harddrake::v4l] set "$options" options for $driver));
# log::explanations("modified file /etc/modules.conf ($options)") if $::isStandalone;
- modules::set_options($driver, $options);
+ $modules_conf->set_options($driver, $options);
}
return 1;
}