aboutsummaryrefslogtreecommitdiff
path: root/bin/pkgdiffex
blob: 9cc1116ec3ba9f65d7e4c9667c1999775c274c0a (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
33
34
35
#!/bin/sh

# pkgdiffex -- diff files against existing patches

if [ $# -eq 0 ]; then
	echo "usage: ${0##*/} file ..." 1>&2
	exit 1
fi

i=0
while [ $((++i)) -le $# ]; do
	o=${1%.orig}.orig
	if [ ! -f "$o" ]; then
		echo "${0##*/}: file $o does not exist" 1>&2
		exit 1
	fi
	shift
	set -- "$@" "$o"
done

for o in "$@"; do
	mv "${o%.orig}" "${o%.orig}".new		# f -> f.new
	cp "$o" "$o"inal				# f.orig +> f.original
	cp "$o" "${o%.orig}"				# f.orig +> f
done

pkgpatchex

echo '$NetBSD$'
for o in "$@"; do
	mv "${o%.orig}" "$o"				# f -> f.orig
	mv "${o%.orig}".new "${o%.orig}"		# f.new -> f
	pkgdiff "${o%.orig}" | sed -n '2,$p'
	mv "$o"inal "$o"				# f.original -> f.orig
done