aboutsummaryrefslogtreecommitdiff
path: root/slackpkgdiff
blob: dd1aee805b82995523bc456dcdcffc3f385487f4 (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
#!/bin/bash

# compare filenames in 2 tarballs, except /usr/doc/blah-<version> dirs
# get treated specially.

if [ "$1" = "--help" ]; then
	cat <<EOF
slackpkgdiff - compare contents of 2 Slackware packages without installing them
Usage: slackpkgdiff pkg1 pkg2
EOF
fi

pkg_name() {
	echo "$1" | sed 's,.*/,,' | sed 's,\.[^.]*$,,'
}

list_tar() {
	pkg="$( echo $1 | sed 's,\.[^.]*,,' )"
	tar tf "$1" | sed 's,usr/doc/[^/]*/,usr/doc/@DOCDIR@/,' | sort > $DIR/$( pkg_name "$1" )
}

DIR=/tmp/pkgdiff.$RANDOM.$$
mkdir -p $DIR || exit 1
list_tar "$1"
list_tar "$2"
diff $DIR/$( pkg_name "$1" ) $DIR/$( pkg_name "$2" )
ret="$?"
rm -rf $DIR
exit "$ret"