Skip to content

Instantly share code, notes, and snippets.

@tfm
Created February 25, 2014 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfm/9208368 to your computer and use it in GitHub Desktop.
Save tfm/9208368 to your computer and use it in GitHub Desktop.
#! /bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FILES=`find $1 -name "*gpg"`
echo "I am about to decrypt and re-encrypt the following files, with the current
set of public keys.
$FILES
Any existing plaintext in the checkout will be lost. Do you wish to continue? (y/n) "
read -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
printf '\n'
exit 0
fi
for FILE in $FILES;
do
gpg --batch --skip-verify --yes $FILE
DECRYPTED=`echo $FILE | sed s/\.[^\.]*$//`
$DIR/encrypt $DECRYPTED
srm $DECRYPTED
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment