summaryrefslogtreecommitdiff
path: root/gpgdiff
diff options
context:
space:
mode:
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"