strip-revokers script

Peter S. May me at psmay.com
Fri Mar 16 17:45:54 CET 2007


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"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : /pipermail/attachments/20070316/204a80dd/attachment.pgp 


More information about the Gnupg-users mailing list