| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# Helper for signing images |
| 4 |
# |
| 5 |
DIR=$1 |
| 6 |
ARCH=$2 |
| 7 |
|
| 8 |
KEYID=42468F4009EA8AC3 |
| 9 |
|
| 10 |
cd $DIR/$ARCH |
| 11 |
|
| 12 |
# Sigh. GPG2 needs a different command line :-( |
| 13 |
# Try to detect what we have |
| 14 |
gpg --help | grep -q "server mode" |
| 15 |
if [ $? -eq 0 ] ; then |
| 16 |
GPG2_OPTS=" --pinentry-mode=loopback" |
| 17 |
fi |
| 18 |
|
| 19 |
for file in $(find . -name '*SUMS' \ |
| 20 |
-o -name *SUMS.small \ |
| 21 |
-o -name *SUMS.large); do |
| 22 |
gpg -q -a --detach-sign \ |
| 23 |
$GPG2_OPTS \ |
| 24 |
--batch --no-tty \ |
| 25 |
--passphrase-file ~/.testing-pass \ |
| 26 |
-u $KEYID \ |
| 27 |
$file 2>&1 > gpg.log |
| 28 |
error=$? |
| 29 |
if [ $error -ne 0 ] ; then |
| 30 |
echo " FAIL:" |
| 31 |
cat gpg.log |
| 32 |
exit 1 |
| 33 |
fi |
| 34 |
mv $file.asc $file.sign > gpg.log 2>&1 |
| 35 |
if [ $error -ne 0 ] ; then |
| 36 |
echo " FAIL:" |
| 37 |
cat gpg.log |
| 38 |
exit 1 |
| 39 |
fi |
| 40 |
done |
| 41 |
|
| 42 |
rm -f gpg.log |