NetBSD/distrib/sets/checkflist

88 lines
1.3 KiB
Bash
Executable File

#! /bin/sh --
#
# $NetBSD: checkflist,v 1.15 2002/07/09 16:08:38 lukem Exp $
#
# Verify output of makeflist against contents of $DESTDIR.
if [ -z "$DESTDIR" ]; then
echo "DESTDIR must be set"
exit 1
fi
prog=${0##*/}
origin=.
tmpname=/tmp/_CHECK.$$
xargs=""
dargs=""
diffargs=""
findargs=
metalog=
# handle args
while : ; do
case $1 in
-x11)
xargs="-x"
origin=./usr/X11R6
;;
-both)
xargs="-b"
;;
-u)
diffargs="-u"
;;
-c)
diffargs="-c"
;;
-M*)
metalog=$2; shift
;;
-*)
cat 1>&2 <<USAGE
Usage: ${prog} [-x11|-both] [-u|-c] [-M metalog]
-x11 check only x11 lists
-both check netbsd + x11 lists
-u output differences in "unified diff" style
-c output differences in "context diff" style
-M metalog metalog file
USAGE
exit 1
;;
*)
break
;;
esac
shift
done
if [ -n "$metalog" ]; then
case "$metalog" in
${DESTDIR}/*)
findargs="! -path ./${metalog#${DESTDIR}/} -a"
;;
esac
fi
sh makeflist $xargs $dargs > $tmpname
(
cd $DESTDIR
find $origin $findargs \( -type d -o -type f -o -type l \)
) | sort | diff $diffargs $tmpname -
rv=$?
/bin/rm -f $tmpname
if [ $rv -ne 0 ]; then
echo "${prog}: flist inconsistencies found"
if [ -z "$diffargs" ]; then
echo "${prog}: key to output:"
echo " < file in flist but missing from DESTDIR"
echo " > file in DESTDIR but missing from flist"
fi
fi
exit $rv