blob: 0300663fb58988788322b9068b980125e6225080 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/sh
# whereispatch -- print corresponding patch directory
IFS='
'
: ${PATCHROOT:=/home/$USER/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 </dev/tty
fi
dir=${dir%/*.pkgwcp}
dir=$PATCHROOT/$dir
n=0
for parts in $dir; do : $((n++)); done
if [ $n -gt 1 ]; then
echo "${0##*/}: newlines in patch path" 1>&2
exit 1
fi
echo $dir
|