Debian Codegraph @

debian/tests/gpgv-win32

raw
1 #!/bin/sh
2
3 set -e
4
5 GNUPGHOME=$(mktemp -d)
6 export GNUPGHOME
7 gpg_args() {
8 gpg --batch --quiet --pinentry-mode=loopback --passphrase '' --with-colons "$@"
9 }
10
11 # Generate a minimal signing key:
12 gpg_args --quick-gen-key 'Test key for gpgv-win32 <[email protected]>'
13
14 gpg_args -o "$GNUPGHOME/key.gpg" --export [email protected]
15
16 # Sign this very script
17 rm -f "${0}.gpg"
18 gpg_args --output "${0}.gpg" --detach-sign "${0}"
19
20 # Verify using gpgv
21 gpgv --quiet --status-fd 3 3> native.status --keyring "$GNUPGHOME/key.gpg" "${0}.gpg" "${0}"
22
23 WINE=/usr/lib/wine/wine
24 export WINESERVER=/usr/lib/wine/wineserver32
25
26 # Verify using gpgv.exe (using --status-fd 1 because i don't know how
27 # to pass a non-standard file descriptor into wine)
28 "$WINE" /usr/share/win32/gpgv.exe --quiet --status-fd 1 > win32.status --keyring "Z://${GNUPGHOME}/key.gpg" "${0}.gpg" "${0}"
29
30 # convert to unix newlines if necessary:
31 sed -i 's/\r$//' win32.status
32
33 diff -u native.status win32.status
34
35 head -v win32.status
36
37 rm -rf "$GNUPGHOME"