From 8de1ee1b2b676b0d07586f0752750dd6b0fb7511 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 11:59:15 +0200 Subject: Adding upstream version 2.2.27. Signed-off-by: Daniel Baumann --- tests/pkits/inittests | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 tests/pkits/inittests (limited to 'tests/pkits/inittests') diff --git a/tests/pkits/inittests b/tests/pkits/inittests new file mode 100755 index 0000000..deb1854 --- /dev/null +++ b/tests/pkits/inittests @@ -0,0 +1,109 @@ +#!/bin/sh +# Copyright (C) 2004 Free Software Foundation, Inc. -*- sh -*- +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +set -e + + +clean_files=' +ReadMe.txt pkits.ldif pkits.schema +gpgsm.conf gpg-agent.conf trustlist.txt policies.txt pubring.kbx +msg msg.sig msg.unsig +' + +[ -z "$srcdir" ] && srcdir=. +[ -z "$GPGSM" ] && GPGSM=../../sm/gpgsm + +#if [ -f $srcdir/README ] \ +# && grep tests/pkits/README README >/dev/null 2>&1; then +# : +#else +# # During make distclean the Makefile has already been removed, +# # so we need this extra test. +# if ! grep gnupg-test-pkits-directory testdir.stamp >/dev/null 2>&1; then +# echo "inittests: please cd to the tests/pkits directory first" >&2 +# exit 1 +# fi +#fi + +if [ "$1" = "--clean" ]; then + if [ -d private-keys-v1.d ]; then + rm private-keys-v1.d/* 2>/dev/null || true + rmdir private-keys-v1.d + fi + rm ${clean_files} testdir.stamp 2>/dev/null || true + for i in certs certpairs crls pkcs12 smime; do + if [ -d $i ]; then + rm $i/* 2>/dev/null || true + rmdir $i + fi + done + exit 0 +fi + +if [ "$GNUPGHOME" != "`/bin/pwd`" ]; then + echo "inittests: please set GNUPGHOME to the tests/pkits directory" >&2 + exit 1 +fi + +if [ -n "$GPG_AGENT_INFO" ]; then + echo "inittests: please unset GPG_AGENT_INFO" >&2 + exit 1 +fi + +if test -f "$srcdir/PKITS_data.tar.bz2"; then + if ! bunzip2 -c "$srcdir/PKITS_data.tar.bz2" | tar xf - ; then + echo "inittests: failed to untar the test data" >&2 + exit 1 + fi +fi + +# A stamp file used with --clean +echo gnupg-test-pkits-directory > testdir.stamp + + +# Create the configuration scripts +cat > gpgsm.conf < policies.txt < gpg-agent.conf < trustlist.txt <policies.txt <