summaryrefslogtreecommitdiff
path: root/merge-kernel-configs
blob: cf581575b7f943e31e0755ea0801cc1d347e2b98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

# merge-kernel-configs
# (reads from stdin, writes to stdout)

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