summaryrefslogtreecommitdiffstats
path: root/FUNCTIONS
diff options
context:
space:
mode:
authorIsmael Luceno2010-04-11 17:19:57 -0300
committerIsmael Luceno2010-04-12 03:37:58 -0300
commit94e8948fa4a578af25f5c8cfa4b1369cf5b5631e (patch)
treef7c6d04166930aa589b07e00e5feec6f8f5fade2 /FUNCTIONS
parent15e5abc6df0fe8ba0487e916c89e8a84e145b730 (diff)
FUNCTIONS: Improved get_running_kernel_config()
And make it use the more standard /lib/modules path to get the kernel config.
Diffstat (limited to 'FUNCTIONS')
-rwxr-xr-xFUNCTIONS31
1 files changed, 19 insertions, 12 deletions
diff --git a/FUNCTIONS b/FUNCTIONS
index adbf3cf8f4..ac14c67c35 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) }'
}
#-------------------------------------------------------------------------