summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tlpdb-check
blob: a91cf6496fcb1bba24256388dba617921cee4f3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# $Id$
# Copyright 2007 Karl Berry
# This file is licensed under the GNU General Public License version 2
# or any later version.
# 
# Check that tlpdb contains all the files in the trees, exactly once.
# also that collections don't have files.

cd `dirname $0`/../.. || exit 1

tlpdb=tlpkg/texlive.tlpdb

if test ! -s $tlpdb; then
  echo "$0: no (nonempty) $tlpdb in $0, goodbye." >&2
  exit 1
fi

: ${TMPDIR=/tmp}
trap "rm -f $TMPDIR/tlpdb*" 0 1 2 15

# Get list of files.
tlpdbfiles=$TMPDIR/tlpdbfiles.$$
grep '^ ' $tlpdb | sort >$tlpdbfiles

echo "$0: checking duplicates..."
# GNU uniq makes it simple.
uniq --repeated $tlpdbfiles

echo "$0: checking coverage...(long)"
dirs=bin
diskfiles=$TMPDIR/tlpdbdisk.$$
find $dirs -name .svn -prune -o \( \( -type f -o -type l \) -print \) | sed 's/^/ /' | sort | tee /tmp/x >$diskfiles

comm -3 $tlpdbfiles $diskfiles