aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@suse.com>2011-10-13 11:26:56 +0200
committerDaniel Lezcano <daniel.lezcano@free.fr>2011-10-24 14:55:13 +0200
commite4c0cf9212291d5cb0e6463037c0ab49ae6c9309 (patch)
treedb5e5080c4e4d8a4dd4ce5c253d96eed4c7726ac
parentalt linux template (diff)
downloadlxc-e4c0cf9212291d5cb0e6463037c0ab49ae6c9309.tar.gz
lxc-e4c0cf9212291d5cb0e6463037c0ab49ae6c9309.tar.bz2
lxc-e4c0cf9212291d5cb0e6463037c0ab49ae6c9309.zip
handle kernel 3.x in lxc-checkconfig
Make sure to correctly detect kernel 3.x for file capabilities. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rwxr-xr-xsrc/lxc/lxc-checkconfig.in17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in
index 30f6186..39da910 100755
--- a/src/lxc/lxc-checkconfig.in
+++ b/src/lxc/lxc-checkconfig.in
@@ -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"