sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
[SM-Discuss] [PATCH 01/16] FUNCTIONS: Improved get_running_kernel_config()
- From: Ismael Luceno <ismael.luceno AT gmail.com>
- To: sm-discuss AT lists.ibiblio.org
- Subject: [SM-Discuss] [PATCH 01/16] FUNCTIONS: Improved get_running_kernel_config()
- Date: Sun, 11 Apr 2010 20:50:13 -0300
And make it use the more standard /lib/modules path to get the kernel config.
---
ChangeLog | 4 ++++
FUNCTIONS | 31 +++++++++++++++++++------------
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dc95ce7..a0107fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-11 Ismael Luceno <ismael AT sourcemage.org>
+ * FUNCTIONS: Improved get_running_kernel_config() and make it use the
+ more standard /lib/modules path to get the kernel config.
+
2010-04-10 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libs/libmpc: arithmetic of complex numbers; needed for gcc 4.5
diff --git a/FUNCTIONS b/FUNCTIONS
index adbf3cf..ac14c67 100755
--- a/FUNCTIONS
+++ b/FUNCTIONS
@@ -367,10 +367,11 @@ function devoke_uname_change()
}
#-----------------------------------------------------------------------
-## Get the running kernel config status of a some part of the kernel
-## given by $1. Used for spells that don't have linux triggers
+## Get the running kernel config status of the running kernel option
+## given by $1.
##
-## $1 string Config variable to look for
+## If a configure file is found print the requested config status (if
+## any) and return 0, otherwise return 1.
#-----------------------------------------------------------------------
function get_running_kernel_config()
{
@@ -383,15 +384,21 @@ function get_running_kernel_config()
# apparently you don't have proc mount
KVER=$(uname -r)
fi
- if [ -f /proc/config.gz ] ; then
- echo $(zgrep "^$1=" /proc/config.gz | awk -F= '{ print $2 }')
- elif [ -f /boot/config-$KVER ] ; then
- echo $(grep "^$1=" /boot/config-$KVER | awk -F= '{ print $2
}')
- elif [ -f /usr/src/linux-$KVER/.config ] ; then
- echo $(grep "^$1=" /usr/src/linux-$KVER/.config | awk -F= '{
print $2 }')
- else
- echo "-1"
- fi
+
+ for i in /proc/config /boot/config-$KVER
/lib/modules/$KVER/build/.config
+ do
+ if [ -f "$i" ]; then
+ cat "$i" && break
+ elif [ -f "$i.gz" ]; then
+ zcat "$i.gz" && break
+ elif [ -f "$i.bz2" ]; then
+ bzcat "$i.bz2" && break
+ elif [ -f "$i.xz" ]; then
+ xzcat "$i.xz" && break
+ elif [ -f "$i.lzma" ]; then
+ xzcat "$i.lzma" && break
+ fi
+ done | grep "^$1=" | awk -F= '{ if ($2) { print $2 }; exit (!$2) }'
}
#-------------------------------------------------------------------------
--
1.7.0.4
-
[SM-Discuss] Kernel build path,
Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 01/16] FUNCTIONS: Improved get_running_kernel_config(), Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 02/16] FUNCTIONS: Remove duplicated code, Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 03/16] FUNCTIONS: make get_running_kernel_config() get kernel version from get_running_kernel_version(), Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 04/16] FUNCTIONS: Improve code reuse for get_*_kernel_config(), Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 05/16] bridge-utils: Fix kernel headers path, Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 06/16] klibc: Fix kernel headers path, Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 07/16] virtualbox-module: Fix kernel headers path, Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 08/16] splashutils: Fix kernel headers path, Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 09/16] ndiswrapper: Fix kernel headers path, Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 10/16] madwifi: Fix kernel headers path, Ismael Luceno, 04/11/2010
- [SM-Discuss] [PATCH 11/16] cloop: Fix kernel headers path, Ismael Luceno, 04/11/2010
Archive powered by MHonArc 2.6.24.