1997-02-18 09:58:56 +03:00
|
|
|
#! /bin/sh --
|
|
|
|
#
|
2004-01-08 04:31:57 +03:00
|
|
|
# $NetBSD: checkflist,v 1.25 2004/01/08 01:31:57 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
|
|
|
|
2003-12-29 06:13:25 +03:00
|
|
|
: ${HOST_SH=sh}
|
2003-09-30 10:23:43 +04:00
|
|
|
: ${MKTEMP=mktemp}
|
|
|
|
SDIR=$(${MKTEMP} -d /tmp/${prog}.XXXXXX)
|
2003-08-12 08:20:08 +04:00
|
|
|
|
|
|
|
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=
|
2003-09-30 10:23:43 +04:00
|
|
|
allowextra=false
|
|
|
|
allowmissing=false
|
1998-07-22 21:01:43 +04:00
|
|
|
|
|
|
|
# handle args
|
2003-12-29 06:13:25 +03:00
|
|
|
while getopts xbM:em ch; do
|
|
|
|
case ${ch} in
|
|
|
|
x)
|
1998-07-22 21:01:43 +04:00
|
|
|
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
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
b)
|
1998-07-22 21:01:43 +04:00
|
|
|
xargs="-b"
|
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
M)
|
|
|
|
metalog=${OPTARG}
|
2002-07-09 20:08:38 +04:00
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
e)
|
2003-09-30 10:23:43 +04:00
|
|
|
allowextra=true
|
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
m)
|
2003-09-30 10:23:43 +04:00
|
|
|
allowmissing=true
|
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
*)
|
1998-07-22 21:01:43 +04:00
|
|
|
cat 1>&2 <<USAGE
|
2003-12-29 06:13:25 +03:00
|
|
|
Usage: ${prog} [-x|-b] [-M metalog] [-e] [-m]
|
|
|
|
-x check only x11 lists
|
|
|
|
-b check netbsd + x11 lists
|
2002-07-09 20:08:38 +04:00
|
|
|
-M metalog metalog file
|
2003-09-30 10:23:43 +04:00
|
|
|
-e extra files are not considered an error
|
|
|
|
-m missing files are not considered an error
|
1998-07-22 21:01:43 +04:00
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2003-12-29 06:13:25 +03:00
|
|
|
shift $((${OPTIND} - 1))
|
1998-07-22 21:01:43 +04:00
|
|
|
|
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-12-29 06:13:25 +03:00
|
|
|
${HOST_SH} ./makeflist $xargs $dargs > $SDIR/flist
|
1998-07-22 21:01:43 +04:00
|
|
|
|
2002-07-09 20:08:38 +04:00
|
|
|
(
|
|
|
|
cd $DESTDIR
|
2003-10-26 17:21:49 +03:00
|
|
|
find $origin \( -type d -o -type f -o -type l \) -print
|
2002-09-17 03:04:39 +04:00
|
|
|
) | (
|
|
|
|
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
|
2004-01-08 04:31:57 +03:00
|
|
|
count=$(awk 'END {print NR}' $SDIR/extra)
|
2003-08-12 08:20:08 +04:00
|
|
|
echo ""
|
2004-01-08 04:31:57 +03:00
|
|
|
echo "============ ${count} extra files ==============="
|
2003-08-12 08:20:08 +04:00
|
|
|
echo "Files in DESTDIR but missing from flist."
|
|
|
|
echo "File is obsolete or flist is out of date ?"
|
2003-09-30 10:23:43 +04:00
|
|
|
if ${allowextra}; then
|
|
|
|
echo "This is non-fatal."
|
|
|
|
else
|
|
|
|
es=1
|
|
|
|
fi
|
2003-08-12 08:20:08 +04:00
|
|
|
echo "------------------------------------------"
|
|
|
|
cat $SDIR/extra
|
2004-01-08 04:31:57 +03:00
|
|
|
echo "========= end of ${count} extra files ==========="
|
2003-08-12 08:20:08 +04:00
|
|
|
echo ""
|
2002-07-09 20:08:38 +04:00
|
|
|
fi
|
2003-08-12 08:20:08 +04:00
|
|
|
|
|
|
|
if [ -s $SDIR/missing ]; then
|
2004-01-08 04:31:57 +03:00
|
|
|
count=$(awk 'END {print NR}' $SDIR/missing)
|
2003-08-12 08:20:08 +04:00
|
|
|
echo ""
|
2004-01-08 04:31:57 +03:00
|
|
|
echo "=========== ${count} missing files =============="
|
2003-08-12 08:20:08 +04:00
|
|
|
echo "Files in flist but missing from DESTDIR."
|
|
|
|
echo "File wasn't installed ?"
|
2003-09-30 10:23:43 +04:00
|
|
|
if ${allowmissing}; then
|
|
|
|
echo "This is non-fatal."
|
|
|
|
else
|
|
|
|
es=1
|
|
|
|
fi
|
2003-08-12 08:20:08 +04:00
|
|
|
echo "------------------------------------------"
|
|
|
|
cat $SDIR/missing
|
2004-01-08 04:31:57 +03:00
|
|
|
echo "======== end of ${count} missing files =========="
|
2003-08-12 08:20:08 +04:00
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0 # cleanup will exit with $es
|