chiark / gitweb /
gnupg2 (2.1.17-3) unstable; urgency=medium
[gnupg2.git] / debian / tests / gpgv-win32
1 #!/bin/sh
2
3 set -e
4
5 export GNUPGHOME=$(mktemp -d)
6
7 arch=$(dpkg --print-architecture)
8
9 case "$arch" in
10     amd64)
11         if ! dpkg --print-foreign-architectures | grep -Fqx i386; then
12             echo "I: setting up multiarch"
13             dpkg --add-architecture i386
14             apt update # FIXME you might want to try this up to some N times to avoid failures on temporary network issues
15         fi
16     ;;
17     arm64)
18         if ! dpkg --print-foreign-architectures | grep -Fqx armhf; then
19             echo "I: setting up multiarch"
20             dpkg --add-architecture armhf
21             apt update # FIXME you might want to try this up to some N times to avoid failures on temporary network issues
22         fi
23     ;;
24     i386|armel|armhf|powerpc)
25         : nothing, tests should just work
26         ;;
27     *)
28         echo "I: skipping tests on $arch; only works on amd64, i386, arm64, armhf, armel, and powerpc"
29         exit
30         ;;
31 esac
32
33 if ! dpkg-query --status wine32 | grep -Fqx 'Status: install ok installed'; then
34     DEBIAN_FRONTEND=noninteractive apt install -qy wine32 # FIXME ditto
35 fi
36
37 echo 'no-allow-loopback-pinentry:16' | gpgconf --change-options gpg-agent
38
39 # Generate a minimal signing key:
40 gpg2 --batch --debug-quick-random --pinentry-mode loopback --passphrase '' --quick-gen-key   'Test key for gpgv-win32 <test-key@example.com>'
41
42 gpg2 -o "$GNUPGHOME/key.gpg" --export test-key@example.com
43
44 # Sign this very script
45 rm -f "${0}.gpg"
46 gpg2 --output "${0}.gpg" --detach-sign "${0}"
47
48 # Verify using gpgv
49 gpgv2 --keyring "$GNUPGHOME/key.gpg" "${0}.gpg" "${0}"
50
51 # Verify using gpgv.exe
52 wine /usr/share/win32/gpgv.exe --keyring "Z:\\\\${GNUPGHOME}/key.gpg" "Z:\\\\$(pwd)/${0}.gpg" "Z:\\\\$(pwd)/${0}"
53
54 rm -rf "$GNUPGHOME"