Caught a couple of glitches.  Ignore the previous version.

#!/bin/bash

umask 077

DIR=`mktemp -d`
PREFIX="packet-"
PREFIXPAT="$PREFIX*"
IFS=$'\n'

gpgsplit -p "$DIR/$PREFIX" "$@" <&0 &&
for i in $( find "$DIR" -name "$PREFIXPAT" ); do
    if [ `echo -n "$i" | grep -cEe '-002[.]sig$'` != 0 ]; then
        COUNT=`gpg --list-packets "$i" \
            | grep -cEe '^[[:space:]]*hashed subpkt 12 len'`
        if [ $COUNT == 0 ]; then
            echo "Adding `basename "$i"`" >&2
            cat "$i"
        else
            echo "Omitting `basename "$i"`: contains revocation" >&2
        fi
    else
        echo "Adding `basename "$i"`" >&2
        cat "$i"
    fi
    shred -uz "$i"
done

rmdir "$DIR"

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to