1997-02-18 09:58:56 +03:00
|
|
|
#! /bin/sh --
|
|
|
|
#
|
2003-08-13 04:03:00 +04:00
|
|
|
# $NetBSD: checkflist,v 1.21 2003/08/13 00:03:00 lukem Exp $
|
1997-02-18 09:58:56 +03:00
|
|
|
#
|
|
|
|
# Verify output of makeflist against contents of $DESTDIR.
|
1994-08-29 19:21:02 +04:00
|
|
|
|
2002-07-09 20:08:38 +04:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
|
|
|
echo "DESTDIR must be set"
|
1994-08-29 19:21:02 +04:00
|
|
|
exit 1
|
2002-07-09 20:08:38 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
prog=${0##*/}
|
1994-08-29 19:21:02 +04:00
|
|
|
|
1998-07-22 21:01:43 +04:00
|
|
|
|
2003-08-12 08:20:08 +04:00
|
|
|
# Make sure we don't loop forever if mkdir will always fail.
|
|
|
|
if [ ! -d /tmp ]; then
|
|
|
|
echo /tmp is not a directory
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -w /tmp ]; then
|
|
|
|
echo /tmp is not writable
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
SDIR_BASE=/tmp/checkflist.$$
|
|
|
|
SDIR_SERIAL=0
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
SDIR=${SDIR_BASE}.${SDIR_SERIAL}
|
|
|
|
mkdir -m 0700 ${SDIR} && break
|
|
|
|
SDIR_SERIAL=$((${SDIR_SERIAL} + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
es=0
|
|
|
|
cleanup()
|
|
|
|
{
|
|
|
|
/bin/rm -rf $SDIR
|
|
|
|
if [ $es -gt 255 ] ; then
|
|
|
|
es=255
|
|
|
|
fi
|
|
|
|
exit $es
|
|
|
|
}
|
|
|
|
trap cleanup 0 2 3 13 # EXIT INT QUIT PIPE
|
|
|
|
|
|
|
|
|
|
|
|
origin=.
|
1998-07-22 21:01:43 +04:00
|
|
|
xargs=""
|
|
|
|
dargs=""
|
2002-07-09 20:08:38 +04:00
|
|
|
metalog=
|
1998-07-22 21:01:43 +04:00
|
|
|
|
|
|
|
# handle args
|
|
|
|
while : ; do
|
|
|
|
case $1 in
|
|
|
|
-x11)
|
|
|
|
xargs="-x"
|
2003-03-01 10:31:35 +03:00
|
|
|
origin="./etc/X11 ./etc/fonts ./usr/X11R6"
|
1998-07-22 21:01:43 +04:00
|
|
|
;;
|
|
|
|
-both)
|
|
|
|
xargs="-b"
|
|
|
|
;;
|
2002-07-09 20:08:38 +04:00
|
|
|
-M*)
|
|
|
|
metalog=$2; shift
|
|
|
|
;;
|
1998-07-22 21:01:43 +04:00
|
|
|
-*)
|
|
|
|
cat 1>&2 <<USAGE
|
2003-08-12 08:20:08 +04:00
|
|
|
Usage: ${prog} [-x11|-both] [-M metalog]
|
1998-07-22 21:01:43 +04:00
|
|
|
-x11 check only x11 lists
|
|
|
|
-both check netbsd + x11 lists
|
2002-07-09 20:08:38 +04:00
|
|
|
-M metalog metalog file
|
1998-07-22 21:01:43 +04:00
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2002-07-09 20:08:38 +04:00
|
|
|
if [ -n "$metalog" ]; then
|
|
|
|
case "$metalog" in
|
|
|
|
${DESTDIR}/*)
|
2002-09-17 03:04:39 +04:00
|
|
|
# Metalog would be noticed, so make sure it gets
|
|
|
|
# ignored.
|
|
|
|
metalog="./${metalog#${DESTDIR}/}"
|
2002-07-09 20:08:38 +04:00
|
|
|
;;
|
2002-09-17 03:04:39 +04:00
|
|
|
*)
|
|
|
|
metalog=""
|
2002-07-09 20:08:38 +04:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2003-08-12 08:20:08 +04:00
|
|
|
sh makeflist $xargs $dargs > $SDIR/flist
|
1998-07-22 21:01:43 +04:00
|
|
|
|
2002-07-09 20:08:38 +04:00
|
|
|
(
|
|
|
|
cd $DESTDIR
|
2002-09-17 03:04:39 +04:00
|
|
|
find $origin \( -type d -o -type f -o -type l \)
|
|
|
|
) | (
|
|
|
|
while read line; do
|
2003-07-10 07:19:15 +04:00
|
|
|
case "$line" in
|
|
|
|
$metalog)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $line
|
|
|
|
;;
|
|
|
|
esac
|
2002-09-17 03:04:39 +04:00
|
|
|
done
|
2003-08-12 08:20:08 +04:00
|
|
|
) | sort > $SDIR/files
|
|
|
|
|
|
|
|
comm -23 $SDIR/flist $SDIR/files > $SDIR/missing
|
|
|
|
comm -13 $SDIR/flist $SDIR/files > $SDIR/extra
|
|
|
|
|
|
|
|
if [ -s $SDIR/extra ]; then
|
|
|
|
echo ""
|
|
|
|
echo "============ extra files ==============="
|
|
|
|
echo "Files in DESTDIR but missing from flist."
|
|
|
|
echo "File is obsolete or flist is out of date ?"
|
|
|
|
echo "------------------------------------------"
|
|
|
|
cat $SDIR/extra
|
|
|
|
echo "========= end of extra files ==========="
|
|
|
|
echo ""
|
2003-08-13 04:03:00 +04:00
|
|
|
es=1
|
2002-07-09 20:08:38 +04:00
|
|
|
fi
|
2003-08-12 08:20:08 +04:00
|
|
|
|
|
|
|
if [ -s $SDIR/missing ]; then
|
|
|
|
echo ""
|
|
|
|
echo "=========== missing files =============="
|
|
|
|
echo "Files in flist but missing from DESTDIR."
|
|
|
|
echo "File wasn't installed ?"
|
|
|
|
echo "------------------------------------------"
|
|
|
|
cat $SDIR/missing
|
|
|
|
echo "======== end of missing files =========="
|
|
|
|
echo ""
|
|
|
|
es=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0 # cleanup will exit with $es
|