From: Guillaume Zitta Date: Mon, 10 May 2010 09:50:10 +0000 (+0200) Subject: make lxc-checkconfig more explicit X-Git-Tag: lxc-0.7.0~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8208b295ab1589bdfec00193fb4e6534743edff5;p=thirdparty%2Flxc.git make lxc-checkconfig more explicit With a friend, we installed lxc on his server. We spend 1 hour on the kernel config because we didn't knew : - that lxc-checkconfig is a bash script and it can check a config before running it - which kernel config item whas not good - that CONFIG_SECURITY_FILE_CAPABILITIES is obsolete since 2.6.33 So, here is a patch for lxc-checkconfig that could save time for lxc newbies Signed-off-by: Daniel Lezcano Modified-by: Daniel Lezcano Signed-off-by: Guillaume Zitta --- diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in index 78c433e0a..aa815bf9f 100755 --- a/src/lxc/lxc-checkconfig.in +++ b/src/lxc/lxc-checkconfig.in @@ -26,9 +26,9 @@ is_enabled() { $SETCOLOR_SUCCESS && echo -e "enabled" && $SETCOLOR_NORMAL else if [ ! -z "$mandatory" -a "$mandatory" = yes ]; then - $SETCOLOR_FAILURE && echo -e "disabled" && $SETCOLOR_NORMAL + $SETCOLOR_FAILURE && echo -e "required" && $SETCOLOR_NORMAL else - $SETCOLOR_WARNING && echo -e "disabled" && $SETCOLOR_NORMAL + $SETCOLOR_WARNING && echo -e "missing" && $SETCOLOR_NORMAL fi fi } @@ -43,8 +43,10 @@ if [ ! -f $CONFIG ]; then 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 "The kernel configuration can not be retrieved." + echo "Please recompile with IKCONFIG_PROC, or" + echo "install the kernel headers, or specify" + echo "the path to the config file with: CONFIG= lxc-checkconfig" echo exit 1 else @@ -74,4 +76,13 @@ echo "--- Misc ---" echo -n "Veth pair device: " && is_enabled CONFIG_VETH echo -n "Macvlan: " && is_enabled CONFIG_MACVLAN echo -n "Vlan: " && is_enabled CONFIG_VLAN_8021Q -echo -n "File capabilities: " && is_enabled CONFIG_SECURITY_FILE_CAPABILITIES +KVER_MINOR=$($GREP '^# Linux kernel version:' $CONFIG | \ + sed -r 's/.*2.6.([0-9]{2}).*/\1/') +[[ ${KVER_MINOR} < 33 ]] && echo -n "File capabilities: " && is_enabled \ + CONFIG_SECURITY_FILE_CAPABILITIES + +echo +echo "Note : Before booting a new kernel, you can check its configuration" +echo "usage : CONFIG=/path/to/config $0" +echo +