diff --git a/ChangeLog b/ChangeLog index c64646566..accc4d7ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-04 David Shaw + + * configure.ac: Call GNUPG_CHECK_USTAR and generate tools/gpg-zip. + 2005-07-28 Werner Koch * configure.ac (USE_DNS_PKA): Define in addition to USE_DNS_SRV. diff --git a/configure.ac b/configure.ac index 33a9e09f1..5e6c6997c 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) diff --git a/m4/ChangeLog b/m4/ChangeLog index ec1cee584..35d2f49e9 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,8 @@ +2005-08-04 David Shaw + + * tar-ustar.m4: New. Check for a tar that creates USTAR format + tar files. + 2005-07-20 David Shaw * libcurl.m4: Check that our libcurl has diff --git a/m4/tar-ustar.m4 b/m4/tar-ustar.m4 new file mode 100644 index 000000000..8b3d01457 --- /dev/null +++ b/m4/tar-ustar.m4 @@ -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 diff --git a/tools/ChangeLog b/tools/ChangeLog index 3d56d7b2b..4f71467b2 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,10 @@ +2005-08-04 David Shaw + + * 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 * Makefile.am: Link with readline where needed. diff --git a/tools/Makefile.am b/tools/Makefile.am index 1636eb3e0..f244a7484 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -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@ diff --git a/tools/gpg-zip.in b/tools/gpg-zip.in new file mode 100644 index 000000000..40b6f3dc4 --- /dev/null +++ b/tools/gpg-zip.in @@ -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