aboutsummaryrefslogtreecommitdiff
path: root/undopatch
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-18 18:49:13 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-18 18:49:37 +0200
commit123687a5aa3482b5ba9ca86179526c94422b409d (patch)
tree83fa480a7727cd67eb5840e7555d984478c53afd /undopatch
parent830afa08f95e2026f97b62d22484c27d42c104b1 (diff)
downloadpatches-123687a5aa3482b5ba9ca86179526c94422b409d.tar.gz
Add savepatch, xpkg scripts
Diffstat (limited to 'undopatch')
-rwxr-xr-xundopatch32
1 files changed, 9 insertions, 23 deletions
diff --git a/undopatch b/undopatch
index e46bc54..82a6ae8 100755
--- a/undopatch
+++ b/undopatch
@@ -1,26 +1,12 @@
-#!/bin/sh
+#!/bin/sh -e
-case "$PWD" in
-/usr/pkgsrc/*/*) ;;
-*) echo not in package directory 1>&2; exit 1 ;;
-esac
+# undopatch -- undo patches applied to pkgsrc build
-w=/usr/pkgsrc/distfiles/$(sed -n '/.*(\(.*\)).*/{s//\1/;p;q}' distinfo)
-
-done=$(dirname $w)/.$(basename $w).done
-
-if [ ! -e "$done" ]; then
- echo extracting archive... 1>&2
- cd $(dirname $w)
- tar xf $w
- touch $done
- cd -
-fi
-
-echo undoing patches... 1>&2
-cmd=echo\ cp
-[ x"$1" = x"-x" ] && cmd=cp || echo '(preview, no -x)' 1>&2
-find . -name '*.orig' | while read f; do
- f=${f%.orig}
- $cmd $(dirname $w)/${f#./work/} $f
+d=$(xpkg)
+echo=echo
+echo "${0##*/}: undoing patches..." 1>&2
+[ x"$1" = x"-x" ] && echo= || echo '(preview, no -x)' 1>&2
+find work -name '*.orig' | while read -r f; do
+ $echo cp "$d/${f#work/}" "${f%.orig}"
+ $echo rm "$f"
done