~ubuntu-branches/ubuntu/precise/gnupg2/precise-proposed

« back to all changes in this revision

Viewing changes to tests/pkits/inittests

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Mueller
  • Date: 2005-03-29 10:30:32 UTC
  • Revision ID: james.westby@ubuntu.com-20050329103032-sj42n2ain3ipx310
Tags: upstream-1.9.15
ImportĀ upstreamĀ versionĀ 1.9.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#       Copyright (C) 2004 Free Software Foundation, Inc.  -*- sh -*-
 
3
#
 
4
# This file is free software; as a special exception the author gives
 
5
# unlimited permission to copy and/or distribute it, with or without
 
6
# modifications, as long as this notice is preserved.
 
7
#
 
8
# This file is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 
10
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
11
 
 
12
set -e
 
13
 
 
14
 
 
15
clean_files='
 
16
ReadMe.txt pkits.ldif
 
17
gpgsm.conf gpg-agent.conf trustlist.txt policies.txt pubring.kbx
 
18
msg msg.sig msg.unsig
 
19
'
 
20
 
 
21
[ -z "$srcdir" ] && srcdir=.
 
22
[ -z "$GPGSM" ] && GPGSM=../../sm/gpgsm
 
23
 
 
24
if [ -f $srcdir/README ] \
 
25
   && grep tests/pkits/README README >/dev/null 2>&1; then
 
26
 :
 
27
else
 
28
   # During make distclean the Makefile has already been removed,
 
29
   # so we need this extra test.
 
30
   if ! grep gnupg-test-pkits-directory testdir.stamp >/dev/null 2>&1; then
 
31
      echo "inittests: please cd to the tests/pkits directory first" >&2
 
32
      exit 1
 
33
   fi
 
34
fi
 
35
 
 
36
if [ "$1" = "--clean" ]; then
 
37
    if [ -d private-keys-v1.d ]; then
 
38
       rm private-keys-v1.d/* 2>/dev/null || true
 
39
       rmdir private-keys-v1.d
 
40
    fi
 
41
    rm ${clean_files} testdir.stamp 2>/dev/null || true
 
42
    for i in certs certpairs crls pkcs12 smime; do 
 
43
        if [ -d $i ]; then
 
44
            rm $i/* 2>/dev/null || true
 
45
            rmdir $i
 
46
        fi
 
47
    done
 
48
    exit 0
 
49
fi
 
50
 
 
51
if [ "$GNUPGHOME" != "`pwd`" ]; then
 
52
    echo "inittests: please set GNUPGHOME to the tests/pkits directory" >&2
 
53
    exit 1
 
54
fi
 
55
 
 
56
if [ -n "$GPG_AGENT_INFO" ]; then
 
57
    echo "inittests: please unset GPG_AGENT_INFO" >&2
 
58
    exit 1
 
59
fi
 
60
 
 
61
if ! bunzip2 -c PKITS_data.tar.bz2 | tar xf - ; then
 
62
    echo "inittests: failed to untar the test data" >&2
 
63
    exit 1
 
64
fi    
 
65
 
 
66
 
 
67
# A stamp file used with --clean
 
68
echo gnupg-test-pkits-directory > testdir.stamp
 
69
 
 
70
 
 
71
# Create the configuration scripts
 
72
cat > gpgsm.conf <<EOF
 
73
no-secmem-warning
 
74
no-greeting
 
75
batch
 
76
disable-crl-checks
 
77
agent-program ../../agent/gpg-agent
 
78
EOF
 
79
 
 
80
# Fixme: we need to write a dummy pinentry program
 
81
cat > gpg-agent.conf <<EOF
 
82
no-grab
 
83
EOF
 
84
 
 
85
# Mark the root CA trusted
 
86
cat > trustlist.txt <<EOF
 
87
# /CN=Trust Anchor/O=Test Certificates/C=US
 
88
66:8A:47:56:A2:DC:88:FF:DA:B8:95:E1:3C:63:37:55:5F:0A:F7:BF S
 
89
EOF
 
90
 
 
91
# Define the standard policies as NIST test-policy-1
 
92
#cat >policies.txt <<EOF
 
93
#2.16.840.1.101.3.2.1.48.1
 
94
#EOF