Hi,

attached patch fixes File capabilities detection when running under
kernel 3.x.


-- 
Frederic Crozat <fcro...@suse.com>
SUSE
>From 5a4d96d1fd95719ddeb462fff45dbbc7cbbee3df Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcro...@suse.com>
Date: Thu, 13 Oct 2011 11:26:56 +0200
Subject: [PATCH] handle kernel 3.x in lxc-checkconfig

Make sure to correctly detect kernel 3.x for file capabilities.
---
 src/lxc/lxc-checkconfig.in |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in
index 5dcf3a4..c2c64ba 100755
--- a/src/lxc/lxc-checkconfig.in
+++ b/src/lxc/lxc-checkconfig.in
@@ -83,12 +83,21 @@ 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
+KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \
+    sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
+if [[ $KVER_MAJOR == 2 ]]; then
 KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
-    sed -r 's/.*2.6.([0-9]{2}).*/\1/')
+    sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
+else
+KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
+    sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
+fi
 echo -n "File capabilities: " &&
-    [[ ${KVER_MINOR} < 33 ]] && is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ||
-    [[ ${KVER_MINOR} > 32 ]] &&  $SETCOLOR_SUCCESS && echo -e "enabled" &&
-    $SETCOLOR_NORMAL
+    ( [[ ${KVER_MAJOR} == 2 && ${KVER_MINOR} < 33 ]] &&
+       is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ) ||
+    ( [[ ( ${KVER_MAJOR} == 2 && ${KVER_MINOR} > 32 ) ||
+         ${KVER_MAJOR} > 2 ]] && $SETCOLOR_SUCCESS && 
+         echo -e "enabled" && $SETCOLOR_NORMAL )
 
 echo
 echo "Note : Before booting a new kernel, you can check its configuration"
-- 
1.7.3.4

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to