Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] [PATCH 01/16] FUNCTIONS: Improved get_running_kernel_config()

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • 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





Archive powered by MHonArc 2.6.24.

Top of Page