From 5d8522cf2e5c661fb9250fb261e36b00de5dbe42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 26 Jul 2021 22:21:03 +0200 Subject: Add whereispatch script --- bin/pkgdiffs | 3 +++ bin/savepatch | 24 ++++++------------------ bin/whereispatch | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 18 deletions(-) create mode 100755 bin/whereispatch diff --git a/bin/pkgdiffs b/bin/pkgdiffs index e39d5a0..3c01f93 100755 --- a/bin/pkgdiffs +++ b/bin/pkgdiffs @@ -2,6 +2,9 @@ # pkgdiffs -- concatenate pkgdiffs +# +# To amend an existing patch, specify -a. +# [ x"$1" = "-a" ] || pkgdiff "${1%.orig}" shift diff --git a/bin/savepatch b/bin/savepatch index f4c2bd6..2a6cec9 100755 --- a/bin/savepatch +++ b/bin/savepatch @@ -1,29 +1,17 @@ #!/bin/sh -# savepatch -- save patch on standard in to ~/patches - -root=/home/john/patches +# savepatch -- save patch on standard in if [ -z "$1" ]; then echo "usage: ${0##*/} patch-name" 1>&2 exit 1 fi -case "$PWD" in -/usr/pkgsrc/*) dir=$(pwd | cut -d/ -f4,5) || dir= ;; -/usr/*src/*) dir=${PWD#/usr/} ;; -*) dir= -esac - -if [ -z "$dir" ]; then - echo "${0##*/}: could not determine package" 1>&2 - printf "package: " 1>&2 - read dir &2 read ans "$root/$dir/$1" -echo "$root/$dir/$1" +cat > "$dir/$1" +echo "$dir/$1" diff --git a/bin/whereispatch b/bin/whereispatch new file mode 100755 index 0000000..1eea64a --- /dev/null +++ b/bin/whereispatch @@ -0,0 +1,20 @@ +#!/bin/sh + +# whereispatch -- print corresponding patch directory + +root=/home/john/patches + +case "$PWD" in +/usr/pkgsrc/*) dir=$(pwd | cut -d/ -f4,5) || dir= ;; +/usr/*src/*) dir=${PWD#/usr/} ;; +*) dir= +esac + +if [ -z "$dir" ]; then + echo "${0##*/}: could not determine package" 1>&2 + [ x"$1" = x"-i" ] || exit 1 + printf "package: " 1>&2 + read dir