2023-06-13 16:16:31 +03:00
|
|
|
#!/usr/bin/perl
|
2017-03-15 16:43:11 +03:00
|
|
|
|
|
|
|
use strict;
|
2023-06-13 16:16:31 +03:00
|
|
|
use warnings;
|
2017-03-15 16:43:11 +03:00
|
|
|
|
|
|
|
my $dir = shift;
|
|
|
|
|
|
|
|
die "no directory to scan" if !$dir;
|
|
|
|
|
|
|
|
die "no such directory" if ! -d $dir;
|
|
|
|
|
2022-07-27 14:11:50 +03:00
|
|
|
warn "\n\nNOTE: strange directory name: $dir\n\n" if $dir !~ m|^(.*/)?(\d+.\d+.\d+\-\d+\-pve)(/+)?$|;
|
2017-03-15 16:43:11 +03:00
|
|
|
|
|
|
|
my $apiver = $2;
|
|
|
|
|
2023-06-13 16:16:31 +03:00
|
|
|
open(my $FIND_KO_FH, "find '$dir' -name '*.ko'|");
|
|
|
|
while (defined(my $fn = <$FIND_KO_FH>)) {
|
2017-03-15 16:43:11 +03:00
|
|
|
chomp $fn;
|
|
|
|
my $relfn = $fn;
|
|
|
|
$relfn =~ s|^$dir/*||;
|
|
|
|
|
|
|
|
my $cmd = "/sbin/modinfo -F firmware '$fn'";
|
2023-06-13 16:16:31 +03:00
|
|
|
open(my $MOD_FH, "$cmd|");
|
|
|
|
while (defined(my $fw = <$MOD_FH>)) {
|
2017-03-15 16:43:11 +03:00
|
|
|
chomp $fw;
|
|
|
|
print "$fw $relfn\n";
|
|
|
|
}
|
2023-06-13 16:16:31 +03:00
|
|
|
close($MOD_FH);
|
2017-03-15 16:43:11 +03:00
|
|
|
|
|
|
|
}
|
2023-06-13 16:16:31 +03:00
|
|
|
close($FIND_KO_FH);
|
2017-03-15 16:43:11 +03:00
|
|
|
|
|
|
|
exit 0;
|