summaryrefslogtreecommitdiffstats
path: root/perl-install/modules.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/modules.pm')
-rw-r--r--perl-install/modules.pm90
1 files changed, 20 insertions, 70 deletions
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index d8da3b8aa..abeb0b366 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -1,4 +1,4 @@
-package modules; # $Id: modules.pm 269880 2010-06-04 14:01:44Z pterjan $
+package modules;
use strict;
@@ -59,9 +59,9 @@ sub module_is_available {
#-###############################################################################
#- module loading
#-###############################################################################
-# handles dependencies
-sub load_raw {
- my ($lm, $h_options) = @_;
+
+sub filter_loaded_modules {
+ my ($lm) = @_;
my $l;
@@ -87,11 +87,17 @@ sub load_raw {
push @$l, $mod;
}
}
+ $l;
+}
+
+# handles dependencies
+sub load_raw {
+ my ($lm, $h_options) = @_;
+
+ my $l = filter_loaded_modules($lm);
if ($::testing || $::local_install) {
log::l("i would load module $_ ($h_options->{$_})") foreach @$l;
- } elsif ($::isInstall) {
- load_raw_install($l, $h_options);
} else {
run_program::run('/sbin/modprobe', $_, split(' ', $h_options->{$_}))
or !run_program::run('/sbin/modprobe', '-n', $_) #- ignore missing modules
@@ -111,11 +117,11 @@ sub load_with_options {
my @l = map {
if_(member($_, 'plip', @parallel_zip_modules), 'parport_pc'),
if_($_ eq 'vfat', 'nls_cp437', 'nls_iso8859_1'),
- if_($_ eq 'btrfs', 'crc32c', 'crc32c-intel'),
- dependencies_closure(cond_mapping_24_26($_));
+ if_(member($_, qw(btrfs xfs)), 'crc32c', 'crc32c-intel'),
+ cond_mapping_24_26($_);
} @$l;
- @l = remove_loaded_modules(@l) or return;
+ @l = filter_out_loaded_modules(@l) or return;
my %options = map { cond_mapping_24_26($_) => $h_options->{$_} } keys %$h_options;
load_raw(\@l, \%options);
@@ -129,7 +135,7 @@ sub load {
sub load_and_configure {
my ($conf, $module, $o_options) = @_;
- my @l = remove_loaded_modules(dependencies_closure(cond_mapping_24_26($module)));
+ my @l = filter_out_loaded_modules(cond_mapping_24_26($module));
load_raw(\@l, { cond_mapping_24_26($module) => $o_options });
if (member($module, @parallel_zip_modules)
@@ -159,13 +165,6 @@ sub load_category {
if_($category =~ /scsi/,
if_(detect_devices::usbStorage(), 'usb_storage'),
),
- arch() =~ /ppc/ ? (
- if_($category =~ /scsi/,
- if_(detect_devices::has_mesh(), 'mesh'),
- if_(detect_devices::has_53c94(), 'mac53c94'),
- ),
- if_($category =~ /net/, 'bmac', 'gmac', 'mace', 'airport'),
- ) : (),
);
my @l = (
(map {
@@ -190,8 +189,6 @@ sub load_category {
sub load_parallel_zip {
my ($conf) = @_;
- arch() !~ /ppc/ or return;
-
grep {
eval { load_and_configure($conf, $_); 1 };
} @parallel_zip_modules;
@@ -249,7 +246,7 @@ sub set_preload_modules {
sub loaded_modules() {
map { /(\S+)/ } cat_("/proc/modules");
}
-sub remove_loaded_modules {
+sub filter_out_loaded_modules {
my (@l) = @_;
difference2([ uniq(@l) ], [ map { my $s = $_; $s =~ s/_/-/g; $s, $_ } loaded_modules() ]);
}
@@ -277,13 +274,13 @@ sub when_load_category {
if ($category =~ m,disk/ide,) {
$conf->add_probeall('ide-controller', $name);
eval { load('ide_gd_mod') };
- } elsif ($category =~ m,disk/(scsi|hardware_raid|sata|firewire),) {
+ } elsif ($category =~ m,disk/(scsi|hardware_raid|sata|firewire|virtual),) {
$conf->add_probeall('scsi_hostadapter', $name);
eval { load('sd_mod') };
} elsif ($category eq 'bus/usb') {
$conf->add_probeall('usb-interface', $name);
- -f '/proc/bus/usb/devices' or eval {
- require fs::mount; fs::mount::usbfs('');
+ -f '/sys/kernel/debug/usb/devices' or eval {
+ require fs::mount; fs::mount::sys_kernel_debug('');
#- ensure keyboard is working, the kernel must do the job the BIOS was doing
sleep 4;
load("usbhid") if detect_devices::usbKeyboards();
@@ -300,51 +297,4 @@ sub when_load_category {
}
}
-#-###############################################################################
-#- isInstall functions
-#-###############################################################################
-sub module_extension() { ".ko" }
-
-sub extract_modules {
- my ($dir, @modules) = @_;
- map {
- my $modname = $_;
- my $path = list_modules::modname2path($modname);
- my $f = $modname . module_extension();
- if (-e $path) {
- system("gzip -dc $path > $dir/$f 2>/dev/null") == 0
- or system("xz -d < $path > $dir/$f") == 0
- or unlink "$dir/$f";
- } else {
- log::l("warning: unable to get module filename for $modname (path: $path)");
- }
- "$dir/$f";
- } @modules;
-}
-
-sub load_raw_install {
- my ($l, $options) = @_;
-
- extract_modules('/tmp', @$l);
- my @failed = grep {
- my $m = '/tmp/' . $_ . module_extension();
- if (-e $m) {
- my $stdout;
- my $rc = run_program::run('/sbin/insmod', '2>', \$stdout, $m, split(' ', $options->{$_}));
- log::l(chomp_($stdout)) if $stdout;
- # if whether we succeeded or module is already loaded:
- if ($rc || $stdout =~ /: -1 File exists/) {
- unlink $m;
- '';
- }
- } else {
- log::l("missing module $_");
- 'error';
- }
- } @$l;
-
- die "insmod'ing module " . join(", ", @failed) . " failed" if @failed;
-
-}
-
1;