1 #! /bin/sh -- 2 # 3 # $NetBSD: checkflist,v 1.17 2002/09/16 23:04:39 thorpej 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 metalog= 21 22 # handle args 23 while : ; do 24 case $1 in 25 -x11) 26 xargs="-x" 27 origin=./usr/X11R6 28 ;; 29 -both) 30 xargs="-b" 31 ;; 32 -u) 33 diffargs="-u" 34 ;; 35 -c) 36 diffargs="-c" 37 ;; 38 -M*) 39 metalog=$2; shift 40 ;; 41 -*) 42 cat 1>&2 <<USAGE 43 Usage: ${prog} [-x11|-both] [-u|-c] [-M metalog] 44 -x11 check only x11 lists 45 -both check netbsd + x11 lists 46 -u output differences in "unified diff" style 47 -c output differences in "context diff" style 48 -M metalog metalog file 49 USAGE 50 exit 1 51 ;; 52 *) 53 break 54 ;; 55 esac 56 shift 57 done 58 59 if [ -n "$metalog" ]; then 60 case "$metalog" in 61 ${DESTDIR}/*) 62 # Metalog would be noticed, so make sure it gets 63 # ignored. 64 metalog="./${metalog#${DESTDIR}/}" 65 ;; 66 *) 67 metalog="" 68 esac 69 fi 70 71 72 sh makeflist $xargs $dargs > $tmpname 73 74 ( 75 cd $DESTDIR 76 find $origin \( -type d -o -type f -o -type l \) 77 ) | ( 78 while read line; do 79 test "$metalog" = "$line" || echo $line 80 done 81 ) | sort | diff $diffargs $tmpname - 82 rv=$? 83 84 /bin/rm -f $tmpname 85 86 if [ $rv -ne 0 ]; then 87 echo "${prog}: flist inconsistencies found" 88 if [ -z "$diffargs" ]; then 89 echo "${prog}: key to output:" 90 echo " < file is in flist but missing from DESTDIR" 91 echo " (file wasn't installed ?)" 92 echo " > file is in DESTDIR but missing from flist" 93 echo " (file is obsolete or flist is out of date ?)" 94 fi 95 fi 96 exit $rv 97