diff options
author | Erich Eckner <git@eckner.net> | 2018-07-12 14:07:53 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-12 14:07:53 +0200 |
commit | 47e77aaa2bed7c96e727a3d33cf3fb779212be2f (patch) | |
tree | 6d1f8ec4399963cc952b63d6b48e4382f255aa62 | |
parent | f667025d2076b31eab833aafdeb2e24c765dd1a7 (diff) | |
download | merge-kernel-configs-master.tar.xz |
-rwxr-xr-x | merge-kernel-configs | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/merge-kernel-configs b/merge-kernel-configs index d8d86e3..cf58157 100755 --- a/merge-kernel-configs +++ b/merge-kernel-configs @@ -1,26 +1,32 @@ #!/bin/bash -# merge-kernel-configs $out -# (reads from stdin) +# merge-kernel-configs +# (reads from stdin, writes to stdout) -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 +sed ' + s/^# \(\S\+\) is not set$/\1 \0/ + tf + s/^\(\S\+\)=/\1 \0/ + tf + d + :f + = +' | \ + sed ' + N + s/\n/ / + ' | \ + while read -r num variable line; do + printf '%s %s %s\n' \ + "${num}" \ + "$( + printf '%s\n' "${line}" | \ + base64 -w0 + )" \ + "${variable}" + done | \ + sort -k3,3 -k1n,1 -k2,2 | \ + uniq -f2 | \ + sort -k1,1 | \ + cut -d' ' -f2 | \ + parallel --pipe -L1 base64 -d |