]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
handle kernel 3.x in lxc-checkconfig
authorFrederic Crozat <fcrozat@suse.com>
Thu, 13 Oct 2011 09:26:56 +0000 (11:26 +0200)
committerDaniel Lezcano <daniel.lezcano@free.fr>
Mon, 24 Oct 2011 12:55:13 +0000 (14:55 +0200)
Make sure to correctly detect kernel 3.x for file capabilities.

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

index 30f618601118f5de503a8a59d40d7f33e26d221c..39da91006d18b88914b01f6da03e42dcc44af59a 100755 (executable)
@@ -88,12 +88,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"