aboutsummaryrefslogtreecommitdiffstats
path: root/gpg-sign-all
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-10-17 15:12:08 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2011-10-17 15:12:08 -0700
commit90b1493c59e4451fa0d7d522abe9839513775086 (patch)
tree8e955f7d270c37ae40fc92c6f48a089ea39a246b /gpg-sign-all
parent2ffb33502ef811bae16d90f9a771a42808a851c8 (diff)
downloadkup-90b1493c59e4451fa0d7d522abe9839513775086.tar.gz
kup-90b1493c59e4451fa0d7d522abe9839513775086.tar.xz
kup-90b1493c59e4451fa0d7d522abe9839513775086.zip
gpg-sign-all: utility script to sign a bunch of files with gpg
A simple utility script to manage a transient gpg-agent to sign a bunch of files with gpg; it also manages the fact that we want to sign the *uncompressed* content for .gz .bz2 and .xz files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'gpg-sign-all')
-rwxr-xr-xgpg-sign-all26
1 files changed, 26 insertions, 0 deletions
diff --git a/gpg-sign-all b/gpg-sign-all
new file mode 100755
index 0000000..bf7c57d
--- /dev/null
+++ b/gpg-sign-all
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Sign an arbitrary number of files using a transient GPG agent
+#
+
+unset GPG_AGENT_INFO
+eval $(gpg-agent --daemon --quiet --no-use-standard-socket --keep-tty --keep-display --sh)
+for f; do
+ fbare=$(echo "$f" | sed -e 's/\.[^./]*$//')
+ case "$f" in
+ *.gz)
+ gzip -cd "$f" | gpg --use-agent -a -b -o "$fbare".sign --set-filename "$fbare" -
+ ;;
+ *.bz2)
+ bzip2 -cd "$f" | gpg --use-agent -a -b -o "$fbare".sign --set-filename "$fbare" -
+ ;;
+ *.xz)
+ xz -cd "$f" | gpg --use-agent -a -b -o "$fbare".sign --set-filename "$fbare" -
+ ;;
+ *)
+ gpg --use-agent -a -b -o "$f".sign "$f"
+ ;;
+ esac
+done
+# Kill the agent
+kill $(gpg-connect-agent /subst /serverpid '/echo ${get serverpid}' /bye)