Changeset 3250 in MondoRescue


Ignore:
Timestamp:
Feb 27, 2014, 3:48:25 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • The mr-kernel-get-modules program now returns all the full paths for all modules passed in parameters with their dependencies. Which is

exactly what needs mindi

Location:
branches/3.2/MondoRescue
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/3.2/MondoRescue/bin/mr-kernel-get-modules

    r3249 r3250  
    1818    shift;
    1919}
    20 my ($modulepath,@allmodpaths) = mr_kernel_get_modules($ver,@ARGV);
    21 print "modules path: $modulepath\n";
    22 print "all modpaths: ".join(' ',@allmodpaths)."\n";
     20if ((defined $ARGV[0]) && ($ARGV[0] eq "-m")) {
     21    shift;
     22}
     23
     24print join(' ',mr_kernel_get_modules($ver,@ARGV))."\n";
  • branches/3.2/MondoRescue/lib/MondoRescue/Kernel.pm

    r3249 r3250  
    7676sub mr_kernel_get_modules {
    7777
    78 my $ver = $_;
     78my @allmodules = @_;
     79my $ver = shift @allmodules;
    7980$ver = mr_kernel_get_version() if (not defined ($ver));
    80 my @allmodules = @_;
    8181
    8282my $module = "";
     
    8686my $modulepath = "";
    8787
     88#print Dumper(@allmodules);
     89
    8890# If no module names list passed as parameter, the work on all modules of the system
    8991if (not defined $allmodules[0]) {
     
    9294        next if (/^Module/);
    9395        ($module, $void) = split(/ /);
     96        print "***$module***|***$void***\n";
    9497        push @allmodules,$module;
    9598    }
    9699    close(LSMOD);
    97100}
     101#print Dumper(@allmodules);
    98102
    99103open(DEPMOD, "/sbin/depmod -n $ver |") or die "Unable to launch depmod";
     
    102106    last if ($module =~ /^#/);
    103107    chomp($void);
     108    $void =~ s/\s+//;
    104109    $modlist{$module} = $void;
    105110    pb_log(2,"Depmod on $module gives $void\n");
     
    126131    ($void,$lib,$modulep,$kernelv,$modpath) = split(/\//,$module,5);
    127132    next if (not defined $modpath);
    128     pb_log(2,"modpath: $modpath\n");
    129     push @allmodpaths,$modpath,split(/ /,$modlist{$modpath});
     133    $modulepath = "/$lib/$modulep/$kernelv";
     134    pb_log(2,"modpath: $modulepath/$modpath\n");
     135    push @allmodpaths,"$modulepath/$modpath",map { "$modulepath/".$_ } split(/ /,$modlist{$modpath});
    130136}
    131 $modulepath = "/$lib/$modulep/$kernelv";
    132 pb_log(1,"modules path: $modulepath\n");
    133137pb_log(1,"all modpaths: ".join(' ',@allmodpaths)."\n");
    134 return($modulepath,@allmodpaths);
     138# From List::More
     139my %seen = ();
     140return(grep { not $seen{$_}++ } @allmodpaths);
    135141}
    136142
Note: See TracChangeset for help on using the changeset viewer.