]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-checkconfig fails on a kernel compiled without IKCONFIG_PROC.
authorKristian Høgh <kfh.lxc@kfh.dk>
Tue, 10 Mar 2009 10:00:32 +0000 (11:00 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 10 Mar 2009 10:00:32 +0000 (11:00 +0100)
Hi Daniel,

This patch retrieves info from kernel config in
/lib/modules/`uname -r`/build/.config
unless /proc/config.gz exist

Signed-off-by: Kristian Høgh <kfh.lxc@kfh.dk>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc-checkconfig.in

index cb91688771d9c79e418a4d09aacfe825ca903d81..b7536f20b935f35245bd58e9dfa6691d143ef742 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/bash
-CONFIGZ=/proc/config.gz
+CONFIG=/proc/config.gz
+GREP=zgrep
 
 SETCOLOR_SUCCESS="echo -en \\033[1;32m"
 SETCOLOR_FAILURE="echo -en \\033[1;31m"
@@ -8,7 +9,7 @@ SETCOLOR_NORMAL="echo -en \\033[0;39m"
 
 is_enabled() {
     mandatory=$2
-    zgrep -q "$1=y" $CONFIGZ
+    $GREP -q "$1=[y|m]" $CONFIG
     RES=$?
 
     if [ $RES = 0 ]; then
@@ -22,14 +23,17 @@ is_enabled() {
     fi
 }
 
-if [ ! -f $CONFIGZ ]; then
-    echo 
-    echo "The kernel configuration can not be retrieved because"
-    echo "\"$CONFIGZ\" was not found."
-    echo
-    echo "Is your kernel compiled with IKCONFIG_PROC ?"
-    echo 
-    exit 1
+if [ ! -f $CONFIG ]; then
+    KVER="`uname -r`"
+    CONFIG="/lib/modules/$KVER/build/.config"
+    GREP=grep
+    if [ ! -f $CONFIG ]; then
+        echo
+        echo "The kernel configuration can not be retrieved"
+        echo "Please recompile with IKCONFIG_PROC or install the kernel headers"
+        echo
+        exit 1
+    fi
 fi
 
 echo "--- Namespaces ---"