summaryrefslogtreecommitdiffstats
path: root/perl-install
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
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')
-rw-r--r--perl-install/Xconfig/default.pm9
-rw-r--r--perl-install/commands.pm2
-rw-r--r--perl-install/detect_devices.pm11
-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
-rw-r--r--perl-install/install2.pm21
-rw-r--r--perl-install/install_any.pm8
-rw-r--r--perl-install/install_steps.pm10
-rw-r--r--perl-install/install_steps_auto_install.pm4
-rw-r--r--perl-install/install_steps_interactive.pm22
-rw-r--r--perl-install/modules.pm246
-rw-r--r--perl-install/modules/any_conf.pm117
-rw-r--r--perl-install/modules/interactive.pm32
-rw-r--r--perl-install/modules/modprobe_conf.pm108
-rw-r--r--perl-install/modules/modules_conf.pm40
-rw-r--r--perl-install/mouse.pm33
-rw-r--r--perl-install/network/adsl.pm6
-rw-r--r--perl-install/network/ethernet.pm27
-rw-r--r--perl-install/network/isdn.pm5
-rw-r--r--perl-install/network/netconnect.pm50
-rw-r--r--perl-install/network/network.pm6
-rw-r--r--perl-install/network/shorewall.pm5
-rw-r--r--perl-install/network/tools.pm4
-rw-r--r--perl-install/printer/detect.pm2
-rw-r--r--perl-install/printer/main.pm2
-rw-r--r--perl-install/printer/printerdrake.pm7
-rwxr-xr-xperl-install/standalone/drakconnect18
-rwxr-xr-xperl-install/standalone/drakgw5
-rwxr-xr-xperl-install/standalone/draksound11
-rwxr-xr-xperl-install/standalone/drakxtv10
-rwxr-xr-xperl-install/standalone/mousedrake10
-rwxr-xr-xperl-install/standalone/printerdrake1
-rwxr-xr-xperl-install/standalone/service_harddrake20
35 files changed, 550 insertions, 365 deletions
diff --git a/perl-install/Xconfig/default.pm b/perl-install/Xconfig/default.pm
index 9d317fc3a..75947bf11 100644
--- a/perl-install/Xconfig/default.pm
+++ b/perl-install/Xconfig/default.pm
@@ -10,16 +10,15 @@ use mouse;
sub configure {
- my ($keyboard, $mouse) = @_;
+ my ($o_keyboard, $o_mouse) = @_;
- $keyboard ||= keyboard::read();
- $mouse ||= do {
+ my $keyboard = $o_keyboard || keyboard::read();
+ my $mouse = $o_mouse || do {
my $mouse = mouse::read();
- add2hash($mouse, mouse::detect()) if !$::noauto;
+ add2hash($mouse, mouse::detect(modules::any_conf->read)) if !$::noauto;
$mouse;
};
-
my $raw_X = Xconfig::xfree->empty_config;
$raw_X->add_load_module($_) foreach qw(dbe v4l extmod type1 freetype);
diff --git a/perl-install/commands.pm b/perl-install/commands.pm
index d5d511b8b..76f648a8f 100644
--- a/perl-install/commands.pm
+++ b/perl-install/commands.pm
@@ -358,7 +358,7 @@ sub modprobe {
my $name = shift;
require modules;
modules::load_dependencies("/modules/modules.dep");
- modules::load([ $name, @_ ]);
+ modules::load_raw([ $name ], { $name => join(' ', @_) });
}
sub route {
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 5e573574d..58731e0a3 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -412,7 +412,7 @@ sub getCPUs() {
}
sub getSoundDevices() {
- (arch() =~ /ppc/ ? \&modules::load_category : \&modules::probe_category)->('multimedia/sound');
+ modules::probe_category('multimedia/sound');
}
sub isTVcard { member($_[0]{driver}, qw(bttv cx8800 saa7134 usbvision)) }
@@ -422,7 +422,7 @@ sub getTVcards() {
}
sub getSerialModem {
- my ($o_mouse) = @_;
+ my ($modules_conf, $o_mouse) = @_;
my $mouse = $o_mouse || {};
$mouse->{device} = readlink "/dev/mouse";
my $serdev = arch() =~ /ppc/ ? "macserial" : "serial";
@@ -441,14 +441,15 @@ sub getSerialModem {
my @devs = pcmcia_probe();
foreach my $modem (@modems) {
#- add an alias for macserial on PPC
- modules::set_alias('serial', $serdev) if arch() =~ /ppc/ && $modem->{device};
+ $modules_conf->set_alias('serial', $serdev) if arch() =~ /ppc/ && $modem->{device};
foreach (@devs) { $_->{type} =~ /serial/ and $modem->{device} = $_->{device} }
}
@modems;
}
-sub getModem() {
- getSerialModem({}), matching_driver('www\.linmodems\.org');
+sub getModem {
+ my ($modules_conf) = @_;
+ getSerialModem($modules_conf, {}), matching_driver('www\.linmodems\.org');
}
sub getSpeedtouch() {
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;
}
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index f1984e285..bc25dcf5f 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -107,7 +107,7 @@ sub selectMouse {
installStepsCall($o, $auto, 'selectMouse', !$first_time || $clicked);
- addToBeDone { mouse::write($o, $o->{mouse}) if !$o->{isUpgrade} || $clicked } 'installPackages';
+ addToBeDone { mouse::write($o->do_pkgs, $o->{mouse}) if !$o->{isUpgrade} || $clicked } 'installPackages';
}
#------------------------------------------------------------------------------
@@ -198,7 +198,7 @@ sub formatPartitions {
#- when usb-storage is in scsi_hostadapter,
#- hotplug + scsimon do not load sd_mod/sr_mod when needed
#- (eg: when plugging a usb key)
- modules::remove_probeall('scsi_hostadapter', 'usb-storage');
+ $o->{modules_conf}->remove_probeall('scsi_hostadapter', 'usb-storage');
}
require raid;
@@ -290,7 +290,7 @@ sub setupBootloader {
my ($_clicked, $ent_number, $auto) = @_;
return if $::uml_install;
- modules::write_conf();
+ $o->{modules_conf}->write;
installStepsCall($o, $auto, 'setupBootloaderBefore') if $ent_number == 1;
installStepsCall($o, $auto, 'setupBootloader', $ent_number);
@@ -303,7 +303,7 @@ sub configureX {
#- done here and also at the end of install2.pm, just in case...
install_any::write_fstab($o);
- modules::write_conf();
+ $o->{modules_conf}->write;
require pkgs;
installStepsCall($o, $auto, 'configureX') if !$::testing && eval { pkgs::packageByName($o->{packages}, 'xorg-x11')->flag_installed } && !$o->{X}{disabled};
@@ -457,8 +457,9 @@ sub main {
eval { spawnShell() };
modules::load_dependencies(($::testing ? ".." : "") . "/modules/modules.dep");
- modules::mergein_conf_raw('/tmp/modules.conf');
- modules::read_already_loaded();
+ require modules::modules_conf;
+ $o->{modules_conf} = modules::modules_conf->read('/tmp/modules.conf');
+ modules::read_already_loaded($o->{modules_conf});
#- done before auto_install is called to allow the -IP feature on auto_install file name
if (-e '/tmp/network') {
@@ -527,7 +528,7 @@ sub main {
require "install_steps_$o->{interactive}.pm" if $o->{interactive};
#- needed before accessing floppy (in case of usb floppy)
- modules::load_category('bus/usb');
+ modules::load_category($o->{modules_conf}, 'bus/usb');
#- oem patch should be read before to still allow patch or defcfg.
eval { $o = $::o = install_any::loadO($o, "Mandrake/base/patch-oem.pl"); log::l("successfully read oem patch") };
@@ -541,7 +542,7 @@ sub main {
eval { modules::load("af_packet") };
require harddrake::sound;
- harddrake::sound::configure_sound_slots();
+ harddrake::sound::configure_sound_slots($o->{modules_conf});
#- need to be after oo-izing $o
if ($o->{brltty}) {
@@ -573,7 +574,7 @@ sub main {
if ($o->{mouse}) {
mouse::load_modules($o->{mouse});
} else {
- eval { $o->{mouse} = mouse::detect() } if !$o->{nomouseprobe};
+ eval { $o->{mouse} = mouse::detect($o->{modules_conf}) } if !$o->{nomouseprobe};
}
}
@@ -663,7 +664,7 @@ sub main {
install_any::log_sizes($o);
install_any::remove_advertising($o);
install_any::write_fstab($o);
- modules::write_conf();
+ $o->{modules_conf}->write;
detect_devices::install_addons($o->{prefix});
#- save recovery file if needed (ie disk style install).
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index e768c1b06..5fd0b8c6f 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -475,7 +475,7 @@ sub setDefaultPackages {
push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock};
push @{$o->{default_packages}}, "raidtools" if !is_empty_array_ref($o->{all_hds}{raids});
push @{$o->{default_packages}}, "lvm2" if !is_empty_array_ref($o->{all_hds}{lvms});
- push @{$o->{default_packages}}, "alsa", "alsa-utils" if any { modules::get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4;
+ push @{$o->{default_packages}}, "alsa", "alsa-utils" if any { $o->{modules_conf}->get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4;
push @{$o->{default_packages}}, "grub" if isLoopback(fsedit::get_root($o->{fstab}));
push @{$o->{default_packages}}, uniq(grep { $_ } map { fsedit::package_needed_for_partition_type($_) } @{$o->{fstab}});
@@ -503,7 +503,7 @@ sub setDefaultPackages {
$o->{compssUsersChoice}{UTF8} = $o->{locale}{utf8};
$o->{compssUsersChoice}{BURNER} = 1 if detect_devices::burners();
$o->{compssUsersChoice}{DVD} = 1 if detect_devices::dvdroms();
- $o->{compssUsersChoice}{USB} = 1 if modules::get_probeall("usb-interface");
+ $o->{compssUsersChoice}{USB} = 1 if $o->{modules_conf}->get_probeall("usb-interface");
$o->{compssUsersChoice}{PCMCIA} = 1 if detect_devices::hasPCMCIA();
$o->{compssUsersChoice}{HIGH_SECURITY} = 1 if $o->{security} > 3;
$o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && availableRamMB() > 800 && arch() !~ /ia64|x86_64/;
@@ -1265,7 +1265,7 @@ sub remove_bigseldom_used() {
#- pcmcia various
#-###############################################################################
sub configure_pcmcia {
- my ($pcic) = @_;
+ my ($modules_conf, $pcic) = @_;
#- try to setup pcmcia if cardmgr is not running.
my $running if 0;
@@ -1283,7 +1283,7 @@ sub configure_pcmcia {
sleep(3);
#- make sure to be aware of loaded module by cardmgr.
- modules::read_already_loaded();
+ modules::read_already_loaded($modules_conf);
}
sub write_pcmcia {
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 01fd2f333..625e1d941 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -153,10 +153,10 @@ sub acceptLicense {}
#------------------------------------------------------------------------------
sub setupSCSI {
my ($o) = @_;
- install_any::configure_pcmcia($o->{pcmcia}) if $o->{pcmcia};
+ install_any::configure_pcmcia($o->{modules_conf}, $o->{pcmcia}) if $o->{pcmcia};
modules::load(modules::category2modules('disk/cdrom'));
- modules::load_category('bus/firewire');
- modules::load_category('disk/scsi|hardware_raid|firewire');
+ modules::load_category($o->{modules_conf}, 'bus/firewire');
+ modules::load_category($o->{modules_conf}, 'disk/scsi|hardware_raid|firewire');
install_any::getHds($o);
}
@@ -955,7 +955,7 @@ sub upNetwork {
symlinkf("$o->{prefix}/etc/$_", "/etc/$_") foreach qw(resolv.conf protocols services);
}
member($o->{method}, qw(ftp http nfs)) and return 1;
- modules::write_conf();
+ $o->{modules_conf}->write;
if (hasNetwork($o)) {
if ($o->{netcnx}{type} =~ /adsl|lan|cable/) {
log::l("starting network ($o->{netcnx}{type})");
@@ -981,7 +981,7 @@ sub downNetwork {
my ($o, $costlyOnly) = @_;
$o->{method} eq "ftp" || $o->{method} eq "http" || $o->{method} eq "nfs" and return 1;
- modules::write_conf();
+ $o->{modules_conf}->write;
if (hasNetwork($o)) {
if (!$costlyOnly) {
require network::netconnect;
diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm
index 465ac10c9..2ef2e4632 100644
--- a/perl-install/install_steps_auto_install.pm
+++ b/perl-install/install_steps_auto_install.pm
@@ -38,9 +38,9 @@ sub new {
}
sub configureNetwork {
- my ($_o) = @_;
+ my ($o) = @_;
log::l("install_steps_auto_install::configureNetwork");
- modules::load_category('network/main|gigabit|usb');
+ modules::load_category($o->{modules_conf}, 'network/main|gigabit|usb');
goto &install_steps::configureNetwork;
}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 6e2e61270..8be4fa5fe 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -206,7 +206,7 @@ sub selectMouse {
}
if ($o->{mouse}{device} eq "usbmouse") {
- modules::interactive::load_category($o, 'bus/usb', 1, 1);
+ modules::interactive::load_category($o, $o->{modules_conf}, 'bus/usb', 1, 1);
eval {
devices::make("usbmouse");
modules::load(qw(hid mousedev usbmouse));
@@ -223,7 +223,7 @@ sub setupSCSI {
if (!$::noauto && arch() =~ /i.86/) {
if ($o->{pcmcia} ||= !$::testing && c::pcmcia_probe()) {
my $w = $o->wait_message(N("PCMCIA"), N("Configuring PCMCIA cards..."));
- my $results = install_any::configure_pcmcia($o->{pcmcia});
+ my $results = install_any::configure_pcmcia($o->{modules_conf}, $o->{pcmcia});
undef $w;
$results and $o->ask_warn('', $results);
}
@@ -232,11 +232,11 @@ sub setupSCSI {
my $_w = $o->wait_message(N("IDE"), N("Configuring IDE"));
modules::load(modules::category2modules('disk/cdrom'));
}
- modules::interactive::load_category($o, 'bus/firewire', 1);
+ modules::interactive::load_category($o, $o->{modules_conf}, 'bus/firewire', 1);
my $have_non_scsi = detect_devices::hds(); #- at_least_one scsi device if we have no disks
- modules::interactive::load_category($o, 'disk/scsi|hardware_raid|firewire', 1, !$have_non_scsi);
- modules::interactive::load_category($o, 'disk/scsi|hardware_raid|firewire') if !detect_devices::hds(); #- we really want a disk!
+ modules::interactive::load_category($o, $o->{modules_conf}, 'disk/scsi|hardware_raid|firewire', 1, !$have_non_scsi);
+ modules::interactive::load_category($o, $o->{modules_conf}, 'disk/scsi|hardware_raid|firewire') if !detect_devices::hds(); #- we really want a disk!
install_interactive::tellAboutProprietaryModules($o);
@@ -692,7 +692,7 @@ sub installPackages {
my ($method, $medium) = @_;
#- if not using a cdrom medium or an iso image, always abort.
- return unless install_any::method_allows_medium_change($method) && !$::oem;
+ return if !install_any::method_allows_medium_change($method) || $::oem;
my $name = pkgs::mediumDescr($o->{packages}, $medium);
local $| = 1; print "\a";
@@ -743,7 +743,7 @@ sub updateModulesFromFloppy {
sub configureNetwork {
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';
$o->SUPER::configureNetwork;
}
@@ -930,7 +930,7 @@ sub summary {
group => N("System"),
label => N("Mouse"),
val => sub { translate($o->{mouse}{type}) . ' ' . translate($o->{mouse}{name}) },
- clicked => sub { $o->selectMouse(1); mouse::write($o, $o->{mouse}) },
+ clicked => sub { $o->selectMouse(1); mouse::write($o->do_pkgs, $o->{mouse}) },
};
push @l, {
@@ -968,7 +968,7 @@ sub summary {
},
clicked => sub {
require harddrake::sound;
- harddrake::sound::config($o, $device);
+ harddrake::sound::config($o, $o->{modules_conf}, $device);
},
};
$sound_index++;
@@ -999,7 +999,7 @@ sub summary {
val => sub { $tv->{description} },
clicked => sub {
require harddrake::v4l;
- harddrake::v4l::config($o, $tv->{driver});
+ harddrake::v4l::config($o, $o->{modules_conf}, $tv->{driver});
}
};
}
@@ -1018,7 +1018,7 @@ sub summary {
clicked => sub {
local $::expert = $::expert;
require network::netconnect;
- network::netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o, $o->{netc}, $o->{mouse}, $o->{intf}, 0, 1);
+ network::netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o, $o->{modules_conf}, $o->{netc}, $o->{mouse}, $o->{intf}, 0, 1);
#- in case netcnx type is not updated.
require network::network;
network::network::probe_netcnx_type($o->{prefix}, $o->{netc}, $o->{intf}, $o->{netcnx});
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 91b05fbbf..7ca4b6ba4 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -1,15 +1,13 @@
package modules; # $Id$
use strict;
-use vars qw(%conf);
use common;
use detect_devices;
use run_program;
use log;
use list_modules;
-
-%conf = ();
+use modules::any_conf;
sub modules_descriptions() {
my $f = '/lib/modules/' . c::kernel_version() . '/modules.description';
@@ -51,55 +49,54 @@ sub mapping_26_24 {
#- module loading
#-###############################################################################
# handles dependencies
-# eg: load('vfat', 'reiserfs', [ ne2k => 'io=0xXXX', 'dma=5' ])
-sub load {
- #- keeping the order of modules
- my %options;
- my @l = map {
- my ($name, @options) = ref($_) ? @$_ : $_;
- $options{$name} = \@options;
- dependencies_closure(mapping_24_26($name));
- } @_;
-
- @l = difference2([ uniq(@l) ], [ map { my $s = $_; $s =~ s/_/-/g; $s, $_ } loaded_modules() ]) or return;
-
- my $network_module = do {
- my ($network_modules, $other) = partition { module2category($_) =~ m,network/(main|gigabit|usb|wireless), } @l;
- if (@$network_modules > 1) {
- # do it one by one
- load($_) foreach @$network_modules;
- load(@$other);
- return;
- }
- $network_modules->[0];
- };
- my @network_devices = $network_module ? detect_devices::getNet() : ();
-
+sub load_raw {
+ my ($l, $h_options) = @_;
if ($::testing) {
- log::l("i would load module $_ (" . join(" ", @{$options{$_}}) . ")") foreach @l;
+ log::l("i would load module $_ ($h_options->{$_})") foreach @$l;
} elsif ($::isStandalone || $::move) {
- run_program::run('/sbin/modprobe', $_, @{$options{$_}})
+ run_program::run('/sbin/modprobe', $_, split(' ', $h_options->{$_}))
or !run_program::run('/sbin/modprobe', '-n', $_) #- ignore missing modules
- or die "insmod'ing module $_ failed" foreach @l;
+ or die "insmod'ing module $_ failed" foreach @$l;
} else {
- load_raw_install(\@l, \%options);
+ load_raw_install($l, $h_options);
+ }
+ sleep 2 if any { /^(usb-storage|mousedev|printer)$/ } @$l;
+}
+sub load {
+ my (@l) = @_;
+ @l = map {
+ dependencies_closure(mapping_24_26($_));
+ } @l;
+
+ @l = remove_loaded_modules(@l) or return;
+
+ load_raw(\@l, {});
+}
+
+# eg: load_and_configure($modules_conf, 'vfat', 'reiserfs', [ ne2k => 'io=0xXXX', 'dma=5' ])
+sub load_and_configure {
+ my ($conf, $module, $o_options) = @_;
+
+ my $category = module2category($module) || '';
+ my $network_devices = $category =~ m!network/(main|gigabit|usb|wireless)! && [ detect_devices::getNet() ];
+
+ my @l = remove_loaded_modules(dependencies_closure(mapping_24_26($module))) or return;
+ load_raw(\@l, { $module => $o_options });
+
+ if ($network_devices) {
+ $conf->set_alias($_, $module) foreach difference2([ detect_devices::getNet() ], $network_devices);
}
- sleep 2 if any { /^(usb-storage|mousedev|printer)$/ } @l;
- if ($network_module) {
- set_alias($_, $network_module) foreach difference2([ detect_devices::getNet() ], \@network_devices);
+ if (c::kernel_version() =~ /^\Q2.6/ && member($module, 'imm', 'ppa')
+ && ! -d "/proc/sys/dev/parport/parport0/devices/$module") {
+ log::l("$module loaded but is not useful, removing");
+ unload($module);
+ return;
}
- @l = grep {
- if (c::kernel_version() =~ /^\Q2.6/ && member($_, 'imm', 'ppa')
- && ! -d "/proc/sys/dev/parport/parport0/devices/$_") {
- log::l("$_ loaded but is not useful, removing");
- unload($_);
- 0;
- } else { 1 }
- } @l;
+ $conf->set_options($module, $o_options) if $o_options;
- when_load($_, @{$options{$_}}) foreach @l;
+ when_load($conf, $module);
}
sub unload {
@@ -111,11 +108,7 @@ sub unload {
}
sub load_category {
- my ($category, $o_wait_message) = @_;
-
- #- probe_category returns the PCMCIA cards. It doesn't know they are already
- #- loaded, so:
- read_already_loaded();
+ my ($conf, $category, $o_wait_message) = @_;
my @try_modules = (
if_($category =~ /scsi/,
@@ -130,7 +123,7 @@ sub load_category {
);
grep {
$o_wait_message->($_->{description}, $_->{driver}) if $o_wait_message;
- eval { load([ $_->{driver}, if_($_->{options}, $_->{options}) ]) };
+ eval { load_and_configure($conf, $_->{driver}, $_->{options}) };
$_->{error} = $@;
$_->{try} = 1 if member($_->{driver}, 'hptraid', 'ohci1394'); #- don't warn when this fails
@@ -166,87 +159,6 @@ sub probe_category {
#-###############################################################################
#- modules.conf functions
#-###############################################################################
-sub get_alias {
- my ($alias) = @_;
- $conf{$alias}{alias};
-}
-sub get_probeall {
- my ($alias) = @_;
- $conf{$alias}{probeall};
-}
-sub get_options {
- my ($name) = @_;
- $conf{$name}{options};
-}
-sub set_options {
- my ($name, $new_option) = @_;
- log::l(qq(set option "$new_option" for module "$name"));
- $conf{$name}{options} = $new_option;
-}
-sub get_parameters {
- map { if_(/(.*)=(.*)/, $1 => $2) } split(' ', get_options($_[0]));
-}
-sub set_alias {
- my ($alias, $module) = @_;
- $module =~ /ignore/ and return;
- /\Q$alias/ && $conf{$_}{alias} && $conf{$_}{alias} eq $module and return $_ foreach keys %conf;
- log::l("adding alias $alias to $module");
- $conf{$alias}{alias} = $module;
- $alias;
-}
-sub add_probeall {
- my ($alias, $module) = @_;
-
- my $l = $conf{$alias}{probeall} ||= [];
- @$l = uniq(@$l, $module);
- log::l("setting probeall $alias to @$l");
-}
-sub remove_probeall {
- my ($alias, $module) = @_;
-
- my $l = $conf{$alias}{probeall} ||= [];
- @$l = grep { $_ ne $module } @$l;
- log::l("setting probeall $alias to @$l");
-}
-
-sub remove_alias {
- my ($name) = @_;
- log::l(qq(removing alias "$name"));
- remove_alias_regexp("^$name\$");
-}
-
-sub remove_alias_regexp {
- my ($aliased) = @_;
- log::l(qq(removing all aliases that match "$aliased"));
- foreach (keys %conf) {
- delete $conf{$_}{alias} if /$aliased/;
- }
-}
-
-sub remove_alias_regexp_byname {
- my ($name) = @_;
- log::l(qq(removing all aliases which names match "$name"));
- foreach (keys %conf) {
- delete $conf{$_} if /$name/;
- }
-}
-
-sub remove_module {
- my ($name) = @_;
- remove_alias($name);
- log::l("removing module $name");
- delete $conf{$name};
- 0;
-}
-
-sub set_sound_slot {
- my ($alias, $module) = @_;
- if (my $old = $conf{$alias}{alias}) {
- $conf{$old} and delete $conf{$old}{above};
- }
- set_alias($alias, $module);
- $conf{$module}{above} = 'snd-pcm-oss' if $module =~ /^snd-/;
-}
sub read_conf {
my ($file) = @_;
@@ -262,7 +174,9 @@ sub read_conf {
my ($type, $module, $val) = split(/\s+/, chomp_($_), 3) or next;
$val =~ s/\s+$//;
- $val = [ split ' ', $val ] if $type eq 'probeall';
+ if ($type eq 'probeall') {
+ $val = [ split ' ', $val ];
+ }
$c{$module}{$type} = $val;
}
@@ -286,22 +200,8 @@ sub read_conf {
\%c;
}
-sub mergein_conf_raw {
- my ($file) = @_;
- my $modconfref = read_conf($file);
- while (my ($key, $value) = each %$modconfref) {
- $conf{$key}{alias} ||= $value->{alias};
- $conf{$key}{above} ||= $value->{above};
- $conf{$key}{options} = $value->{options} if $value->{options};
- push @{$conf{$key}{probeall} ||= []}, deref($value->{probeall}) if $value->{probeall};
- }
-}
-sub mergein_conf() {
- my $file = "$::prefix/etc/modules.conf";
- mergein_conf_raw($file) if -r $file;
-}
-
-sub write_conf() {
+sub write_conf {
+ my ($conf) = @_;
my $file = "$::prefix/etc/modules.conf";
rename "$::prefix/etc/conf.modules", $file; #- make the switch to new name if needed
@@ -314,12 +214,12 @@ sub write_conf() {
} elsif ($type eq 'alias' && $module =~ /scsi_hostadapter|usb-interface/) {
#- remove old aliases which are replaced by probeall
$_ = '';
- } elsif ($type eq 'above' && !defined $conf{$module}{above}) {
+ } elsif ($type eq 'above' && !defined $conf->{$module}{above}) { #TODO
$_ = '';
- } elsif ($type eq 'alias' && !defined $conf{$module}{alias}) {
+ } elsif ($type eq 'alias' && !defined $conf->{$module}{alias}) { #TODO
$_ = '';
- } elsif ($conf{$module}{$type} && $conf{$module}{$type} ne $val) {
- my $v = join(' ', uniq(deref($conf{$module}{$type})));
+ } elsif ($conf->{$module}{$type} && $conf->{$module}{$type} ne $val) { #TODO
+ my $v = join(' ', uniq(deref($conf->{$module}{$type}))); #TODO
$_ = "$type $module $v\n";
}
} $file;
@@ -327,7 +227,7 @@ sub write_conf() {
my $written = read_conf($file);
open(my $F, ">> $file") or die("cannot write module config file $file: $!\n");
- while (my ($mod, $h) = each %conf) {
+ while (my ($mod, $h) = each %$conf) { #TODO
while (my ($type, $v) = each %$h) {
my $v2 = join(' ', uniq(deref($v)));
print $F "$type $mod $v2\n"
@@ -337,13 +237,15 @@ sub write_conf() {
#- use module-init-tools script for the moment
run_program::rooted($::prefix, "/sbin/generate-modprobe.conf", ">", "/etc/modprobe.conf") if -e "$::prefix/etc/modprobe.conf";
- write_preload_conf();
+ write_preload_conf($conf);
}
-sub write_preload_conf() {
+sub write_preload_conf {
+ my ($conf) = @_;
my @l;
- push @l, 'scsi_hostadapter' if !is_empty_array_ref($conf{scsi_hostadapter}{probeall});
- push @l, grep { detect_devices::matching_driver("^$_\$") } qw(bttv cx8800 saa7134);
+ push @l, 'scsi_hostadapter' if !is_empty_array_ref($conf->get_probeall('scsi_hostadapter'));
+ push @l, intersection([ qw(bttv cx8800 saa7134) ],
+ [ map { $_->{driver} } detect_devices::probeall() ]);
my @l_26 = @l;
if (my ($agp) = probe_category('various/agpgart')) {
push @l_26, $agp->{driver};
@@ -370,8 +272,14 @@ sub append_to_modules_loaded_at_startup {
sub loaded_modules() {
map { /(\S+)/ } cat_("/proc/modules");
}
-sub read_already_loaded() {
- when_load($_) foreach reverse loaded_modules();
+sub remove_loaded_modules {
+ my (@l) = @_;
+ difference2([ uniq(@l) ], [ map { my $s = $_; $s =~ s/_/-/g; $s, $_ } loaded_modules() ])
+}
+
+sub read_already_loaded {
+ my ($conf) = @_;
+ when_load($conf, $_) foreach reverse loaded_modules();
}
my $module_extension = c::kernel_version() =~ /^\Q2.4/ ? 'o' : 'ko';
@@ -382,29 +290,27 @@ sub name2file {
}
sub when_load {
- my ($name, @options) = @_;
+ my ($conf, $name) = @_;
$name = mapping_26_24($name); #- need to stay with 2.4 names, modutils will allow booting 2.4 and 2.6
- $conf{$name}{options} = join " ", @options if @options;
-
if (my $category = module2category($name)) {
- when_load_category($name, $category);
+ when_load_category($conf, $name, $category);
}
- if (my $above = $conf{$name}{above}) {
+ if (my $above = $conf->get_above($name)) {
load($above); #- eg: for snd-pcm-oss set by set_sound_slot()
}
}
sub when_load_category {
- my ($name, $category) = @_;
+ my ($conf, $name, $category) = @_;
if ($category =~ m,disk/(scsi|hardware_raid|usb|firewire),) {
- add_probeall('scsi_hostadapter', $name);
+ $conf->add_probeall('scsi_hostadapter', $name);
eval { load('sd_mod') };
} elsif ($category eq 'bus/usb') {
- add_probeall('usb-interface', $name);
+ $conf->add_probeall('usb-interface', $name);
-f '/proc/bus/usb/devices' or eval {
require fs; fs::mount('/proc/bus/usb', '/proc/bus/usb', 'usbdevfs');
#- ensure keyboard is working, the kernel must do the job the BIOS was doing
@@ -412,11 +318,11 @@ sub when_load_category {
load("usbkbd", "keybdev") if detect_devices::usbKeyboards();
}
} elsif ($category eq 'bus/firewire') {
- set_alias('ieee1394-controller', $name);
+ $conf->set_alias('ieee1394-controller', $name);
} elsif ($category =~ /sound/) {
- my $sound_alias = find { /^sound-slot-[0-9]+$/ && $conf{$_}{alias} eq $name } keys %conf;
+ my $sound_alias = find { /^sound-slot-[0-9]+$/ && $conf->get_alias($_) eq $name } $conf->modules;
$sound_alias ||= 'sound-slot-0';
- set_sound_slot($sound_alias, $name);
+ $conf->set_sound_slot($sound_alias, $name);
}
}
@@ -451,7 +357,7 @@ sub load_raw_install {
my $m = '/tmp/' . name2file($_);
if (-e $m) {
my $stdout;
- my $rc = run_program::run(["/usr/bin/insmod_", "insmod"], '2>', \$stdout, $m, @{$options->{$_}});
+ my $rc = run_program::run(["/usr/bin/insmod_", "insmod"], '2>', \$stdout, $m, split(' ', $options->{$_}));
log::l(chomp_($stdout)) if $stdout;
if ($rc) {
unlink $m;
diff --git a/perl-install/modules/any_conf.pm b/perl-install/modules/any_conf.pm
new file mode 100644
index 000000000..10d21e712
--- /dev/null
+++ b/perl-install/modules/any_conf.pm
@@ -0,0 +1,117 @@
+package modules::any_conf;
+
+use log;
+use common;
+
+
+sub vnew {
+ if (0 && c::kernel_version() =~ /^\Q2.6/) {
+ require modules::modprobe_conf;
+ modules::modprobe_conf->new;
+ } else {
+ require modules::modules_conf;
+ modules::modules_conf->new;
+ }
+}
+
+
+sub new {
+ my ($type) = @_;
+ bless {}, ref($type) || $type;
+}
+
+sub read {
+ my ($_type, $o_file) = @_;
+
+ my $conf = vnew();
+ my $raw_conf = modules::read_conf($o_file || "$::prefix/etc/modules.conf");
+ foreach my $key (keys %$raw_conf) {
+ my $raw = $raw_conf->{$key};
+ my $keep = $conf->{$key} = {};
+ $keep->{alias} ||= $raw->{alias};
+ $keep->{above} ||= $raw->{above};
+ $keep->{options} = $raw->{options} if $raw->{options};
+ push @{$keep->{probeall} ||= []}, deref($raw->{probeall}) if $raw->{probeall};
+ }
+ $conf;
+}
+
+sub write {
+ my ($conf) = @_;
+ modules::write_conf($conf);
+}
+
+sub modules {
+ my ($conf) = @_;
+ keys %$conf;
+}
+
+sub get_alias {
+ my ($conf, $alias) = @_;
+ $conf->{$alias}{alias};
+}
+sub get_options {
+ my ($conf, $name) = @_;
+ $conf->{$name}{options};
+}
+sub set_options {
+ my ($conf, $name, $new_option) = @_;
+ log::l(qq(set option "$new_option" for module "$name"));
+ $conf->{$name}{options} = $new_option;
+}
+sub get_parameters {
+ my ($conf, $name) = @_;
+ map { if_(/(.*)=(.*)/, $1 => $2) } split(' ', $conf->get_options($name));
+}
+
+
+sub set_alias {
+ my ($conf, $alias, $module) = @_;
+ $module =~ /ignore/ and return;
+ /\Q$alias/ && $conf->{$_}{alias} && $conf->{$_}{alias} eq $module and return $_ foreach keys %$conf;
+ log::l("adding alias $alias to $module");
+ $conf->{$alias}{alias} = $module;
+ $alias;
+}
+
+
+sub remove_alias {
+ my ($conf, $name) = @_;
+ log::l(qq(removing alias "$name"));
+ $conf->remove_alias_regexp("^$name\$");
+}
+
+sub remove_alias_regexp {
+ my ($conf, $aliased) = @_;
+ log::l(qq(removing all aliases that match "$aliased"));
+ foreach (keys %$conf) {
+ delete $conf->{$_}{alias} if /$aliased/;
+ }
+}
+
+sub remove_alias_regexp_byname {
+ my ($conf, $name) = @_;
+ log::l(qq(removing all aliases which names match "$name"));
+ foreach (keys %$conf) {
+ delete $conf->{$_} if /$name/;
+ }
+}
+
+sub remove_module {
+ my ($conf, $name) = @_;
+ $conf->remove_alias($name);
+ log::l("removing module $name");
+ delete $conf->{$name};
+ 0;
+}
+
+sub set_sound_slot {
+ my ($conf, $alias, $module) = @_;
+ if (my $old = $conf->get_alias($alias)) {
+ $conf->remove_above($old);
+ }
+ $conf->set_alias($alias, $module);
+ $conf->set_above($module, 'snd-pcm-oss') if $module =~ /^snd-/;
+}
+
+1;
diff --git a/perl-install/modules/interactive.pm b/perl-install/modules/interactive.pm
index 2faf84a0c..a05f0a39e 100644
--- a/perl-install/modules/interactive.pm
+++ b/perl-install/modules/interactive.pm
@@ -6,8 +6,8 @@ use common;
sub config_window {
my ($in, $data) = @_;
require modules;
- modules::mergein_conf();
- my %conf = modules::get_parameters($data->{driver});
+ my $modules_conf = modules::any_conf->read;
+ my %conf = $modules_conf->get_parameters($data->{driver});
require modules::parameters;
my @l;
foreach (modules::parameters::parameters($data->{driver})) {
@@ -22,20 +22,20 @@ sub config_window {
if ($in->ask_from(N("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($data->{driver}, $options);
- modules::write_conf();
- }
+ $modules_conf->set_options($data->{driver}, $options);
+ $modules_conf->write;
+ }
}
}
sub load_category {
- my ($in, $category, $b_auto, $b_at_least_one) = @_;
+ my ($in, $modules_conf, $category, $b_auto, $b_at_least_one) = @_;
my @l;
{
my $w;
my $wait_message = sub { undef $w; $w = wait_load_module($in, $category, @_) };
- @l = modules::load_category($category, $wait_message);
+ @l = modules::load_category($modules_conf, $category, $wait_message);
undef $w; #- help perl_checker
}
if (my @err = grep { $_ } map { $_->{error} } @l) {
@@ -47,20 +47,20 @@ sub load_category {
@l = map { $_->{description} } @l;
if ($b_at_least_one && !@l) {
- @l = load_category__prompt($in, $category) or return;
+ @l = load_category__prompt($in, $modules_conf, $category) or return;
}
- load_category__prompt_for_more($in, $category, @l);
+ load_category__prompt_for_more($in, $modules_conf, $category, @l);
}
sub load_category__prompt_for_more {
- my ($in, $category, @l) = @_;
+ my ($in, $modules_conf, $category, @l) = @_;
(my $msg_type = $category) =~ s/\|.*//;
while (1) {
my $msg = @l ?
- [ N("Found %s %s interfaces", join(", ", map { qq("$_") } @l)),
+ [ N("Found %s interfaces", join(", ", map { qq("$_") } @l)),
N("Do you have another one?") ] :
N("Do you have any %s interfaces?", $msg_type);
@@ -71,7 +71,7 @@ sub load_category__prompt_for_more {
[ { list => [ N_("Yes"), N_("No"), N_("See hardware info") ], val => \$r, type => 'list', format => \&translate } ]);
if ($r eq "No") { return @l }
if ($r eq "Yes") {
- push @l, load_category__prompt($in, $category) || next;
+ push @l, load_category__prompt($in, $modules_conf, $category) || next;
} else {
$in->ask_warn('', join("\n", detect_devices::stringlist()));
}
@@ -98,18 +98,18 @@ sub load_module__ask_options {
N("You may now provide options to module %s.\nNote that any address should be entered with the prefix 0x like '0x123'", $module_descr),
[ map { { label => $_->[0] . ($_->[1] ? " ($_->[1])" : ''), help => $_->[2], val => \$_->[3] } } @parameters ],
) or return;
- [ map { if_($_->[3], "$_->[0]=$_->[3]") } @parameters ];
+ join(' ', map { if_($_->[3], "$_->[0]=$_->[3]") } @parameters);
} else {
my $s = $in->ask_from_entry('',
N("You may now provide options to module %s.
Options are in format ``name=value name2=value2 ...''.
For instance, ``io=0x300 irq=7''", $module_descr), N("Module options:")) or return;
- [ split ' ', $s ];
+ $s;
}
}
sub load_category__prompt {
- my ($in, $category) = @_;
+ my ($in, $modules_conf, $category) = @_;
(my $msg_type = $category) =~ s/\|.*//;
my %available_modules = map_each { $::a => $::b ? "$::a ($::b)" : $::a } modules::category2modules_and_description($category);
@@ -135,7 +135,7 @@ not cause any damage.", $module_descr)), [ N_("Autoprobe"), N_("Specify options"
eval {
my $_w = wait_load_module($in, $category, $module_descr, $module);
log::l("user asked for loading module $module (type $category, desc $module_descr)");
- modules::load([ $module, @$options ]);
+ modules::load_and_configure($modules_conf, $module, $options);
};
return $module_descr if !$@;
diff --git a/perl-install/modules/modprobe_conf.pm b/perl-install/modules/modprobe_conf.pm
new file mode 100644
index 000000000..8b1e8305f
--- /dev/null
+++ b/perl-install/modules/modprobe_conf.pm
@@ -0,0 +1,108 @@
+package modules::modprobe_conf;
+
+use log;
+use common;
+
+our @ISA = qw(modules::any_conf);
+
+
+sub get_above {
+ my ($conf, $name) = @_;
+ after_modules($name, $conf->{$name}{install});
+}
+sub set_above {
+ my ($conf, $name, $modules) = @_;
+ #TODO
+}
+
+sub get_probeall {
+ my ($conf, $alias) = @_;
+ #TODO
+}
+sub add_probeall {
+ my ($conf, $alias, $module) = @_;
+
+ #TODO
+ my $l = $conf->{$alias}{probeall} ||= [];
+ @$l = uniq(@$l, $module);
+ log::l("setting probeall $alias to @$l");
+}
+sub remove_probeall {
+ my ($conf, $alias, $module) = @_;
+
+ #TODO
+ my $l = $conf->{$alias}{probeall} ||= [];
+ @$l = grep { $_ ne $module } @$l;
+ log::l("setting probeall $alias to @$l");
+}
+
+
+
+################################################################################
+sub remove_braces {
+ my ($s) = @_;
+ $s =~ s/^\s*\{\s*(.*)\s*;\s*\}\s*$/$1/;
+ $s;
+}
+
+sub non_virtual {
+ my ($module, $s) = @_;
+ my ($before, $options, $after) =
+ $s =~ m!^(?:(.*);)?
+ \s*(?:/sbin/)?modprobe\s+(-\S+\s+)*\Q$module\E
+ \s*(?:&&\s*(.*))?$!x
+ or return;
+ $options =~ /--ignore-(install|remove)\b/ or return;
+
+ ($before, $after) = map { remove_braces($_ || '') } $before, $after;
+ $after =~ s!\s*;\s*/bin/true$!!;
+
+ $before, $after;
+}
+
+sub after_modules {
+ my ($module, $s) = @_;
+ my (undef, $after) = non_virtual($module, $s) or return;
+
+}
+
+sub probeall {
+ my ($module, $s) = @_;
+
+ non_virtual($module, $s) and return;
+ if ($s =~ /[{&|]/) {
+ log::l("weird install line in modprobe.conf for $module: $s");
+ return;
+ }
+ $s ne '/bin/true' or return; #- we have "alias $module off" here
+
+ $s =~ s!\s*;\s*/bin/true$!!;
+
+ my @l = split(/\s*;\s*/, $s);
+
+ [ map {
+ if (m!^(?:/sbin/)?modprobe\s+(\S+)$!) {
+ $1
+ } else {
+ log::l("weird probeall string $_ (from install $module $s)");
+ ();
+ }
+ } @l ];
+}
+
+sub parse {
+ my ($type, $module, $s) = @_;
+
+ member($type, 'install', 'remove') or return;
+
+ if (my ($before, $after) = non_virtual($module, $s)) {
+ [
+ if_($after, [ "post-$type", $after ]),
+ if_($before, [ "pre-$type", $before ]),
+ ];
+ } elsif (my $l = probeall($module, $s)) {
+ [ [ 'probeall', @$l ] ];
+ }
+}
+
+1;
diff --git a/perl-install/modules/modules_conf.pm b/perl-install/modules/modules_conf.pm
new file mode 100644
index 000000000..2a720fc70
--- /dev/null
+++ b/perl-install/modules/modules_conf.pm
@@ -0,0 +1,40 @@
+package modules::modules_conf;
+
+use log;
+use common;
+
+our @ISA = qw(modules::any_conf);
+
+sub get_above {
+ my ($conf, $name) = @_;
+ $conf->{$name} && $conf->{$name}{above};
+}
+sub set_above {
+ my ($conf, $name, $modules) = @_;
+ $conf->{$name}{above} = $modules;
+}
+sub remove_above {
+ my ($conf, $name) = @_;
+ delete $conf->{$name}{above};
+}
+
+sub get_probeall {
+ my ($conf, $alias) = @_;
+ $conf->{$alias}{probeall};
+}
+sub add_probeall {
+ my ($conf, $alias, $module) = @_;
+
+ my $l = $conf->{$alias}{probeall} ||= [];
+ @$l = uniq(@$l, $module);
+ log::l("setting probeall $alias to @$l");
+}
+sub remove_probeall {
+ my ($conf, $alias, $module) = @_;
+
+ my $l = $conf->{$alias}{probeall} ||= [];
+ @$l = grep { $_ ne $module } @$l;
+ log::l("setting probeall $alias to @$l");
+}
+
+1;
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm
index ec76d388c..2f1cd6b29 100644
--- a/perl-install/mouse.pm
+++ b/perl-install/mouse.pm
@@ -201,7 +201,7 @@ sub read() {
}
sub write {
- my ($in, $mouse) = @_;
+ my ($do_pkgs, $mouse) = @_;
local $mouse->{FULLNAME} = qq("$mouse->{type}|$mouse->{name}"); #-"
local $mouse->{XEMU3} = bool2yesno($mouse->{nbuttons} < 3);
local $mouse->{WHEEL} = bool2yesno($mouse->{nbuttons} > 3);
@@ -214,7 +214,7 @@ sub write {
any::devfssymlinkf($mouse->{auxmouse}, 'mouse1') if $mouse->{auxmouse};
- various_xfree_conf($in, $mouse);
+ various_xfree_conf($do_pkgs, $mouse);
if (arch() =~ /ppc/) {
my $s = join('',
@@ -229,8 +229,10 @@ sub write {
}
}
-sub probe_wacom_devices() {
- modules::get_probeall("usb-interface") or return;
+sub probe_wacom_devices {
+ my ($modules_conf) = @_;
+
+ $modules_conf->get_probeall("usb-interface") or return;
my (@l) = detect_devices::usbWacom() or return;
log::l("found usb wacom $_->{driver} $_->{description} ($_->{type})") foreach @l;
@@ -268,7 +270,9 @@ sub detect_serial() {
$mouse, @wacom;
}
-sub detect() {
+sub detect {
+ my ($modules_conf) = @_;
+
if (arch() =~ /^sparc/) {
return fullname2mouse("sunmouse|Sun - Mouse");
}
@@ -280,10 +284,10 @@ sub detect() {
"busmouse|1 button");
}
- my @wacom = probe_wacom_devices();
+ my @wacom = probe_wacom_devices($modules_conf);
if (c::kernel_version() =~ /^\Q2.6/) {
- modules::get_probeall("usb-interface") and eval { modules::load('usbhid') };
+ $modules_conf->get_probeall("usb-interface") and eval { modules::load('usbhid') };
if (cat_('/proc/bus/input/devices') =~ /^H: Handlers=mouse/m) {
return fullname2mouse('Universal|Any PS/2 & USB mice', wacom => \@wacom);
}
@@ -296,7 +300,7 @@ sub detect() {
$ps2_mouse and detect_devices::hasMousePS2("psaux"); #- fake another open in order for XFree to see the mouse.
}
- if (modules::get_probeall("usb-interface")) {
+ if ($modules_conf->get_probeall("usb-interface")) {
sleep 2;
if (my (@l) = detect_devices::usbMice()) {
log::l(join('', "found usb mouse $_->{driver} $_->{description} (", if_($_->{type}, $_->{type}), ")")) foreach @l;
@@ -371,7 +375,7 @@ sub set_xfree_conf {
}
sub various_xfree_conf {
- my ($in, $mouse) = @_;
+ my ($do_pkgs, $mouse) = @_;
{
my $f = "$::prefix/etc/X11/xinit.d/mouse_buttons";
@@ -386,7 +390,7 @@ sub various_xfree_conf {
if (!$mouse->{auxmouse} || $mouse->{auxmouse}{nbuttons} <= 5) {
unlink($f);
} else {
- $in->do_pkgs->install('xinput');
+ $do_pkgs->install('xinput');
output_with_perm($f, 0755, "xinput set-button-map Mouse2 1 2 3 6 7 4 5\n");
}
}
@@ -404,10 +408,10 @@ sub various_xfree_conf {
#- $mouse->{MOUSETYPE} : type of the mouse : string : ex "ps/2"
#- $mouse->{XEMU3} : emulate 3rd button : string : 'yes' or 'no'
sub write_conf {
- my ($in, $mouse, $b_keep_auxmouse_unchanged) = @_;
+ my ($do_pkgs, $modules_conf, $mouse, $b_keep_auxmouse_unchanged) = @_;
- &write($in, $mouse);
- modules::write_conf() if $mouse->{device} eq "usbmouse" && !$::testing;
+ &write($do_pkgs, $mouse);
+ $modules_conf->write if $mouse->{device} eq "usbmouse" && !$::testing;
require Xconfig::xfree;
my $xfree_conf = Xconfig::xfree->read;
@@ -567,8 +571,7 @@ mouse - Perl functions to handle mice
require modules;
require mouse;
- modules::mergein_conf();
- mouse::detect();
+ mouse::detect(modules::any_conf->read);
=head1 DESCRIPTION
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm
index 2089dd229..f2b50186b 100644
--- a/perl-install/network/adsl.pm
+++ b/perl-install/network/adsl.pm
@@ -96,7 +96,7 @@ sub adsl_detect() {
}
sub adsl_conf_backend {
- my ($in, $adsl, $netc, $adsl_device, $adsl_type, $o_netcnx) = @_;
+ my ($in, $modules_conf, $adsl, $netc, $adsl_device, $adsl_type, $o_netcnx) = @_;
# FIXME: should not be needed:
defined $o_netcnx and $netc->{adsltype} = $o_netcnx->{type};
$netc->{adsltype} ||= "adsl_$adsl_type";
@@ -307,8 +307,8 @@ TYPE=$kind
# set aliases:
if (exists $modems{$adsl_device}{aliases}) {
- modules::set_alias($_->[0], $_->[1]) foreach @{$modems{$adsl_device}{aliases}};
- $::isStandalone and modules::write_conf();
+ $modules_conf->set_alias($_->[0], $_->[1]) foreach @{$modems{$adsl_device}{aliases}};
+ $::isStandalone and $modules_conf->write;
}
$netc->{NET_INTERFACE} = 'ppp0';
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
index 6f9cc8c85..a93d66c77 100644
--- a/perl-install/network/ethernet.pm
+++ b/perl-install/network/ethernet.pm
@@ -14,7 +14,7 @@ use vars qw(@ISA @EXPORT);
@EXPORT = qw(conf_network_card_backend);
sub write_ether_conf {
- my ($in, $netcnx, $netc, $intf) = @_;
+ my ($in, $modules_conf, $netcnx, $netc, $intf) = @_;
configureNetwork2($in, $::prefix, $netc, $intf);
$netc->{NETWORKING} = "yes";
if ($netc->{GATEWAY} || any { $_->{BOOTPROTO} =~ /dhcp/ } values %$intf) {
@@ -30,7 +30,7 @@ qq(
/sbin/ifup lo
), $netcnx->{type});
}
- $::isStandalone and modules::write_conf();
+ $::isStandalone and $modules_conf->write;
1;
}
@@ -46,16 +46,16 @@ sub mapIntfToDevice {
# return list of [ intf_name, module, device_description ] tuples such as:
# [ "eth0", "3c59x", "3Com Corporation|3c905C-TX [Fast Etherlink]" ]
-sub get_eth_cards() {
+sub get_eth_cards {
+ my ($modules_conf) = @_;
my @all_cards = detect_devices::getNet();
my @devs = detect_devices::pcmcia_probe();
- modules::mergein_conf();
my $saved_driver;
return map {
my $interface = $_;
my $description;
- my $a = c::getNetDriver($interface) || modules::get_alias($interface);
+ my $a = c::getNetDriver($interface) || $modules_conf->get_alias($interface);
if (my $b = find { $_->{device} eq $interface } @devs) { # PCMCIA case
$a = $b->{driver};
$description = $b->{description};
@@ -64,18 +64,18 @@ sub get_eth_cards() {
}
if (!$description) {
my $drv = readlink("/sys/class/net/$interface/driver");
- if ($drv and $drv =~ s!.*/!!) {
+ if ($drv && $drv =~ s!.*/!!) {
$a = $drv;
my %l;
my %sysfs_fields = (id => "device", subid => "subsystem_device", vendor => "vendor", subvendor => "subsystem_vendor");
$l{$_} = hex(chomp_(cat_("/sys/class/net/$interface/device/" . $sysfs_fields{$_}))) foreach keys %sysfs_fields;
my @cards = grep { my $dev = $_; every { $dev->{$_} eq $l{$_} } keys %l } detect_devices::probeall();
- $description = $cards[0]{description} if $#cards == 0;
+ $description = $cards[0]{description} if @cards == 1;
}
}
if (!$description) {
my @cards = grep { $_->{driver} eq ($a || $saved_driver) } detect_devices::probeall();
- $description = $cards[0]->{description} if $#cards == 0;
+ $description = $cards[0]{description} if @cards == 1;
}
$a and $saved_driver = $a; # handle multiple cards managed by the same driver
[ $interface, $saved_driver, if_($description, $description) ]
@@ -83,11 +83,11 @@ sub get_eth_cards() {
}
sub get_eth_cards_names {
- my (@all_cards) = @_;
+ my ($modules_conf, @all_cards) = @_;
foreach my $card (@all_cards) {
- modules::remove_alias($card->[1]);
- modules::set_alias($card->[0], $card->[1]);
+ $modules_conf->remove_alias($card->[1]);
+ $modules_conf->set_alias($card->[0], $card->[1]);
}
{ map { $_->[0] => join(': ', $_->[0], $_->[2]) } @all_cards };
@@ -131,10 +131,11 @@ sub conf_network_card_backend {
}
# automatic net aliases configuration
-sub configure_eth_aliases() {
+sub configure_eth_aliases {
+ my ($modules_conf) = @_;
foreach (detect_devices::getNet()) {
my $driver = c::getNetDriver($_) or next;
- modules::set_alias($_, $driver);
+ $modules_conf->set_alias($_, $driver);
}
}
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index e4f0ac49a..e4eea89d8 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -120,7 +120,8 @@ sub get_info_providers_backend {
sub read_providers_backend() { map { /(.*?)=>/ } catMaybeCompressed($file) }
-sub detect_backend() {
+sub detect_backend {
+ my ($modules_conf) = @_;
my @isdn;
require detect_devices;
each_index {
@@ -132,7 +133,7 @@ sub detect_backend() {
$isdn->{description} =~ s/.*\|//;
# $c->{options} !~ /id=HiSax/ && $isdn->{driver} eq "hisax" and $c->{options} .= " id=HiSax";
if ($c->{options} !~ /protocol=/ && $isdn->{protocol} =~ /\d/) {
- modules::set_options($c->{driver}, $c->{options} . " protocol=" . $isdn->{protocol});
+ $modules_conf->set_options($c->{driver}, $c->{options} . " protocol=" . $isdn->{protocol});
}
$c->{options} =~ /protocol=(\d)/ and $isdn->{protocol} = $1;
push @isdn, $isdn;
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index fc0b4aa19..7dde76ea3 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -13,23 +13,23 @@ use network::tools;
use MDK::Common::Globals "network", qw($in);
sub detect {
- my ($auto_detect, $o_class) = @_;
+ my ($modules_conf, $auto_detect, $o_class) = @_;
my %l = (
isdn => sub {
require network::isdn;
- $auto_detect->{isdn} = network::isdn::detect_backend();
+ $auto_detect->{isdn} = network::isdn::detect_backend($modules_conf);
},
lan => sub { # ethernet
- modules::load_category('network/main|gigabit|usb');
+ modules::load_category($modules_conf, 'network/main|gigabit|usb');
require network::ethernet;
- $auto_detect->{lan} = { map { $_->[0] => $_->[1] } network::ethernet::get_eth_cards() };
+ $auto_detect->{lan} = { map { $_->[0] => $_->[1] } network::ethernet::get_eth_cards($modules_conf) };
},
adsl => sub {
require network::adsl;
$auto_detect->{adsl} = network::adsl::adsl_detect();
},
modem => sub {
- $auto_detect->{modem} = { map { $_->{description} || "$_->{MANUFACTURER}|$_->{DESCRIPTION} ($_->{device})" => $_ } detect_devices::getModem() };
+ $auto_detect->{modem} = { map { $_->{description} || "$_->{MANUFACTURER}|$_->{DESCRIPTION} ($_->{device})" => $_ } detect_devices::getModem($modules_conf) };
},
);
$l{$_}->() foreach $o_class || keys %l;
@@ -74,7 +74,7 @@ sub get_subwizard {
# configuring all network devices
sub real_main {
- my ($_prefix, $netcnx, $in, $o_netc, $o_mouse, $o_intf, $o_first_time, $o_noauto) = @_;
+ my ($_prefix, $netcnx, $in, $modules_conf, $o_netc, $o_mouse, $o_intf, $o_first_time, $o_noauto) = @_;
my $netc = $o_netc ||= {};
my $mouse = $o_mouse ||= {};
my $intf = $o_intf ||= {};
@@ -120,15 +120,13 @@ sub real_main {
read_net_conf($netcnx, $netc, $intf);
- modules::mergein_conf();
-
$netc->{autodetect} = {};
my $lan_detect = sub {
- detect($netc->{autodetect}, 'lan');
- modules::interactive::load_category($in, 'network/main|gigabit|pcmcia|usb|wireless', !$::expert, 0);
- @all_cards = network::ethernet::get_eth_cards();
- %eth_intf = network::ethernet::get_eth_cards_names(@all_cards);
+ detect($modules_conf, $netc->{autodetect}, 'lan');
+ modules::interactive::load_category($in, $modules_conf, 'network/main|gigabit|pcmcia|usb|wireless', !$::expert, 0);
+ @all_cards = network::ethernet::get_eth_cards($modules_conf);
+ %eth_intf = network::ethernet::get_eth_cards_names($modules_conf, @all_cards);
require list_modules;
%eth_intf = map { $_->[0] => join(': ', $_->[0], $_->[2]) }
grep { to_bool($is_wireless) == c::isNetDeviceWirelessAware($_->[0]) } @all_cards;
@@ -332,7 +330,7 @@ sub real_main {
isdn =>
{
pre=> sub {
- detect($netc->{autodetect}, 'isdn');
+ detect($modules_conf, $netc->{autodetect}, 'isdn');
%isdn_cards = map { $_->{description} => $_ } @{$netc->{autodetect}{isdn}};
},
name => N("Select the network interface to configure:"),
@@ -347,7 +345,7 @@ sub real_main {
if ($isdn_name eq $my_isdn) {
return "isdn_ask";
} elsif ($isdn_name eq N("External ISDN modem")) {
- detect($netc->{autodetect}, 'modem');
+ detect($modules_conf, $netc->{autodetect}, 'modem');
$netc->{isdntype} = 'isdn_external';
$netcnx->{isdn_external}{device} = network::modem::first_modem($netc);
network::isdn::read_config($netcnx->{isdn_external});
@@ -463,7 +461,7 @@ Take a look at http://www.linmodems.org"),
{
pre => sub {
require network::modem;
- detect($netc->{autodetect}, 'modem');
+ detect($modules_conf, $netc->{autodetect}, 'modem');
},
name => N("Select the modem to configure:"),
data => sub {
@@ -646,7 +644,7 @@ killall pppd
pre => sub {
get_subwizard($wiz, 'adsl');
$lan_detect->();
- detect($netc->{autodetect}, 'adsl');
+ detect($modules_conf, $netc->{autodetect}, 'adsl');
@adsl_devices = keys %eth_intf;
foreach my $modem (keys %adsl_devices) {
push @adsl_devices, $modem if $netc->{autodetect}{adsl}{$modem};
@@ -813,7 +811,7 @@ If you don't know, choose 'use pppoe'"),
},
post => sub {
$netc->{internet_cnx_choice} = 'adsl';
- network::adsl::adsl_conf_backend($in, $netcnx, $netc, $ntf_name, $adsl_type, $netcnx); #FIXME
+ network::adsl::adsl_conf_backend($in, $modules_conf, $netcnx, $netc, $ntf_name, $adsl_type, $netcnx); #FIXME
$config->{adsl} = { kind => $ntf_name, protocol => $adsl_type };
$handle_multiple_cnx->();
},
@@ -840,7 +838,7 @@ You can find a driver on http://eciadsl.flashtux.org/"),
post => sub {
$ethntf = $intf->{$ntf_name} ||= { DEVICE => $ntf_name };
if ($ntf_name eq "Manually load a driver") {
- modules::interactive::load_category__prompt($in, 'network/main|gigabit|pcmcia|usb|wireless');
+ modules::interactive::load_category__prompt($in, $modules_conf, 'network/main|gigabit|pcmcia|usb|wireless');
return 'lan';
}
$::isInstall && $netc->{NET_DEVICE} eq $ethntf->{DEVICE} ? 'lan_alrd_cfg' : 'lan_protocol';
@@ -1055,8 +1053,8 @@ See iwpriv(8) man page for further information."),
{
pre => sub {
#-type =static or dhcp
- modules::interactive::load_category($in, 'network/main|gigabit|usb', !$::expert, 1);
- @all_cards = network::ethernet::get_eth_cards() or
+ modules::interactive::load_category($in, $modules_conf, 'network/main|gigabit|usb', !$::expert, 1);
+ @all_cards = network::ethernet::get_eth_cards($modules_conf) or
# FIXME: fix this
$in->ask_warn(N("Error"), N("No ethernet network adapter has been detected on your system.
I cannot set up this connection type.")), return;
@@ -1069,7 +1067,7 @@ I cannot set up this connection type.")), return;
post => sub {
network::ethernet::write_ether_conf();
- modules::write_conf() if $::isStandalone;
+ $modules_conf->write if $::isStandalone;
my $_device = network::ethernet::conf_network_card_backend($netc, $intf, $type, $interface->[0], $ipadr, $netadr);
return "lan";
},
@@ -1182,7 +1180,7 @@ It is not necessary on most networks."),
type => "yesorno",
post => sub {
my ($a) = @_;
- network::ethernet::write_ether_conf($in, $netcnx, $netc, $intf) if $netcnx->{type} eq 'lan';
+ network::ethernet::write_ether_conf($in, $modules_conf, $netcnx, $netc, $intf) if $netcnx->{type} eq 'lan';
if ($a && !$::testing && !run_program::rooted($::prefix, "/etc/rc.d/init.d/network restart")) {
$success = 0;
$in->ask_okcancel(N("Network Configuration"),
@@ -1332,8 +1330,8 @@ fi
}
sub main {
- my ($_prefix, $netcnx, $in, $o_netc, $o_mouse, $o_intf, $o_first_time, $o_noauto) = @_;
- eval { real_main('', , $netcnx, $in, $o_netc, $o_mouse, $o_intf, $o_first_time, $o_noauto) };
+ my ($_prefix, $netcnx, $in, $modules_conf, $o_netc, $o_mouse, $o_intf, $o_first_time, $o_noauto) = @_;
+ eval { real_main('', , $netcnx, $in, $modules_conf, $o_netc, $o_mouse, $o_intf, $o_first_time, $o_noauto) };
my $err = $@;
if ($err) { # && $in->isa('interactive::gtk')
local $::isEmbedded = 0; # to prevent sub window embedding
@@ -1404,7 +1402,7 @@ sub start_internet {
my ($o) = @_;
init_globals($o);
#- give a chance for module to be loaded using kernel-BOOT modules...
- $::isStandalone or modules::load_category('network/main|gigabit|usb');
+ $::isStandalone or modules::load_category($o->{modules_conf}, 'network/main|gigabit|usb');
run_program::rooted($::prefix, $network::tools::connect_file);
}
@@ -1430,7 +1428,7 @@ local $in = class_discard->new;
network::netconnect::init_globals($in);
my %i;
-&network::netconnect::detect(\%i);
+network::netconnect::detect($modules_conf, \%i);
print Dumper(\%i),"\n";
=cut
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 9f4256770..ae871084e 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -363,14 +363,14 @@ sub probe_netcnx_type {
}
sub easy_dhcp {
- my ($netc, $intf) = @_;
+ my ($modules_conf, $netc, $intf) = @_;
return if text2bool($netc->{NETWORKING});
require modules;
require network::ethernet;
- modules::load_category('network/main|gigabit|usb');
- my @all_cards = network::ethernet::get_eth_cards();
+ modules::load_category($modules_conf, 'network/main|gigabit|usb');
+ my @all_cards = network::ethernet::get_eth_cards($modules_conf);
#- only for a single network card
(any { $_->[0] eq 'eth0' } @all_cards) && (every { $_->[0] ne 'eth1' } @all_cards) or return;
diff --git a/perl-install/network/shorewall.pm b/perl-install/network/shorewall.pm
index f518bd00e..1bd15fead 100644
--- a/perl-install/network/shorewall.pm
+++ b/perl-install/network/shorewall.pm
@@ -69,8 +69,9 @@ sub default_interfaces {
my @l = detect_devices::getNet() or return;
-my @all_cards = network::ethernet::get_eth_cards();
-my %net_devices = network::ethernet::get_eth_cards_names(@all_cards);
+ my $modules_conf = modules::any_conf->read;
+my @all_cards = network::ethernet::get_eth_cards($modules_conf);
+my %net_devices = network::ethernet::get_eth_cards_names($modules_conf, @all_cards);
put_in_hash(\%net_devices, { 'ppp+' => 'ppp+', 'ippp+' => 'ippp+' });
$in->ask_from('',
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index 3e2dbaee7..bf1508a4b 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -190,9 +190,9 @@ sub is_dynamic_host {
}
sub reread_net_conf {
- my ($netcnx, $netc, $intf) = @_;
+ my ($modules_conf, $netcnx, $netc, $intf) = @_;
network::netconnect::read_net_conf($netcnx, $netc, $intf);
- modules::load_category('net');
+ modules::load_category($modules_conf, 'net');
}
sub convert_wep_key_for_iwconfig {
diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm
index 71adef0cf..c1f4f3aaa 100644
--- a/perl-install/printer/detect.pm
+++ b/perl-install/printer/detect.pm
@@ -7,7 +7,7 @@ use detect_devices;
use printer::data;
sub local_detect() {
- modules::get_probeall("usb-interface") and eval { modules::load($usbprintermodule) };
+ modules::any_conf->read->get_probeall("usb-interface") and eval { modules::load($usbprintermodule) };
eval { modules::unload(qw(lp parport_pc parport)) }; #- on kernel 2.4 parport has to be unloaded to probe again
eval { modules::load(qw(parport_pc lp)) }; #- take care as not available on 2.4 kernel (silent error).
whatPrinter();
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index fdfbdf317..9b641f79a 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -2277,7 +2277,7 @@ sub configure_hpoj {
my $usbdev = usbdevice($_->{val});
if (defined($usbdev)) {
# Unload kernel module "printer"/"usblp"
- if (modules::get_probeall("usb-interface")) {
+ if (modules::any_conf->read->get_probeall("usb-interface")) {
eval(modules::unload($usbprintermodule));
$printermoduleunloaded = 1;
}
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index 0eb075250..16ce47230 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -3513,11 +3513,12 @@ sub check_network {
N("Go on without configuring the network") ] } ])) {
if ($choice eq N("Configure the network now")) {
if ($::isInstall) {
+ my $o = $in;
require network::netconnect;
network::netconnect::main(
- $in->{prefix}, $in->{netcnx} ||= {},
- $in, $in->{netc}, $in->{mouse},
- $in->{intf});
+ $o->{prefix}, $o->{netcnx} ||= {},
+ $in, $o->{modules_conf}, $o->{netc}, $o->{mouse},
+ $o->{intf});
# my ($prefix, $netcnx, $in, $o_netc, $o_mouse, $o_intf, $o_first_time, $o_noauto) = @_;
} else {
system("/usr/sbin/drakconnect");
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index 844783d71..01f471326 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -51,7 +51,8 @@ if ($in->isa('interactive::gtk')) {
require ugtk2;
ugtk2->import(qw(:create :dialogs :helpers :wrappers));
}
-network::tools::reread_net_conf($netcnx, $netc, $intf);
+my $modules_conf = modules::any_conf->read;
+network::tools::reread_net_conf($modules_conf, $netcnx, $netc, $intf);
$::Wizard_title = N("Network & Internet Configuration");
$::Wizard_pix_up = "drakconnect.png";
@@ -122,7 +123,7 @@ $list->signal_connect(button_press_event => sub {
configure_lan() if $event->type eq '2button-press';
});
-update_list();
+update_list($modules_conf);
my ($label_host, $int_state);
@@ -203,8 +204,8 @@ sub manage {
eval(cat_('/etc/sysconfig/drakconnect'));
- @all_cards = network::ethernet::get_eth_cards();
- my %name = network::ethernet::get_eth_cards_names(@all_cards);
+ @all_cards = network::ethernet::get_eth_cards($modules_conf);
+ my %name = network::ethernet::get_eth_cards_names($modules_conf, @all_cards);
foreach (keys %name) {
$p->{/eth|ath|wlan/ ? $name{$_} : $_} = { kind => $_ };
}
@@ -269,7 +270,7 @@ sub build_tree {
$intf->{save} = sub {
$netc->{internet_cnx_choice} = 'adsl';
$netc->{at_boot} = $intf->{ONBOOT} eq 'yes' ? 1 : 0;
- network::adsl::adsl_conf_backend($in, $intf, $netc, $interface_kind, $protocol)
+ network::adsl::adsl_conf_backend($in, $modules_conf, $intf, $netc, $interface_kind, $protocol)
};
}
elsif ($interface eq 'modem') {
@@ -633,7 +634,7 @@ sub check_field {
sub add_intf() {
$::isWizard = 1;
- network::netconnect::main('', $netcnx, $in, $netc, undef, $intf);
+ network::netconnect::main('', $netcnx, $in, $modules_conf, $netc, undef, $intf);
$in->exit(0);
}
@@ -705,8 +706,9 @@ sub get_intf_ip {
my %intf;
-sub update_list() {
- @all_cards = network::ethernet::get_eth_cards();
+sub update_list {
+ my ($modules_conf) = @_;
+ @all_cards = network::ethernet::get_eth_cards($modules_conf);
my %new_intf = map { @$_ } @all_cards;
my @new_intf = sort keys %new_intf;
foreach my $interface (difference2(\@new_intf, [ keys %intf ])) {
diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw
index cd0fdc7e3..3e7997208 100755
--- a/perl-install/standalone/drakgw
+++ b/perl-install/standalone/drakgw
@@ -210,8 +210,9 @@ my %aliased_devices;
my $card_netconnect = network::netconnect::get_net_device() || "eth0";
defined $card_netconnect and log::l("[drakgw] Information from netconnect: ignore card $card_netconnect");
-my @all_cards = network::ethernet::get_eth_cards();
-my %net_devices = network::ethernet::get_eth_cards_names(@all_cards);
+my $modules_conf = modules::any_conf->read;
+my @all_cards = network::ethernet::get_eth_cards($modules_conf);
+my %net_devices = network::ethernet::get_eth_cards_names($modules_conf, @all_cards);
put_in_hash(\%net_devices, { 'ppp+' => 'ppp+', 'ippp+' => 'ippp+' });
$in->ask_from('',
diff --git a/perl-install/standalone/draksound b/perl-install/standalone/draksound
index 9737c3d48..4807bf686 100755
--- a/perl-install/standalone/draksound
+++ b/perl-install/standalone/draksound
@@ -29,18 +29,19 @@ use detect_devices;
my $in = 'interactive'->vnew('su');
-modules::mergein_conf();
+
+my $modules_conf = modules::any_conf->read;
if (my @devices = modules::probe_category('multimedia/sound')) {
# TODO: That need some work for multiples sound cards
map_index {
# allocate sound-slot in the same order as install2.pm
# fill $device->{driver} with the right sound-slot-XX or default driver if missing sound-slot [real fix'll be in harddrake service]
- my $driver = modules::get_alias("sound-slot-$::i");
- $driver = modules::get_alias($driver) if $driver =~ /sound-card/; # alsaconf ...
+ my $driver = $modules_conf->get_alias("sound-slot-$::i");
+ $driver = $modules_conf->get_alias($driver) if $driver =~ /sound-card/; # alsaconf ...
$_->{current_driver} = $driver if $driver;
$_->{sound_slot_index} = $::i;
- harddrake::sound::config($in, $_, $::i);
+ harddrake::sound::config($in, $modules_conf, $_, $::i);
} @devices;
} else {
$in->ask_warn(N("No Sound Card detected!"),
@@ -54,5 +55,5 @@ http://www.linux-mandrake.com/en/hardware.php3") .
N("\n\n\nNote: if you've an ISA PnP sound card, you'll have to use the alsaconf or the sndconfig program. Just type \"alsaconf\" or \"sndconfig\" in a console.")));
}
-modules::write_conf();
+$modules_conf->write;
$in->exit(0);
diff --git a/perl-install/standalone/drakxtv b/perl-install/standalone/drakxtv
index 6646a3f37..40e78fb09 100755
--- a/perl-install/standalone/drakxtv
+++ b/perl-install/standalone/drakxtv
@@ -115,16 +115,16 @@ my @devices = detect_devices::getTVcards();
push @devices, { driver => 'bttv', description => 'dummy' } if $::testing && !@devices;
if (@devices) {
my $not_canceled = 1;
- my $configured;
+ my $modules_conf;
# TODO: That need some work for multiples TV cards
each_index {
if (($< == 0 || $::testing) && (grep { detect_devices::isTVcard($_) } @devices)) {
require harddrake::v4l;
require modules;
- modules::mergein_conf() if !$configured;
- $configured++;
- $not_canceled &&= harddrake::v4l::config($in, $_->{driver});
- modules::write_conf();
+
+ $modules_conf ||= modules::any_conf->read;
+ $not_canceled &&= harddrake::v4l::config($in, $modules_conf, $_->{driver});
+ $modules_conf->write;
}
scan4channels() if $not_canceled;
} @devices
diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake
index 19d104f95..e78ecb2e8 100755
--- a/perl-install/standalone/mousedrake
+++ b/perl-install/standalone/mousedrake
@@ -13,14 +13,14 @@ use c;
my $in = 'interactive'->vnew('su');
-modules::mergein_conf();
+my $modules_conf = modules::any_conf->read;
begin:
my $mouse = mouse::read();
my %old = %$mouse;
if (!$::noauto) {
- my $probed_mouse = mouse::detect();
+ my $probed_mouse = mouse::detect($modules_conf);
$mouse = $probed_mouse if !$mouse->{XMOUSETYPE} || !$probed_mouse->{unsafe};
}
@@ -29,14 +29,14 @@ if (!$mouse || !$::auto) {
my $test_hbox;
my $name = $in->ask_from_treelistf('mousedrake', N("Please choose your mouse type."), '|',
sub { join '|', map { translate($_) } split '\|', $_[0] },
- [ mouse::fullnames ],
+ [ mouse::fullnames() ],
$mouse->{type} . '|' . $mouse->{name});
$name or $in->exit(0);
my $mouse_chosen = mouse::fullname2mouse($name);
$mouse = $mouse_chosen if !($mouse->{type} eq $mouse_chosen->{type} && $mouse->{name} eq $mouse_chosen->{name});
if ($mouse->{device} eq "usbmouse") {
- modules::load_category('bus/usb') or die 'no usb bus found\n';
+ modules::load_category($modules_conf, 'bus/usb') or die 'no usb bus found\n';
modules::load(qw(hid mousedev usbmouse));
}
@@ -51,7 +51,7 @@ if (!$mouse || !$::auto) {
$test_hbox and $test_hbox->destroy;
}
-mouse::write_conf($in, $mouse, 1);
+mouse::write_conf($in->do_pkgs, $modules_conf, $mouse, 1);
if ($in->isa('interactive::gtk') && mouse::change_mouse_live($mouse, \%old)) {
diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake
index e9dde3564..f41fcf46f 100755
--- a/perl-install/standalone/printerdrake
+++ b/perl-install/standalone/printerdrake
@@ -103,7 +103,6 @@ $commandline =~ /-lprng/ and
$printer->{SPOOLER} = 'lprng' and printer::main::read_configured_queues($printer);
$commandline =~ /-pdq/ and
$printer->{SPOOLER} = 'pdq' and printer::main::read_configured_queues($printer);
-modules::mergein_conf();
undef $w;
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 1cd03cc43..24c0f47ab 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -20,7 +20,7 @@ my $last_boot_config = $hw_sysconfdir."/previous_hw";
$last_boot_config .= '_X11' if $invert_do_it;
-modules::mergein_conf();
+my $modules_conf = modules::any_conf->read;
# autoreconfigure the mouse on major kernel change:
my $prev_kernel = { getVarsFromSh("$hw_sysconfdir/kernel") }->{KERNEL};
@@ -31,7 +31,7 @@ if ($curr_kernel ne $prev_kernel) {
log::explanations("Autoconfiguring mouse since we switched between 2.4.x and 2.6.x kernels");
require class_discard;
require mouse;
- mouse::write_conf(class_discard->new, mouse::detect(), 1);
+ mouse::write_conf(class_discard->new, $modules_conf, mouse::detect($modules_conf), 1);
}
if (find { $_->{driver} =~ /Card:NVIDIA/ } detect_devices::probeall()) {
@@ -89,7 +89,7 @@ foreach my $hw_class (@harddrake::data::tree) {
log::explanations("removed $Ident: " . harddrake::data::custom_id($oldconfig->{$_}, $item)) foreach @was_removed;
log::explanations("added $Ident: " . harddrake::data::custom_id($ID{$_}, $item)) foreach @added;
- modules::load('ohci1394') if $Ident eq 'FIREWIRE_CONTROLLER' && any { $_->{driver} eq 'ohci1394' } @added;
+ modules::load_and_configure($modules_conf, 'ohci1394') if $Ident eq 'FIREWIRE_CONTROLLER' && any { $_->{driver} eq 'ohci1394' } @added;
@added || @was_removed or next;
my @configurator_pool;
if (harddrake::data::is_removable($Ident)) {
@@ -105,20 +105,20 @@ foreach my $hw_class (@harddrake::data::tree) {
if ($Ident eq "AUDIO") {
# automatic sound slots configuration
rm_rf("/etc/asound.state");
- harddrake::sound::configure_sound_slots();
+ harddrake::sound::configure_sound_slots($modules_conf);
next;
} elsif ($Ident eq "ETHERNET") {
- modules::remove_alias_regexp('^(wlan|eth)[0-9]*$');
- modules::load_category('network/main|gigabit|usb|wireless');
+ $modules_conf->remove_alias_regexp('^(wlan|eth)[0-9]*$');
+ modules::load_category($modules_conf, 'network/main|gigabit|usb|wireless');
require network::ethernet;
- network::ethernet::configure_eth_aliases();
- modules::write_conf();
+ network::ethernet::configure_eth_aliases($modules_conf);
+ $modules_conf->write;
} elsif ($Ident eq "AGP") {
# add agpgart modules to modprobe.preload if needed:
- modules::write_conf();
+ $modules_conf->write;
} elsif ($Ident eq "VIDEO") {
require harddrake::autoconf;
- harddrake::autoconf::xconf();
+ harddrake::autoconf::xconf($modules_conf, {});
next;
}