diff mbox

[3/4] kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl

Message ID 20100203154906.255551521@goodmis.org (mailing list archive)
State New, archived
Headers show

Commit Message

Steven Rostedt Feb. 3, 2010, 3:46 p.m. UTC
None
diff mbox

Patch

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 9e66fa8..d7f7db7 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -264,7 +264,20 @@  foreach my $makefile (@makefiles) {
 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+)/) {