]>
Commit | Line | Data |
---|---|---|
37d3e859 JK |
1 | #!/bin/sh |
2 | ||
be194d53 | 3 | gpg_version=$(gpg --version 2>&1) |
37d3e859 JK |
4 | if test $? = 127; then |
5 | say "You do not seem to have gpg installed" | |
6 | else | |
7 | # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19 | |
8 | # the gpg version 1.0.6 didn't parse trust packets correctly, so for | |
9 | # that version, creation of signed tags using the generated key fails. | |
10 | case "$gpg_version" in | |
11 | 'gpg (GnuPG) 1.0.6'*) | |
12 | say "Your version of gpg (1.0.6) is too buggy for testing" | |
13 | ;; | |
14 | *) | |
6fb5df6c CH |
15 | # Available key info: |
16 | # * Type DSA and Elgamal, size 2048 bits, no expiration date, | |
17 | # name and email: C O Mitter <committer@example.com> | |
18 | # * Type RSA, size 2048 bits, no expiration date, | |
19 | # name and email: Eris Discordia <discord@example.net> | |
37d3e859 | 20 | # No password given, to enable non-interactive operation. |
6fb5df6c CH |
21 | # To generate new key: |
22 | # gpg --homedir /tmp/gpghome --gen-key | |
23 | # To write armored exported key to keyring: | |
24 | # gpg --homedir /tmp/gpghome --export-secret-keys \ | |
25 | # --armor 0xDEADBEEF >> lib-gpg/keyring.gpg | |
830ff021 JK |
26 | # gpg --homedir /tmp/gpghome --export \ |
27 | # --armor 0xDEADBEEF >> lib-gpg/keyring.gpg | |
6fb5df6c CH |
28 | # To export ownertrust: |
29 | # gpg --homedir /tmp/gpghome --export-ownertrust \ | |
30 | # > lib-gpg/ownertrust | |
4b0bf39d JH |
31 | mkdir ./gpghome && |
32 | chmod 0700 ./gpghome && | |
33 | GNUPGHOME="$(pwd)/gpghome" && | |
34 | export GNUPGHOME && | |
35 | gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \ | |
36 | "$TEST_DIRECTORY"/lib-gpg/keyring.gpg && | |
37 | gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \ | |
38 | "$TEST_DIRECTORY"/lib-gpg/ownertrust && | |
37d3e859 JK |
39 | test_set_prereq GPG |
40 | ;; | |
41 | esac | |
42 | fi | |
e2b23972 | 43 | |
4b0bf39d JH |
44 | if test_have_prereq GPG && |
45 | echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1 | |
46 | then | |
47 | test_set_prereq RFC1991 | |
48 | fi | |
49 | ||
e2b23972 MG |
50 | sanitize_pgp() { |
51 | perl -ne ' | |
52 | /^-----END PGP/ and $in_pgp = 0; | |
53 | print unless $in_pgp; | |
54 | /^-----BEGIN PGP/ and $in_pgp = 1; | |
55 | ' | |
56 | } |