checkflist revision 1.15
1#! /bin/sh --
2#
3#	$NetBSD: checkflist,v 1.15 2002/07/09 16:08:38 lukem Exp $
4#
5# Verify output of makeflist against contents of $DESTDIR.
6
7if [ -z "$DESTDIR" ]; then
8	echo "DESTDIR must be set"
9	exit 1
10fi
11
12prog=${0##*/}
13
14origin=.
15tmpname=/tmp/_CHECK.$$
16
17xargs=""
18dargs=""
19diffargs=""
20findargs=
21metalog=
22
23# handle args
24while : ; do
25	case $1 in
26	-x11)
27		xargs="-x"
28		origin=./usr/X11R6
29		;;
30	-both)
31		xargs="-b"
32		;;
33	-u)
34		diffargs="-u"
35		;;
36	-c)
37		diffargs="-c"
38		;;
39	-M*)
40		metalog=$2; shift
41		;;
42	-*)
43		cat 1>&2 <<USAGE
44Usage: ${prog} [-x11|-both] [-u|-c] [-M metalog]
45	-x11		check only x11 lists
46	-both		check netbsd + x11 lists
47	-u		output differences in "unified diff" style
48	-c		output differences in "context diff" style
49	-M metalog	metalog file
50USAGE
51		exit 1
52		;;
53	*)
54		break
55		;;
56	esac
57	shift
58done
59
60if [ -n "$metalog" ]; then
61	case "$metalog" in
62	${DESTDIR}/*)
63		findargs="! -path ./${metalog#${DESTDIR}/} -a"
64		;;
65	esac
66fi
67
68
69sh makeflist $xargs $dargs > $tmpname
70
71(
72	cd $DESTDIR
73	find $origin $findargs \( -type d -o -type f -o -type l \)
74) | sort | diff $diffargs $tmpname -
75rv=$?
76
77/bin/rm -f $tmpname
78
79if [ $rv -ne 0 ]; then
80	echo "${prog}: flist inconsistencies found"
81	if [ -z "$diffargs" ]; then
82		echo "${prog}: key to output:"
83		echo "  <  file in flist but missing from DESTDIR"
84		echo "  >  file in DESTDIR but missing from flist"
85	fi
86fi
87exit $rv
88