]> git.decadent.org.uk Git - dak.git/blob - scripts/debian/buildd-prepare-dir
use a special signing key instead
[dak.git] / scripts / debian / buildd-prepare-dir
1 #!/bin/bash
2 # No way I try to deal with a crippled sh just for POSIX foo.
3
4 # Copyright (C) 2011 Joerg Jaspert <joerg@debian.org>
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; version 2.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19
20 # exit on errors
21 set -e
22 # make sure to only use defined variables
23 set -u
24 # ERR traps should be inherited from functions too.
25 set -E
26
27 # import the general variable set.
28 export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
29 . $SCRIPTVARS
30
31 umask 027
32
33 # And use one locale, no matter what the caller has set
34 export LANG=C
35 export LC_ALL=C
36 PROGRAM="buildd-prepare-dir"
37
38 # common functions are "outsourced"
39 . "${configdir}/common"
40
41 # should be relative to the general base dir later
42 COPYTARGET="${base}/keyrings"
43 GNUPGHOME="${base}/s3kr1t/dot-gnupg"
44 base="${base}/scripts/builddkeyrings"
45 TARGET="${base}/keyrings"
46 REMOVED="${base}/removed-buildd-keys.gpg"
47
48 mkdir -p "${TARGET}/keyrings"
49
50 for arch in $archs; do
51     if [ -f ${base}/${arch}/keyring.gpg ]; then
52         cp -al ${base}/${arch}/keyring.gpg ${TARGET}/keyrings/buildd-${arch}-keyring.gpg
53         chmod 0644 ${TARGET}/keyrings/buildd-${arch}-keyring.gpg
54     fi
55 done
56
57 cd ${TARGET}
58 sha512sum keyrings/* > sha512sums
59
60 rm -f ${TARGET}/sha512sums.txt
61 SIGNINGKEY=B1326A8D
62 GNUPGHOME=${GNUPGHOME} gpg --no-options  --batch --no-tty --armour --default-key ${SIGNINGKEY} --clearsign -o "${TARGET}/sha512sums.txt" "${TARGET}/sha512sums"
63 rm -f ${TARGET}/sha512sums