From c40e34a9e351ba5bd855df2649f1d864bb2a48d6 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 17 Jun 2010 14:30:06 +0000 Subject: Add gpgdiff git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@450 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- gpgdiff | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 gpgdiff (limited to 'gpgdiff') diff --git a/gpgdiff b/gpgdiff new file mode 100755 index 0000000..cd134ca --- /dev/null +++ b/gpgdiff @@ -0,0 +1,34 @@ +#!/bin/sh + +args='' +while : ; do + case "$1" in + -*) args="$args $1"; shift ;; + *) break + esac +done + +if [ "$#" -lt 2 ]; then + echo >&2 "Usage: $0 [-diffopts] " + exit 1 +fi + +umask 077 +tmp1="`tempfile`" +tmp2="`tempfile`" +trap "rm -f '$tmp1' '$tmp2'" EXIT + +gpg --decrypt < "$1" > "$tmp1" +# gpg's exit codes sucks +if ! [ -s "$tmp1" ]; then + echo >&2 "gpg decrypt of $f1 failed?" + exit 1 +fi + +gpg --decrypt < "$2" > "$tmp2" +if ! [ -s "$tmp2" ]; then + echo >&2 "gpg decrypt of $f2 failed?" + exit 1 +fi + +diff $args "$tmp1" "$tmp2" -- cgit v1.2.3