imip-agent

Annotated docs/tools/sign_releases.sh

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