summaryrefslogtreecommitdiff
path: root/gpgdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2010-06-17 14:30:06 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2010-06-17 14:30:06 +0000
commitc40e34a9e351ba5bd855df2649f1d864bb2a48d6 (patch)
treef3d829770699775114b29917023b1c7d99ec0db5 /gpgdiff
parent5f15d40181a9a49f6c0583431be0f2ee2d913bbd (diff)
Add gpgdiff
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@450 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'gpgdiff')
-rwxr-xr-xgpgdiff34
1 files changed, 34 insertions, 0 deletions
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] <file1> <file2>"
+ 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"