[svn] GnuPG - r3850 - in trunk: . m4 tools

svn author dshaw cvs at cvs.gnupg.org
Thu Aug 4 20:50:56 CEST 2005


Author: dshaw
Date: 2005-08-04 20:50:54 +0200 (Thu, 04 Aug 2005)
New Revision: 3850

Added:
   trunk/m4/tar-ustar.m4
   trunk/tools/gpg-zip.in
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/m4/ChangeLog
   trunk/tools/ChangeLog
   trunk/tools/Makefile.am
Log:
Add gpg-zip, a la PGP Zip.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-08-04 09:53:21 UTC (rev 3849)
+++ trunk/ChangeLog	2005-08-04 18:50:54 UTC (rev 3850)
@@ -1,3 +1,7 @@
+2005-08-04  David Shaw  <dshaw at jabberwocky.com>
+
+	* configure.ac: Call GNUPG_CHECK_USTAR and generate tools/gpg-zip.
+
 2005-07-28  Werner Koch  <wk at g10code.com>
 
 	* configure.ac (USE_DNS_PKA): Define in addition to USE_DNS_SRV.

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2005-08-04 09:53:21 UTC (rev 3849)
+++ trunk/configure.ac	2005-08-04 18:50:54 UTC (rev 3850)
@@ -425,7 +425,6 @@
 #endif /*GNUPG_CONFIG_H_INCLUDED*/
 ])
 
-
 AM_MAINTAINER_MODE
 
 dnl Checks for programs.
@@ -451,6 +450,7 @@
 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_test
 doc/Makefile
 tools/Makefile
+tools/gpg-zip
 zlib/Makefile
 checks/Makefile
 ])

Modified: trunk/m4/ChangeLog
===================================================================
--- trunk/m4/ChangeLog	2005-08-04 09:53:21 UTC (rev 3849)
+++ trunk/m4/ChangeLog	2005-08-04 18:50:54 UTC (rev 3850)
@@ -1,3 +1,8 @@
+2005-08-04  David Shaw  <dshaw at jabberwocky.com>
+
+	* tar-ustar.m4: New.  Check for a tar that creates USTAR format
+	tar files.
+
 2005-07-20  David Shaw  <dshaw at jabberwocky.com>
 
 	* libcurl.m4: Check that our libcurl has

Added: trunk/m4/tar-ustar.m4
===================================================================
--- trunk/m4/tar-ustar.m4	2005-08-04 09:53:21 UTC (rev 3849)
+++ trunk/m4/tar-ustar.m4	2005-08-04 18:50:54 UTC (rev 3850)
@@ -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

Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog	2005-08-04 09:53:21 UTC (rev 3849)
+++ trunk/tools/ChangeLog	2005-08-04 18:50:54 UTC (rev 3850)
@@ -1,3 +1,10 @@
+2005-08-04  David Shaw  <dshaw at 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 at jabberwocky.com>
 
 	* Makefile.am: Link with readline where needed.

Modified: trunk/tools/Makefile.am
===================================================================
--- trunk/tools/Makefile.am	2005-08-04 09:53:21 UTC (rev 3849)
+++ trunk/tools/Makefile.am	2005-08-04 18:50:54 UTC (rev 3850)
@@ -27,6 +27,10 @@
 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@

Added: trunk/tools/gpg-zip.in
===================================================================
--- trunk/tools/gpg-zip.in	2005-08-04 09:53:21 UTC (rev 3849)
+++ trunk/tools/gpg-zip.in	2005-08-04 18:50:54 UTC (rev 3850)
@@ -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




More information about the Gnupg-commits mailing list