aboutsummaryrefslogtreecommitdiff
path: root/pkgpatch
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-18 12:47:23 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-18 12:47:23 +0200
commit830afa08f95e2026f97b62d22484c27d42c104b1 (patch)
treec823736f34f215bbec8e638cb5a8321827c71c87 /pkgpatch
parent2af4ce763faae0c6f68b171b43e93101047d0c02 (diff)
downloadpatches-830afa08f95e2026f97b62d22484c27d42c104b1.tar.gz
Add pkgundo script
Diffstat (limited to 'pkgpatch')
-rwxr-xr-xpkgpatch18
1 files changed, 10 insertions, 8 deletions
diff --git a/pkgpatch b/pkgpatch
index 8d68c20..17af25c 100755
--- a/pkgpatch
+++ b/pkgpatch
@@ -2,12 +2,14 @@
# pkgpatch -- patch but don't overwrite original files
-for orig in *.orig; do
- mv -i "$orig" "${orig%.orig}".~1~
-done
-
+move()
+{
+ echo "${0##*/}: Renaming *.$1 to *.$2..." 1>&2
+ for orig in *.$1; do
+ mv -i "$orig" "${orig%.$1}".$2
+ done
+}
+
+move orig ~1~
+trap 'move ~1~ orig; trap -' INT QUIT TERM EXIT
patch -Vt -F3 "$@"
-
-for orig in *.~1~; do
- mv -i "$orig" "${orig%.~1~}".orig
-done