aboutsummaryrefslogtreecommitdiff
path: root/slackpkgdiff
blob: d6aca0464d8fc33f29e986cdbdabc8111b928327 (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
return "$ret"