summaryrefslogtreecommitdiffstats
path: root/perl-install/modules/modules_conf.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-07-22 08:26:59 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-07-22 08:26:59 +0000
commitb4e565488f9d133f1c0954d96b1054425ec9ace8 (patch)
tree7071d6f922ab06397992ded2bfea3e6915e4f911 /perl-install/modules/modules_conf.pm
parent0d5f0cdfa4f111f0e72f07bab8a660942401e80f (diff)
downloaddrakx-b4e565488f9d133f1c0954d96b1054425ec9ace8.tar
drakx-b4e565488f9d133f1c0954d96b1054425ec9ace8.tar.gz
drakx-b4e565488f9d133f1c0954d96b1054425ec9ace8.tar.bz2
drakx-b4e565488f9d133f1c0954d96b1054425ec9ace8.tar.xz
drakx-b4e565488f9d133f1c0954d96b1054425ec9ace8.zip
modules::modprobe_conf now works (at least a little :)
Diffstat (limited to 'perl-install/modules/modules_conf.pm')
-rw-r--r--perl-install/modules/modules_conf.pm58
1 files changed, 36 insertions, 22 deletions
diff --git a/perl-install/modules/modules_conf.pm b/perl-install/modules/modules_conf.pm
index 2a720fc70..0436d56cc 100644
--- a/perl-install/modules/modules_conf.pm
+++ b/perl-install/modules/modules_conf.pm
@@ -5,36 +5,50 @@ use common;
our @ISA = qw(modules::any_conf);
+
+sub file { '/etc/modules.conf' }
+sub handled_fields { qw(alias above options probeall) }
+
sub get_above {
- my ($conf, $name) = @_;
- $conf->{$name} && $conf->{$name}{above};
+ my ($conf, $module) = @_;
+ $conf->{$module} && $conf->{$module}{above};
}
sub set_above {
- my ($conf, $name, $modules) = @_;
- $conf->{$name}{above} = $modules;
-}
-sub remove_above {
- my ($conf, $name) = @_;
- delete $conf->{$name}{above};
+ my ($conf, $module, $o_modules) = @_;
+ if ($o_modules) {
+ $conf->{$module}{above} = $o_modules;
+ } else {
+ delete $conf->{$module}{above};
+ }
}
-sub get_probeall {
- my ($conf, $alias) = @_;
- $conf->{$alias}{probeall};
-}
-sub add_probeall {
- my ($conf, $alias, $module) = @_;
+sub read {
+ my ($type, $o_file) = @_;
- my $l = $conf->{$alias}{probeall} ||= [];
- @$l = uniq(@$l, $module);
- log::l("setting probeall $alias to @$l");
+ my $conf = modules::any_conf::read($type, $o_file);
+
+ #- convert old aliases to new probeall
+ foreach my $name ('scsi_hostadapter', 'usb-interface') {
+ my @old_aliases =
+ map { $_->[0] } sort { $a->[1] <=> $b->[1] }
+ map { if_(/^$name(\d*)/ && $conf->{$_}{alias}, [ $_, $1 || 0 ]) } keys %$conf;
+ foreach my $alias (@old_aliases) {
+ $conf->add_probeall($name, delete $conf->{$alias}{alias});
+ }
+ }
+
+ $conf;
}
-sub remove_probeall {
- my ($conf, $alias, $module) = @_;
- my $l = $conf->{$alias}{probeall} ||= [];
- @$l = grep { $_ ne $module } @$l;
- log::l("setting probeall $alias to @$l");
+sub write {
+ my ($conf, $o_file) = @_;
+ my $file = $o_file || do {
+ my $f = $::prefix . file();
+ rename "$::prefix/etc/conf.modules", $f; #- make the switch to new name if needed
+ $f;
+ };
+
+ modules::any_conf::write($conf, $file);
}
1;