]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: lxc-checkconfig conditionalize devpts check 1217/head
authorChristian Brauner <christian.brauner@canonical.com>
Thu, 29 Sep 2016 08:44:09 +0000 (10:44 +0200)
committerChristian Brauner <christian.brauner@canonical.com>
Thu, 29 Sep 2016 08:44:09 +0000 (10:44 +0200)
Only check for DEVPTS_MULTIPLE_INSTANCES on kernels < 4.7.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
src/lxc/tools/lxc-checkconfig.in

index 29586f869b8a728fa9ebf3346de1eff64af96428..61627e0f83cfb6fed3162a3b668e5a37e69d18fb 100644 (file)
@@ -72,6 +72,16 @@ if gunzip -tq < $CONFIG 2>/dev/null; then
     CAT="zcat"
 fi
 
+KVER_MAJOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
+    sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
+if [ "$KVER_MAJOR" = "2" ]; then
+KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
+    sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
+else
+KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
+    sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
+fi
+
 echo "--- Namespaces ---"
 echo -n "Namespaces: " && is_enabled CONFIG_NAMESPACES yes
 echo -n "Utsname namespace: " && is_enabled CONFIG_UTS_NS
@@ -79,7 +89,9 @@ echo -n "Ipc namespace: " && is_enabled CONFIG_IPC_NS yes
 echo -n "Pid namespace: " && is_enabled CONFIG_PID_NS yes
 echo -n "User namespace: " && is_enabled CONFIG_USER_NS
 echo -n "Network namespace: " && is_enabled CONFIG_NET_NS
-echo -n "Multiple /dev/pts instances: " && is_enabled DEVPTS_MULTIPLE_INSTANCES
+if ([ $KVER_MAJOR -lt 4 ]) || ([ $KVER_MAJOR -eq 4 ] && [ $KVER_MINOR -lt 7 ]); then
+       echo -n "Multiple /dev/pts instances: " && is_enabled DEVPTS_MULTIPLE_INSTANCES
+fi
 echo
 echo "--- Control groups ---"
 
@@ -89,15 +101,6 @@ print_cgroups() {
 }
 
 CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -n 1`
-KVER_MAJOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
-    sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
-if [ "$KVER_MAJOR" = "2" ]; then
-KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
-    sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
-else
-KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
-    sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
-fi
 
 echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes