NetBSD/distrib/sets/checkflist

97 lines
1.6 KiB
Bash
Executable File

#! /bin/sh --
#
# $NetBSD: checkflist,v 1.18 2003/03/01 07:31:35 tron 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=""
metalog=
# handle args
while : ; do
case $1 in
-x11)
xargs="-x"
origin="./etc/X11 ./etc/fonts ./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}/*)
# Metalog would be noticed, so make sure it gets
# ignored.
metalog="./${metalog#${DESTDIR}/}"
;;
*)
metalog=""
esac
fi
sh makeflist $xargs $dargs > $tmpname
(
cd $DESTDIR
find $origin \( -type d -o -type f -o -type l \)
) | (
while read line; do
test "$metalog" = "$line" || echo $line
done
) | 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 is in flist but missing from DESTDIR"
echo " (file wasn't installed ?)"
echo " > file is in DESTDIR but missing from flist"
echo " (file is obsolete or flist is out of date ?)"
fi
fi
exit $rv