Lichen

Annotated docs/tools/sign_releases.sh

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