summaryrefslogtreecommitdiff
path: root/update-kernel-config
blob: 7f4180edcd92823b10aa9b952b58fe3a704f7886 (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
#!/bin/bash

if [ $# -ne 3 ]; then
  >&2 echo 'usage: update-kernel-config [repository] [kernel-name] [old-git-revision]'
  exit 2
fi

diff=$(
  git -C "/usr/src/archlinux/packages/$2/repos/$1-x86_64" diff "$3" HEAD -- config | \
    grep '^[+-]' | \
    grep -v '^+++\|^---'
)

{
  grep -vxF "$(
    printf '%s\n' "${diff}" | \
      sed -n '
        s/^-//
        T
        p
      '
  )" "/usr/src/github/archlinux32/packages/$1/$2/config"
  printf '%s\n' "${diff}" | \
    sed -n '
      s/^+//
      T
      p
    '
} | \
  sponge "/usr/src/github/archlinux32/packages/$1/$2/config"