[lxc-devel] [lxc/master] checkconfig: Handle missing kernel version

stgraber on Github lxc-bot at linuxcontainers.org
Sat Oct 13 02:32:50 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 396 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181013/9b945b60/attachment.bin>
-------------- next part --------------
From c1e61eac485931822bf014aff599d557b4ccab4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 12 Oct 2018 22:32:08 -0400
Subject: [PATCH] checkconfig: Handle missing kernel version
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://github.com/lxc/lxd/issues/5151

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 src/lxc/cmd/lxc-checkconfig.in | 6 ++++++
 1 file changed, 6 insertions(+)
 mode change 100644 => 100755 src/lxc/cmd/lxc-checkconfig.in

diff --git a/src/lxc/cmd/lxc-checkconfig.in b/src/lxc/cmd/lxc-checkconfig.in
old mode 100644
new mode 100755
index bb257f93b..0342d89ca
--- a/src/lxc/cmd/lxc-checkconfig.in
+++ b/src/lxc/cmd/lxc-checkconfig.in
@@ -93,6 +93,12 @@ KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
     sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
 fi
 
+if [ -z "${KVER_MAJOR}" ]; then
+    echo "WARNING: Unable to detect version from configuration, assuming latest\n"
+    KVER_MAJOR="100"
+    KVER_MINOR="0"
+fi
+
 echo "--- Namespaces ---"
 echo -n "Namespaces: " && is_enabled CONFIG_NAMESPACES yes
 echo


More information about the lxc-devel mailing list