diff options
author | Vasudev Kamath <vasudev@copyninja.info> | 2017-12-17 13:13:54 +0530 |
---|---|---|
committer | Vasudev Kamath <vasudev@copyninja.info> | 2017-12-17 13:13:54 +0530 |
commit | f4b3551be54238e1e02070d8ff4415bdb7763f35 (patch) | |
tree | a58811f729d4aa80e98a6ac418f406db3622f1e5 | |
parent | fbacbbce32ac42c8d674dc13d0ded42d6e91db73 (diff) |
Remote signing script for package upload to my host
-rwxr-xr-x | sign-remote | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sign-remote b/sign-remote new file mode 100755 index 0000000..f49af78 --- /dev/null +++ b/sign-remote @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright © 2009 Stefano Zacchiroli <zack@upsilon.cc> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +if [ -z "$1" ] ; then + echo "Usage: sign-remote HOSTNAME:PATH" + exit 2 +fi +url="$1" +host=$(echo "$url" | cut -f 1 -d':') +path=$(echo "$url" | cut -f 2 -d':') +base=$(dirname "$path") +if [ -z "$host" -o -z "$path" ] ; then + echo "Malformed remote \"URL\", must follow the \"HOSTNAME:PATH\" convention." + exit 2 +fi + +tmp=`mktemp` +sig="$tmp.gpg" +trap "rm -f $tmp $sig" EXIT + +echo "I: retrieving file to sign from remote host ..." +scp "$url" $tmp +echo "I: signing ..." +gpg --detach-sign --batch -o $sig $tmp +echo "I: sending back signature ..." +scp $sig "$host":"$path.gpg" +echo "I: remote signing done." |