]> git.decadent.org.uk Git - dak.git/blob - scripts/debian/generate-i18n-Index
only use .bz2 files in Index
[dak.git] / scripts / debian / generate-i18n-Index
1 #!/bin/bash
2 #
3 # Copyright (C) 2011, Ansgar Burchardt <ansgar@debian.org>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # On Debian systems, you can find the full text of the license in
11 # /usr/share/common-licenses/GPL-2
12
13 set -e
14 set -u
15 export LC_ALL=C
16
17 usage () {
18         echo "Usage: $0 <dist-directory>" >&2
19         exit 1
20 }
21
22 # Parse options
23 if [ $# != 1 ] ; then
24         usage
25 fi
26 if [ ! -d "$1" ] ; then
27         echo "$1 does not exist or is not a directory." >&2
28         usage
29 fi
30 if [ ! -d "$1"/main/i18n ] ; then
31         echo "No main/i18n directory in $1." >&2
32         usage
33 fi
34 cd "$1/main/i18n"
35
36 # If it's trapped, something bad happened.
37 trap_exit () {
38         rm -f Index
39         exit 1
40 }
41 trap trap_exit EXIT HUP INT QUIT TERM
42
43 exec 3>Index
44
45 echo "SHA1:" >&3
46 for file in Translation-*.bz2 ; do
47         sha=$(sha1sum "$file"); sha="${sha%% *}"
48         size=$(stat -c %s "${file}")
49         printf ' %s % 7s %s\n' "$sha" "$size" "$file" >&3
50 done
51
52 exec 3>&-
53
54 trap - EXIT