t / lib-gpg.shon commit Merge branch 'da/difftool-mergetool-simplify-reporting-status' (0ddedd4)
   1#!/bin/sh
   2
   3gpg_version=$(gpg --version 2>&1)
   4if test $? = 127; then
   5        say "You do not seem to have gpg installed"
   6else
   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        *)
  15                # key generation info: gpg --homedir t/lib-gpg --gen-key
  16                # Type DSA and Elgamal, size 2048 bits, no expiration date.
  17                # Name and email: C O Mitter <committer@example.com>
  18                # No password given, to enable non-interactive operation.
  19                cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
  20                chmod 0700 gpghome
  21                chmod 0600 gpghome/*
  22                GNUPGHOME="$(pwd)/gpghome"
  23                export GNUPGHOME
  24                test_set_prereq GPG
  25                ;;
  26        esac
  27fi
  28
  29sanitize_pgp() {
  30        perl -ne '
  31                /^-----END PGP/ and $in_pgp = 0;
  32                print unless $in_pgp;
  33                /^-----BEGIN PGP/ and $in_pgp = 1;
  34        '
  35}