2017-06-21 00:07:18 +02:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
function gpg-encrypt-dir() {
|
|
|
|
dirname=$1
|
2017-06-21 20:18:44 +02:00
|
|
|
echo "Encrypting..."
|
2017-06-21 00:07:18 +02:00
|
|
|
tar -cz "$dirname" | gpg --symmetric --output "$dirname.tar.gz.gpg"
|
2017-06-21 20:18:44 +02:00
|
|
|
echo "Done."
|
2017-06-21 00:07:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function gpg-decrypt-dir() {
|
|
|
|
dirname=$1
|
|
|
|
outdir=${dirname%.tar.gz.gpg}
|
|
|
|
|
|
|
|
if [ -d "$outdir" ]; then
|
|
|
|
echo "Output directory, $outdir, already exists and will be overwritten by this command. Aborting..."
|
|
|
|
exit 1
|
|
|
|
else
|
2017-06-21 20:18:44 +02:00
|
|
|
echo "Decrypting..."
|
2017-06-21 00:07:18 +02:00
|
|
|
gpg --decrypt $dirname | tar -xv
|
2017-06-21 20:18:44 +02:00
|
|
|
echo "Done."
|
2017-06-21 00:07:18 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
2017-06-21 20:18:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
# WIP
|
|
|
|
function gpg-encrypt-file() {
|
|
|
|
filename=$1
|
|
|
|
echo "Encrypting..."
|
|
|
|
gpg --symmetric $filename
|
|
|
|
echo "Done."
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# WIP
|
|
|
|
function gpg-decrypt-file() {
|
|
|
|
filename=$1
|
|
|
|
echo "Decrypting..."
|
|
|
|
gpg --decrypt $filename >"${filename%.gpg}"
|
|
|
|
echo "Done."
|
|
|
|
}
|