From a065129fdb9d6b9f798ee39da0a45a59a862f355 Mon Sep 17 00:00:00 2001 From: psykose Date: Fri, 29 Apr 2022 06:24:06 +0000 Subject: [PATCH] feat: allow updating a patch --- apatch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100644 => 100755 apatch diff --git a/apatch b/apatch old mode 100644 new mode 100755 index 342ad5d..e8b8584 --- a/apatch +++ b/apatch @@ -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 "; 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