[packages/lxc] fix parsing kernel version when kernel is vserver patched

glen glen at pld-linux.org
Tue Sep 17 11:53:33 CEST 2013


commit bf6a07ce0ee91567e429a5e8b8e2e1ef0101a006
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Sep 17 12:52:35 2013 +0300

    fix parsing kernel version when kernel is vserver patched

 checkconfig-vserver-config.patch | 51 ++++++++++++++++++++++++++++++++++++++++
 lxc.spec                         |  4 +++-
 2 files changed, 54 insertions(+), 1 deletion(-)
---
diff --git a/lxc.spec b/lxc.spec
index f2c7131..fc5718b 100644
--- a/lxc.spec
+++ b/lxc.spec
@@ -8,7 +8,7 @@ Summary:	Linux Container Tools
 Summary(pl.UTF-8):	Narzędzia do kontenerów linuksowych (LXC)
 Name:		lxc
 Version:	0.9.0
-Release:	3
+Release:	4
 License:	LGPL v2.1+
 Group:		Applications/System
 Source0:	http://lxc.sourceforge.net/download/lxc/%{name}-%{version}.tar.gz
@@ -17,6 +17,7 @@ Patch0:		%{name}-devpts.patch
 Patch1:		%{name}-pld.patch
 Patch2:		am-1.14.patch
 Patch3:		checkconfig-module.patch
+Patch4:		checkconfig-vserver-config.patch
 URL:		http://lxc.sourceforge.net/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	automake
@@ -100,6 +101,7 @@ Wiązanie Pythona (3.x) do LXC.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %build
 %{__aclocal} -I config
diff --git a/checkconfig-vserver-config.patch b/checkconfig-vserver-config.patch
new file mode 100644
index 0000000..5716e9a
--- /dev/null
+++ b/checkconfig-vserver-config.patch
@@ -0,0 +1,51 @@
+the variables get assigned as:
+KVER_MAJOR="3\n# Linux VServer"
+KVER_MINOR="10\n# Linux VServer"
+
+which causes parse errors:
+
+Cgroup memory controller: 
++ '[' 3 '#' Linux VServer -ge 3 -a 10 '#' Linux VServer -ge 6 ']'
+/usr/bin/lxc-checkconfig[98]: [: #: unexpected operator/operand
++ is_enabled CONFIG_CGROUP_MEM_RES_CTLR
+
+in this code:
+if [ $KVER_MAJOR -ge 3 -a $KVER_MINOR -ge 6 ]; then
+    is_enabled CONFIG_MEMCG
+else
+    is_enabled CONFIG_CGROUP_MEM_RES_CTLR
+fi
+
+
+---
+$ zgrep '^# Linux' /proc/config.gz | sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/'
+3
+# Linux VServer
+---
+
+$ zcat /proc/config.gz |grep '^# Linux'
+---
+# Linux/x86_64 3.10.10 Kernel Configuration
+# Linux VServer
+---
+
+
+--- lxc-0.9.0/src/lxc/lxc-checkconfig.in	2013-09-17 12:00:03.486888314 +0300
++++ lxc-0.9.0/lxc-checkconfig	2013-09-17 12:47:12.000000000 +0300
+@@ -78,13 +68,13 @@
+ }
+ 
+ CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -1`
+-KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \
++KVER_MAJOR=$($GREP '^# Linux.*Kernel Configuration' $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 | \
++KVER_MINOR=$($GREP '^# Linux.*Kernel Configuration' $CONFIG | \
+     sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
+ else
+-KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
++KVER_MINOR=$($GREP '^# Linux.*Kernel Configuration' $CONFIG | \
+     sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
+ fi
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lxc.git/commitdiff/bf6a07ce0ee91567e429a5e8b8e2e1ef0101a006



More information about the pld-cvs-commit mailing list