]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-checkconfig: Allow to override grep and config
authorGuido Trotter <ultrotter@google.com>
Wed, 18 Mar 2009 17:53:32 +0000 (17:53 +0000)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 19 Mar 2009 15:11:10 +0000 (16:11 +0100)
It might be handy for the user to specify a different kernel config file
to check, perhaps the one of a kernel he's about to build. To allow that
we only set the CONFIG variable if it's not present in the environment
before. Also, if CONFIG is not found and we resort to a different file,
we say it explicitely, to avoid typos on the user's part resulting in
silently checking a different config than the one the user wanted.

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc-checkconfig.in

index d1385cca0c4ad6f97ffbe4a12fe1d9db30129957..9cf29ddf93d24146329889f36f1d06816cea9c09 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
-CONFIG=/proc/config.gz
-GREP=zgrep
+
+# Allow environment variables to override grep and config
+: ${CONFIG:=/proc/config.gz}
+: ${GREP:=zgrep}
 
 SETCOLOR_SUCCESS="echo -en \\033[1;32m"
 SETCOLOR_FAILURE="echo -en \\033[1;31m"
@@ -24,6 +26,7 @@ is_enabled() {
 }
 
 if [ ! -f $CONFIG ]; then
+    echo "Kernel config $CONFIG not found, looking in other places..."
     KVER="`uname -r`"
     HEADERS_CONFIG="/lib/modules/$KVER/build/.config"
     BOOT_CONFIG="/boot/config-$KVER"
@@ -36,6 +39,8 @@ if [ ! -f $CONFIG ]; then
         echo "Please recompile with IKCONFIG_PROC or install the kernel headers"
         echo
         exit 1
+    else
+        echo "Found kernel config file $CONFIG"
     fi
 fi