From: Kristian Høgh Date: Tue, 10 Mar 2009 10:00:32 +0000 (+0100) Subject: lxc-checkconfig fails on a kernel compiled without IKCONFIG_PROC. X-Git-Tag: lxc_0_6_1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e7f51d1b485f0fd3476fe9f94c3b50fd8aabbc4;p=thirdparty%2Flxc.git lxc-checkconfig fails on a kernel compiled without IKCONFIG_PROC. 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 Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in index cb9168877..b7536f20b 100755 --- a/src/lxc/lxc-checkconfig.in +++ b/src/lxc/lxc-checkconfig.in @@ -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 ---"