2015-11-25 18:32:09 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#set -x
|
|
|
|
|
|
|
|
# Make sure $srcdir is set.
|
|
|
|
if test "x$srcdir" = x
|
|
|
|
then
|
|
|
|
echo srcdir environment variable not set!
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
. $srcdir/defs.inc || exit 3
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Make sure $GNUPGHOME is set.
|
|
|
|
if test "x$GNUPGHOME" = x
|
|
|
|
then
|
|
|
|
echo "GNUPGHOME not set."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
TESTFILES="$plain_files $data_files"
|
|
|
|
|
|
|
|
TESTDIR=gpgtar.d
|
|
|
|
FILELIST="${TESTDIR}/filelist"
|
|
|
|
GPG=../../g10/gpg2
|
2015-11-26 15:36:52 +01:00
|
|
|
GPGARGS="--trust-model=always"
|
|
|
|
|
2015-11-25 18:32:09 +01:00
|
|
|
GPGTAR="../../tools/gpgtar"
|
2015-11-26 15:36:52 +01:00
|
|
|
GPGZIP="sh ../../tools/gpg-zip"
|
2015-11-25 18:32:09 +01:00
|
|
|
|
|
|
|
for TOOL in "$GPGTAR" "$GPGZIP"
|
|
|
|
do
|
|
|
|
rm -rf -- "${TESTDIR}"
|
|
|
|
mkdir "${TESTDIR}"
|
|
|
|
|
2015-11-26 15:36:52 +01:00
|
|
|
$TOOL --gpg "$GPG" --gpg-args "$GPGARGS" \
|
|
|
|
--encrypt --recipient "$usrname2" \
|
2015-11-25 18:32:09 +01:00
|
|
|
--output "${TESTDIR}/test.tar.pgp" $TESTFILES
|
|
|
|
|
2015-11-26 15:36:52 +01:00
|
|
|
$TOOL --gpg "$GPG" --gpg-args "$GPGARGS" \
|
|
|
|
--list-archive "${TESTDIR}/test.tar.pgp" \
|
|
|
|
>"$FILELIST"
|
2015-11-25 18:32:09 +01:00
|
|
|
for F in $TESTFILES
|
|
|
|
do
|
|
|
|
grep -qe "\\b${F}\\b" "$FILELIST"
|
|
|
|
done
|
|
|
|
|
2015-11-26 15:36:52 +01:00
|
|
|
$TOOL --gpg "$GPG" --gpg-args "$GPGARGS" \
|
|
|
|
--tar-args --directory="${TESTDIR}" \
|
2015-11-26 14:08:48 +01:00
|
|
|
--decrypt "${TESTDIR}/test.tar.pgp"
|
2015-11-25 18:32:09 +01:00
|
|
|
for F in $TESTFILES
|
|
|
|
do
|
|
|
|
diff -q "$F" "${TESTDIR}/$F"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
# Success!
|
|
|
|
|
|
|
|
exit 0
|