[12/12] csripts: .config generator

Submitted by Pavel Emelianov on April 24, 2017, 8:09 p.m.

Details

Message ID 58FE5B80.6010902@virtuozzo.com
State New
Series "Speed up kdat checks"
Headers show

Commit Message

Pavel Emelianov April 24, 2017, 8:09 p.m.
Add a script that would create .config file corresponding to
local kernel and tools.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 scripts/mklocalconfig.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100755 scripts/mklocalconfig.sh

Patch hide | download patch | download mbox

diff --git a/scripts/mklocalconfig.sh b/scripts/mklocalconfig.sh
new file mode 100755
index 0000000..42d0a98
--- /dev/null
+++ b/scripts/mklocalconfig.sh
@@ -0,0 +1,32 @@ 
+#!/bin/sh
+
+CRIU="./criu/criu -v0"
+
+echo "NO_MODULES_PRELOAD"
+
+if ${CRIU} check --feature loginuid; then
+	if ${CRIU} check --feature loginuid_r; then
+		echo "KERNEL_LOGINUID 2"
+	else
+		echo "KERNEL_LOGINUID 1"
+	fi
+else
+	echo "KERNEL_LOGINUID 0"
+fi
+
+function config_from_feature() {
+	if ${CRIU} check --feature "${1}"; then
+		echo "${2} true"
+	else
+		echo "${2} false"
+	fi
+}
+
+config_from_feature "tcp_half_closed" "KERNEL_TCP_REPAIR_HC"
+config_from_feature "nsid" "KERNEL_NSID"
+config_from_feature "sk_ns" "KERNEL_SOCK_NETNS"
+echo "KERNEL_LASTCAP $(cat /proc/sys/kernel/cap_last_cap)"
+echo "KERNEL_IPV6 $( [ -e '/proc/sys/net/ipv6' ] && echo 'true' || echo 'false')"
+
+echo "IPTABLES_HAS_XTLOCKS $(iptables -w -L 2>&1 > /dev/null && echo '1' || echo '0')"
+gcc $(dirname ${0})/check_pid.c -o /tmp/ckp && /tmp/ckp && echo 'GLIBC_GETPID_OK'