From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Anibal Monsalve Salazar <anibal@debian.org>,
Michal Marek <mmarek@suse.cz>,
Xavier Chantry <shiningxc@gmail.com>
Subject: [PATCH 3/4] kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl
Date: Wed, 03 Feb 2010 10:46:08 -0500 [thread overview]
Message-ID: <20100203154906.255551521@goodmis.org> (raw)
In-Reply-To: 20100203154605.461025238@goodmis.org
[-- Attachment #1: 0003-kconfig-Look-in-both-bin-and-sbin-for-lsmod-in-strea.patch --]
[-- Type: text/plain, Size: 1274 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
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>
---
scripts/kconfig/streamline_config.pl | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
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+)/) {
--
1.6.5
next prev parent reply other threads:[~2010-02-03 15:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 15:46 [PATCH 0/4][linux-next] kconfig: Updates to localmodconfig Steven Rostedt
2010-02-03 15:46 ` [PATCH 1/4] kconfig: Create include/generated for localmodconfig Steven Rostedt
2010-02-03 15:46 ` [PATCH 2/4] kconfig: Check for if conditions in Kconfig " Steven Rostedt
2010-02-03 15:46 ` Steven Rostedt [this message]
2010-02-03 15:46 ` [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod " Steven Rostedt
2010-02-03 16:07 ` Michal Marek
2010-02-03 16:12 ` Steven Rostedt
2010-02-03 16:20 ` [PATCH] kconfig: simplify LSMOD= handling Michal Marek
2010-02-03 16:49 ` [PATCH][linux-next] " Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100203154906.255551521@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=anibal@debian.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
--cc=shiningxc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox