Home | History | Annotate | Line # | Download | only in sets
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 
      7 if [ -z "$DESTDIR" ]; then
      8 	echo "DESTDIR must be set"
      9 	exit 1
     10 fi
     11 
     12 prog=${0##*/}
     13 
     14 origin=.
     15 tmpname=/tmp/_CHECK.$$
     16 
     17 xargs=""
     18 dargs=""
     19 diffargs=""
     20 findargs=
     21 metalog=
     22 
     23 # handle args
     24 while : ; 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
     44 Usage: ${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
     50 USAGE
     51 		exit 1
     52 		;;
     53 	*)
     54 		break
     55 		;;
     56 	esac
     57 	shift
     58 done
     59 
     60 if [ -n "$metalog" ]; then
     61 	case "$metalog" in
     62 	${DESTDIR}/*)
     63 		findargs="! -path ./${metalog#${DESTDIR}/} -a"
     64 		;;
     65 	esac
     66 fi
     67 
     68 
     69 sh 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 -
     75 rv=$?
     76 
     77 /bin/rm -f $tmpname
     78 
     79 if [ $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
     86 fi
     87 exit $rv
     88