feat: allow updating a patch

This commit is contained in:
psykose 2022-04-29 06:24:06 +00:00
parent 547480a378
commit a065129fdb
Signed by: psykose
SSH key fingerprint: SHA256:HwlGVJNLZqHoOvMtkshyGaXLkcdbEJahYMlepHFL+Uk

6
apatch Normal file → Executable file
View file

@ -1,7 +1,10 @@
#!/bin/sh
startdir="$PWD"
patch_exists=0
[ -f APKBUILD ] || ( echo "please run this in a package directory"; exit 1 )
[ ! -f "$1" ] || ( echo "patch $1 already exists"; exit 1 )
[ -f "$1" ] && patch_exists=1
[ "$1" != "" ] || ( echo "usage: apatch <patch name>"; exit 1 )
abuild clean fetch unpack prepare
@ -13,6 +16,7 @@ abuild clean fetch unpack prepare
cp -r src src-old
(
cd "src$builddir"
[ "$patch_exists" -eq 1 ] && patch -p1 < "$startdir/$1"
$SHELL
)
busybox diff -U3 -r "src-old$builddir" "src$builddir" | sed "s|src-old$builddir|a|g;s|src$builddir|b|g" > $1