From 365158b50fa9002712b506ca765a9fa1f29c2e7b Mon Sep 17 00:00:00 2001
From: Dustin Kirkland <kirkland@ubuntu.com>
Date: Fri, 16 Oct 2015 09:35:59 -0700
Subject: [PATCH] * usr/bin/vigpg:   - get vigpg working with the new release
 of gpg in wily   - clean up encrypted copies of the file

---
 debian/changelog | 3 +++
 usr/bin/vigpg    | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 16c73588..3b5853b7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ byobu (5.98) unreleased; urgency=medium
 
   * usr/bin/vigpg:
     - specify stdin for input file
+  * usr/bin/vigpg:
+    - get vigpg working with the new release of gpg in wily
+    - clean up encrypted copies of the file
 
  -- Dustin Kirkland <kirkland@ubuntu.com>  Mon, 31 Aug 2015 13:32:38 -0500
 
diff --git a/usr/bin/vigpg b/usr/bin/vigpg
index 9742139d..d0be3615 100755
--- a/usr/bin/vigpg
+++ b/usr/bin/vigpg
@@ -25,7 +25,7 @@ set -e
 cleartext_file=$(mktemp /dev/shm/.vigpg-XXXXXXXXXXXX)
 
 # Ensure that we always remove the cleartext_file on any exit
-trap "shred -f ${cleartext_file} "$cleartext_file".gpg 2>/dev/null || true" EXIT HUP INT QUIT TERM
+trap "shred -f ${cleartext_file} ${cleartext_file}.gpg 2>/dev/null || true" EXIT HUP INT QUIT TERM
 
 # Encrypted file from argv
 encrypted_file="$1"
@@ -48,7 +48,8 @@ fi
 
 # Try to decrypt the target file
 if [ -e "$encrypted_file" ]; then
-	(cat "$encrypted_file" | gpg -d - > "$cleartext_file") 		|| error "Unable to decrypt target"
+	rm -f "$cleartext_file"
+	gpg -o "$cleartext_file" -d "$encrypted_file" 		|| error "Unable to decrypt target"
 fi
 
 # Grab a checksum of the cleartext data before modification
@@ -72,3 +73,4 @@ else
 	echo
 	echo "The encrypted file was not modified [$encrypted_file]"
 fi
+rm -f "$cleartext_file" "$cleartext_file".gpg