workspace/arch-user/bin/gpg/reencrypt-to-sym.sh
2025-04-01 00:00:37 +00:00

19 lines
353 B
Bash
Executable File

#!/bin/bash
set -e
if [ -z "$1" ] || [ -z "$2" ]; then
echo "bad args" >&2
exit 1
fi
DEST=$(realpath "$2")
cd "$1"
mkdir -p DEST
for rel in $(find . -type f -name *.gpg); do
DESTFILE=$(echo $DEST/$rel | sed 's/\.[^.]*$//')
[ -f "$DESTFILE" ] && continue
mkdir -p "$(dirname "$DESTFILE")"
gpg --output "$DESTFILE" --decrypt "$rel"
done