From 71a90d55f7797d504970c691213f2fd48bb8ab54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 15 Jun 2021 08:42:18 +0200 Subject: Add undopatch script --- undopatch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 undopatch (limited to 'undopatch') diff --git a/undopatch b/undopatch new file mode 100755 index 0000000..0112101 --- /dev/null +++ b/undopatch @@ -0,0 +1,26 @@ +#!/bin/sh + +case "$PWD" in +/usr/pkgsrc/*/*) ;; +*) echo not in package directory 1>&2; exit 1 ;; +esac + +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 $w/${f#work/} $f +done -- cgit v1.2.3