checkconfig: Handle missing kernel version

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

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Stéphane Graber 2018-10-12 22:32:08 -04:00
parent 0bf2d4f723
commit c1e61eac48
No known key found for this signature in database
GPG Key ID: C638974D64792D67

6
src/lxc/cmd/lxc-checkconfig.in Normal file → Executable file
View File

@ -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