aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-01-06 18:49:44 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-02 13:01:01 -0500
commit88f66ea98d7ae6a8b6a34e38b1b4fa51abc1c9ca (patch)
treef2b9edf54bb3d2eec25b4166111dcf98fde2ae3a /scripts
parent13d7e9385644d376a0816ad663ba3dfc45359f2f (diff)
kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl
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 <shiningxc@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/streamline_config.pl15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 9e66fa8dc52e..d7f7db73e587 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -264,7 +264,20 @@ foreach my $makefile (@makefiles) {
264my %modules; 264my %modules;
265 265
266# see what modules are loaded on this system 266# see what modules are loaded on this system
267open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; 267my $lsmod;
268
269foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
270 if ( -x "$dir/lsmod" ) {
271 $lsmod = "$dir/lsmod";
272 last;
273 }
274}
275if (!defined($lsmod)) {
276 # try just the path
277 $lsmod = "lsmod";
278}
279
280open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
268while (<LIN>) { 281while (<LIN>) {
269 next if (/^Module/); # Skip the first line. 282 next if (/^Module/); # Skip the first line.
270 if (/^(\S+)/) { 283 if (/^(\S+)/) {