File: sign-images

package info (click to toggle)
debian-cd 3.2.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,848 kB
  • sloc: sh: 6,129; perl: 4,129; makefile: 413
file content (42 lines) | stat: -rwxr-xr-x 803 bytes parent folder | download | duplicates (5)
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
37
38
39
40
41
42
#!/bin/bash
#
# Helper for signing images
#
DIR=$1
ARCH=$2

KEYID=42468F4009EA8AC3

cd $DIR/$ARCH

# Sigh. GPG2 needs a different command line :-(
# Try to detect what we have
gpg --help | grep -q "server mode"
if [ $? -eq 0 ] ; then
    GPG2_OPTS="	--pinentry-mode=loopback"
fi

for file in $(find . -name '*SUMS' \
    -o -name *SUMS.small \
    -o -name *SUMS.large); do
    gpg -q -a --detach-sign \
	$GPG2_OPTS \
	--batch --no-tty \
        --passphrase-file ~/.testing-pass \
        -u $KEYID \
        $file 2>&1 > gpg.log
    error=$?
    if [ $error -ne 0 ] ; then  
        echo "  FAIL:"
        cat gpg.log
        exit 1
    fi
    mv $file.asc $file.sign > gpg.log 2>&1
    if [ $error -ne 0 ] ; then  
        echo "  FAIL:"
        cat gpg.log
        exit 1
    fi
done

rm -f gpg.log