Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/update-kernel-config
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-18 10:38:05 +0200
committerErich Eckner <git@eckner.net>2018-05-18 10:38:05 +0200
commitd4cae11ccf5ba56d624a916429368ea60f5e2a10 (patch)
tree141362f4390caeee082cb1bf6314e5a3c3fef671 /update-kernel-config
parentf080dc0522db5f5a6f19c92ad54b3a9aabbe2e83 (diff)
update-kernel-config: change more, deduce more
Diffstat (limited to 'update-kernel-config')
-rwxr-xr-xupdate-kernel-config43
1 files changed, 40 insertions, 3 deletions
diff --git a/update-kernel-config b/update-kernel-config
index 7f4180e..7541058 100755
--- a/update-kernel-config
+++ b/update-kernel-config
@@ -1,12 +1,26 @@
#!/bin/bash
-if [ $# -ne 3 ]; then
- >&2 echo 'usage: update-kernel-config [repository] [kernel-name] [old-git-revision]'
+if [ $# -ne 2 ]; then
+ >&2 echo 'usage: update-kernel-config [repository] [kernel-name]'
exit 2
fi
+old_revision=$(
+ sed -n '
+ s/^# upstream git\( revision\)\?: *//
+ T
+ p
+ ' "/usr/src/github/archlinux32/packages/$1/$2/PKGBUILD"
+)
+
+if [ -z "${old_revision}" ]; then
+ >&2 echo 'Cannot detemine old upstream git revision.'
+ >&2 echo '"# upstream git revision: ..." line is missing.'
+ exit 1
+fi
+
diff=$(
- git -C "/usr/src/archlinux/packages/$2/repos/$1-x86_64" diff "$3" HEAD -- config | \
+ git -C "/usr/src/archlinux/packages/$2/repos/$1-x86_64" diff "${old_revision}" HEAD -- config | \
grep '^[+-]' | \
grep -v '^+++\|^---'
)
@@ -28,3 +42,26 @@ diff=$(
'
} | \
sponge "/usr/src/github/archlinux32/packages/$1/$2/config"
+
+sed -i '
+ 1 s/^#.*$/# upstream git revision: '"$(
+ git -C "/usr/src/archlinux/packages" rev-parse HEAD
+ )"'/
+ s/'"$(
+ git -C "/usr/src/archlinux/packages/$2/repos/$1-x86_64" archive "${old_revision}" -- config | \
+ tar -Ox | \
+ sha256sum | \
+ awk '{print $1}'
+ )"'/'"$(
+ git -C "/usr/src/archlinux/packages/$2/repos/$1-x86_64" archive HEAD -- config | \
+ tar -Ox | \
+ sha256sum | \
+ awk '{print $1}'
+ )"'/g
+ s/'"$(
+ git -C "/usr/src/github/archlinux32/packages/$1/$2" archive HEAD -- config | \
+ tar -Ox | \
+ sha256sum | \
+ awk '{print $1}'
+ )"'/SKIP/g
+' "/usr/src/github/archlinux32/packages/$1/$2/PKGBUILD"