imip-agent

Annotated docs/tools/sign_releases.sh

1362:d96b4761e6f0
2017-10-24 Paul Boddie Remove superfluous result collection slicing and count method parameter.
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