summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-12 13:54:41 +0200
committerErich Eckner <git@eckner.net>2018-07-12 13:54:41 +0200
commitf667025d2076b31eab833aafdeb2e24c765dd1a7 (patch)
tree1c2a9826284bb23ef2796aac1e18ddf5b422e6e0
downloadmerge-kernel-configs-f667025d2076b31eab833aafdeb2e24c765dd1a7.tar.xz
initial commit
-rwxr-xr-xmerge-kernel-configs26
1 files changed, 26 insertions, 0 deletions
diff --git a/merge-kernel-configs b/merge-kernel-configs
new file mode 100755
index 0000000..d8d86e3
--- /dev/null
+++ b/merge-kernel-configs
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# merge-kernel-configs $out
+# (reads from stdin)
+
+rm -f "$1"
+touch "$1"
+
+while read -r line; do
+ variable=$(
+ printf '%s\n' "${line}" | \
+ sed '
+ s/^# \(\S\+\) is not set$/\1/
+ t
+ s/=.*$//
+ t
+ d
+ '
+ )
+ if [ -z "${variable}" ] || \
+ grep -q '^\(# \)\?'"${variable}"'[= ]' "$1"; then
+ continue
+ fi
+ printf '%s\n' "${line}" >> \
+ "$1"
+done