Debian Codegraph @

contrib/merge-sums

raw
1 #!/bin/bash
2
3 export LANG=C
4 export LC_ALL=C
5
6 if [ "$1"x = ""x ] ; then
7 echo "$0: tell me which dir to target!"
8 echo "abort"
9 exit 1
10 fi
11
12 CHECK=`ls -al $1/*/iso-* 2>/dev/null`
13 if [ "$CHECK"x = ""x ] ; then
14 echo "$0: could not find stuff to work on in $1"
15 echo "abort"
16 exit 1
17 fi
18
19 echo "$0: Merging checksum files"
20
21 for DIR in $1/*/*-*; do
22 cd $DIR
23 # Check that we have checksums in this dir, and which ones
24 CHECK=`ls -1 *SUMS.* 2>/dev/null | sed 's/SUMS\..*$/SUMS/' | sort -u`
25 if [ "$CHECK"x != ""x ] ; then
26 for SUM in $CHECK; do
27 cat $SUM.* | sort -k2 | uniq > $SUM
28 rm $SUM.*
29 done
30 echo " $DIR OK"
31 else
32 echo " IGNORING $DIR: no checksum files"
33 fi
34 done