123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
-
-
-
-
-
- unless ( @ARGV ) {
- die "Syntax: $0 [ -d target_directory ] module_1 module_2 module_3\n"
- }
-
-
- my @requested_modules = ();
- my $target_dir = "";
- my $kernel_ver;
- my $quiet;
- chomp ( my $current_kernel_ver = `uname -r` );
- while ( $_ = shift ) {
- if ( /-d/ ) { $target_dir = shift }
- elsif ( /-k/ ) { $kernel_ver = shift }
- elsif ( /-q/ ) { $quiet = 1 }
- else { push @requested_modules, $_ };
- }
-
-
- if ( $target_dir ) {
- print STDERR "Target directory is $target_dir\n" unless $quiet;
- system ( "mkdir -p $target_dir" );
- chdir $target_dir;
- }
-
-
- print STDERR "Requested modules ". join (' ', @requested_modules)."\n" unless $quiet;
- my @modules_dups;
- foreach my $module ( @requested_modules ) {
- my @module_list = map { /^\S+\s+(.*)$/ ; $1 } `/sbin/modprobe -nva $module`;
- die "Cannot find any modules matching $module\n" unless @module_list;
- push @modules_dups, @module_list;
- }
-
-
- my %module_basenames = ();
- my @modules = ();
- foreach my $module ( @modules_dups ) {
-
-
-
-
- $module =~ s/$current_kernel_ver/$kernel_ver/ if $kernel_ver;
- push @modules, $module unless $module_basenames{$module};
- ( my $basename ) = ( $module =~ /([^\/]+)\.o/ );
- $module_basenames{$module} = $basename;
- }
-
-
- print "#!/bin/sh\n";
- foreach my $module ( @modules ) {
- my $basename = $module_basenames{$module};
-
- print STDERR "Using module $basename from $module\n" unless $quiet;
-
- system ("gunzip -c $module > $basename.o");
-
- print "insmod $basename\n";
- }
|