1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-08 23:37:47 +02:00

Add gpg-zip, a la PGP Zip.

This commit is contained in:
David Shaw 2005-08-04 18:50:54 +00:00
parent cd4c621017
commit c058bd6632
7 changed files with 193 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2005-08-04 David Shaw <dshaw@jabberwocky.com>
* configure.ac: Call GNUPG_CHECK_USTAR and generate tools/gpg-zip.
2005-07-28 Werner Koch <wk@g10code.com>
* configure.ac (USE_DNS_PKA): Define in addition to USE_DNS_SRV.

View File

@ -425,7 +425,6 @@ AH_BOTTOM([
#endif /*GNUPG_CONFIG_H_INCLUDED*/
])
AM_MAINTAINER_MODE
dnl Checks for programs.
@ -451,6 +450,7 @@ AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no)
AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes)
GNUPG_CHECK_FAQPROG
GNUPG_CHECK_DOCBOOK_TO_TEXI
GNUPG_CHECK_USTAR
MPI_OPT_FLAGS=""
@ -1322,6 +1322,7 @@ keyserver/gpgkeys_mailto
keyserver/gpgkeys_test
doc/Makefile
tools/Makefile
tools/gpg-zip
zlib/Makefile
checks/Makefile
])

View File

@ -1,3 +1,8 @@
2005-08-04 David Shaw <dshaw@jabberwocky.com>
* tar-ustar.m4: New. Check for a tar that creates USTAR format
tar files.
2005-07-20 David Shaw <dshaw@jabberwocky.com>
* libcurl.m4: Check that our libcurl has

43
m4/tar-ustar.m4 Normal file
View File

@ -0,0 +1,43 @@
dnl Check for a tar program that speaks ustar format
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
AC_DEFUN([GNUPG_CHECK_USTAR],
[
AC_ARG_WITH(tar,
AC_HELP_STRING([--with-tar=PATH],[look for a tar program in PATH]),
[_do_tar=$withval])
if test x$_do_tar != xno ; then
if test x$_do_tar = x ; then
AC_PATH_PROG(TAR,"tar")
_mytar=$ac_cv_path_TAR
fi
# Check if our tar is ustar format. If so, it's good. TODO: Add some
# code to check various options, etc, to try and create ustar
# format.
if test x$_mytar != x ; then
AC_MSG_CHECKING([whether $_mytar speaks USTAR])
echo hithere > conftest.txt
$_mytar -cf - conftest.txt | grep -q ustar
_tar_bad=$?
rm conftest.txt
if test x$_tar_bad = x0 ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
fi
AM_CONDITIONAL(HAVE_USTAR, test x$_tar_bad = x0)
])dnl

View File

@ -1,3 +1,10 @@
2005-08-04 David Shaw <dshaw@jabberwocky.com>
* gpg-zip.in: New. Script wrapper to work with encrypted tar
files, a la PGP Zip.
* Makefile.am: Use it if we have a USTAR compatible tar.
2004-12-18 David Shaw <dshaw@jabberwocky.com>
* Makefile.am: Link with readline where needed.

View File

@ -27,6 +27,10 @@ other_libs = $(LIBICONV) $(LIBINTL) $(CAPLIBS)
bin_PROGRAMS = gpgsplit
noinst_PROGRAMS = mpicalc bftest clean-sat mk-tdata shmtest
if HAVE_USTAR
bin_SCRIPTS = gpg-zip
endif
gpgsplit_LDADD = $(needed_libs) $(other_libs) @ZLIBS@
mpicalc_LDADD = $(needed_libs) $(other_libs) @W32LIBS@
bftest_LDADD = $(needed_libs) $(other_libs) @W32LIBS@ @DLLIBS@ @NETLIBS@ @LIBREADLINE@

128
tools/gpg-zip.in Normal file
View File

@ -0,0 +1,128 @@
#!/bin/sh
# gpg-archive - gpg-ized tar using the same format as PGP's PGP Zip.
# Copyright (C) 2005 Free Software Foundation, Inc.
#
# This file is part of GnuPG.
#
# GnuPG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Despite the name, PGP Zip format is actually an OpenPGP-wrapped tar
# file. To be compatible with PGP itself, this must be a USTAR format
# tar file. Unclear on whether there is a distinction here between
# the GNU or POSIX variant of USTAR.
VERSION=@VERSION@
TAR=@TAR@
GPG=gpg
usage="\
Usage: gpg-zip [--help] [--version] [--encrypt] [--symmetric]
[--list-archive] [--output FILE] [--gpg GPG] [--gpg-args ARGS]
[--tar TAR] [--tar-args ARGS] filename1 [filename2, ...]
directory1 [directory2, ...]
Encrypt or sign files into an archive."
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*)
echo "$usage"
exit 0
;;
--list-archive)
list=yes
create=no
shift
;;
--encrypt | -e)
gpg_args="$gpg_args --encrypt"
list=no
create=yes
shift
;;
--symmetric | -c)
gpg_args="$gpg_args --symmetric"
list=no
create=yes
shift
;;
--sign | -s)
gpg_args="$gpg_args --sign"
list=no
create=yes
shift
;;
--recipient | -r)
gpg_args="$gpg_args --recipient $2"
shift
shift
;;
--local-user | -u)
gpg_args="$gpg_args --local-user $2"
shift
shift
;;
--output | -o)
gpg_args="$gpg_args --output $2"
shift
shift
;;
--version)
echo "gpg-zip (GnuPG) $VERSION"
exit 0
;;
--gpg)
GPG=$1
shift
;;
--gpg-args)
gpg_args="$gpg_args $2"
shift
shift
;;
--tar)
TAR=$1
shift
;;
--tar-args)
tar_args="$tar_args $2"
shift
shift
;;
--)
shift
break
;;
-*)
echo "$usage" 1>&2
exit 1
;;
*)
break
;;
esac
done
if test x$create = xyes ; then
# echo "$TAR -cf - $* | $GPG --set-filename x.tar $gpg_args" >&2
$TAR -cf - $* | $GPG --set-filename x.tar $gpg_args
elif test x$list = xyes ; then
# echo "cat $1 | $GPG $gpg_args | $TAR $tar_args -tf -" >&2
cat $1 | $GPG $gpg_args | $TAR $tar_args -tf -
else
echo "$usage" 1>&2
exit 1
fi