File: gpg-sign-all

package info (click to toggle)
kup 0.3.4-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 636 kB
  • ctags: 120
  • sloc: perl: 1,422; sh: 89; makefile: 6
file content (36 lines) | stat: -rwxr-xr-x 940 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/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)

if [ x"$1" = x'-u' ]; then
    gpg_opt="-u $2"
    shift 2
fi

for f; do
    fbare=$(echo "$f" | sed -e 's/\.[^./]*$//')
    case "$f" in
	*.gz)
	    gzip -cd -- "$f" | gpg $gpg_opt --use-agent -a -b -o "$fbare".sign \
		--set-filename "$(basename "$fbare")" -
	    ;;
	*.bz2)
	    bzip2 -cd -- "$f" | gpg $gpg_opt --use-agent -a -b -o "$fbare".sign \
		--set-filename "$(basename "$fbare")" -
	    ;;
	*.xz)
	    xz -cd -- "$f" | gpg $gpg_opt --use-agent -a -b -o "$fbare".sign \
	    	--set-filename "$(basename "$fbare")" -
	    ;;
	*)
	    gpg $gpg_opt --use-agent -a -b -o "$f".sign \
		--set-filename "$(basename "$f")" - < "$f"
	    ;;
    esac
done
# Kill the agent
kill $(gpg-connect-agent /subst /serverpid '/echo ${get serverpid}' /bye)