Skip to content

Commit

Permalink
kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl
Browse files Browse the repository at this point in the history
Distributions now have lsmod in /bin instead of /sbin. But to handle
both cases, we look for it in /sbin /bin /usr/bin and /usr/sbin.
If lsmod is not found in any of those paths, it defaults to use
just lsmod and hopes that it lies in the path of the user.

Tested-by: Xavier Chantry <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
Steven Rostedt authored and rostedt committed Feb 2, 2010
1 parent 13d7e93 commit 88f66ea
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scripts/kconfig/streamline_config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,20 @@ sub read_kconfig {
my %modules;

# see what modules are loaded on this system
open(LIN,"/sbin/lsmod|") || die "Cant lsmod";
my $lsmod;

foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
if ( -x "$dir/lsmod" ) {
$lsmod = "$dir/lsmod";
last;
}
}
if (!defined($lsmod)) {
# try just the path
$lsmod = "lsmod";
}

open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
while (<LIN>) {
next if (/^Module/); # Skip the first line.
if (/^(\S+)/) {
Expand Down

0 comments on commit 88f66ea

Please sign in to comment.