diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-02-28 16:20:13 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-02-28 16:20:13 +0000 |
commit | 887c41ee6d59af5bc84dbf6be480ab7829171e8a (patch) | |
tree | cacdb78adb483a30905b6a5b8ed9bb9e40f830c3 /rescue | |
parent | 039f8f1b09c955fda84e9279df960fe5b3394a66 (diff) | |
download | drakx-backup-do-not-use-887c41ee6d59af5bc84dbf6be480ab7829171e8a.tar drakx-backup-do-not-use-887c41ee6d59af5bc84dbf6be480ab7829171e8a.tar.gz drakx-backup-do-not-use-887c41ee6d59af5bc84dbf6be480ab7829171e8a.tar.bz2 drakx-backup-do-not-use-887c41ee6d59af5bc84dbf6be480ab7829171e8a.tar.xz drakx-backup-do-not-use-887c41ee6d59af5bc84dbf6be480ab7829171e8a.zip |
support new modules location (#38207) by reusing some DrakX code (and duplicating a bit of install::commands)
Diffstat (limited to 'rescue')
-rw-r--r-- | rescue/NEWS | 1 | ||||
-rwxr-xr-x | rescue/tree/sbin/modprobe | 64 |
2 files changed, 13 insertions, 52 deletions
diff --git a/rescue/NEWS b/rescue/NEWS index 0f06f84f2..c667c6f0e 100644 --- a/rescue/NEWS +++ b/rescue/NEWS @@ -1,3 +1,4 @@ +- support new modules location (#38207) - adapt to perl 5.10 - fix build (fix a workaround in partimage_whole_disk) diff --git a/rescue/tree/sbin/modprobe b/rescue/tree/sbin/modprobe index b8d6aecb2..a9cd91a89 100755 --- a/rescue/tree/sbin/modprobe +++ b/rescue/tree/sbin/modprobe @@ -1,56 +1,16 @@ #!/usr/bin/perl -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } - -sub read_already_loaded() { - foreach (cat_("/proc/modules")) { - my ($name) = split; - $conf{$name}{loaded} = 1; - } -} - -sub load_deps($) { - my ($file) = @_; - - local *F; - open F, $file or warn "error opening $file: $!\n", return 0; - foreach (<F>) { - my ($f, $deps) = split ':'; - push @{$deps{$f}}, split ' ', $deps; - } +use lib qw(/usr/lib/libDrakX); +use list_modules; +use modules; + +# based on install::commands +sub modprobe { + !@_ || $_[0] =~ /^-?-h/ and die "usage: modprobe <module> [<options...>]\n"; + my $name = shift; + list_modules::load_default_moddeps(); + modules::load_with_options([ $name ], { $name => join(' ', @_) }); } -my $module_extension = cat_('/proc/version') =~ /^Linux version 2.4/ ? '.o' : '.ko'; - -my %mappings = ("usb-ohci" => "ohci-hcd", - "usb-uhci" => "uhci-hcd", - "uhci" => "uhci-hcd", - "printer" => "usblp", - "bcm4400" => "b44", - "3c559" => "3c359", - "3c90x" => "3c59x", - "dc395x_trm" => "dc395x", - "audigy" => "snd-emu10k1"); - -sub load { - my ($name, @options) = @_; - $name =~ s/\.k?o$//; - - $name = $mappings{$name} || $name; #- 2.4 -> 2.6 compat mappings - - $conf{$name}{loaded} and return; - eval { load($_, 'prereq') } foreach @{$deps{$name}}; - - system("gzip -dc /modules/$name$module_extension.gz > /tmp/$name$module_extension"); - -r "/tmp/$name$module_extension" or die "can't find module $name\n"; - system("/sbin/insmod /tmp/$name$module_extension"); - my $retval = $?; - system("rm /tmp/$name$module_extension"); - $retval and die("insmod $name failed"); -} - -!@ARGV || $ARGV[0] =~ /^-?-h/ and die "usage: modprobe <module> [<options...>]\n"; - -read_already_loaded(); -load_deps("/modules/modules.dep"); -load(@ARGV); +$::isInstall = 1; +modprobe(@ARGV); |