1 #!/bin/sh 2 3 DIRNAME=`dirname "$0"` 4 PROGNAME=`basename "$0"` 5 6 if [ ! "$1" ] || [ "$1" = '--help' ] ; then 7 cat 1>&2 <<EOF 8 Usage: $PROGNAME <archive directory> [ -f ] 9 10 Sign archives in the given archive directory, invoking GPG to produce a 11 detached signature. If a signature already exists for an archive, it is not 12 regenerated unless the -f (force) option is given. 13 14 All newly-created signature filenames are emitted on standard output. 15 EOF 16 exit 1 17 fi 18 19 OUTDIR=$1 20 FORCE=$2 21 22 if [ "$FORCE" != '-f' ]; then 23 FORCE= 24 fi 25 26 if [ ! -e "$OUTDIR" ]; then 27 cat 1>&2 <<EOF 28 No archive directory to process. 29 EOF 30 exit 1 31 fi 32 33 for FILENAME in "$OUTDIR/"*".tar.bz2" ; do 34 OUTFILE="$FILENAME.asc" 35 if [ ! -e "$OUTFILE" ] || [ "$FORCE" ]; then 36 gpg --sign -a -b "$FILENAME" 37 echo "$OUTFILE" 38 fi 39 done