From dfa3bb4a63ecd2c5006e606d23b13b52ae0c3cfe Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 11 Feb 2008 22:42:11 +0000 Subject: use modname2path instead of hardcoding /modules (to use /lib/modules/`uname -r`) --- perl-install/modules.pm | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'perl-install/modules.pm') diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 53f5b6e13..8e0240cd1 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -240,16 +240,6 @@ sub read_already_loaded { when_load($conf, $_) foreach reverse loaded_modules(); } -sub name2file { - my ($name) = @_; - my $f = list_modules::modname2filename($name); - if (!$f) { - log::l("warning: unable to get module filename for $name"); - $f = $name; - } - $f . ".ko"; -} - sub when_load { my ($conf, $name) = @_; @@ -294,13 +284,19 @@ sub when_load_category { #-############################################################################### #- isInstall functions #-############################################################################### +sub module_extension() { ".ko" } + sub extract_modules { my ($dir, @modules) = @_; map { - my $f = name2file($_); - if (-e "/modules/$f.gz") { - system("gzip -dc /modules/$f.gz > $dir/$f") == 0 + my $modname = $_; + my $path = list_modules::modname2path($modname); + my $f = $modname . module_extension(); + if (-e $path) { + system("gzip -dc $path > $dir/$f") == 0 or unlink "$dir/$f"; + } else { + log::l("warning: unable to get module filename for $modname (path: $path)"); } "$dir/$f"; } @modules; @@ -311,7 +307,7 @@ sub load_raw_install { extract_modules('/tmp', @$l); my @failed = grep { - my $m = '/tmp/' . name2file($_); + my $m = '/tmp/' . $_ . module_extension(); if (-e $m) { my $stdout; my $rc = run_program::run('insmod', '2>', \$stdout, $m, split(' ', $options->{$_})); -- cgit v1.2.1