Files
lnx-arch/dots/bin/cryptomatorBackup.sh
committer@tuxwarrior 2620282282 wip
2026-02-25 08:23:35 -05:00

34 lines
700 B
Bash
Executable File

#!/usr/bin/env bash
# klevstul :: 26.02.24
src_dir=/home/poq/.local/share/Cryptomator/mnt/cryptLocal
tmp_dir=/tmp
trg_dir=/home/poq/syncDir/0_downloads
# make sure cryptLocal is mounted and available
if ! [ -d "$src_dir" ]
then
echo "missing source directory:"
echo "$src_dir"
echo "is the cryptLocal vault mounted?"
exit
fi
# zip the content
timestamp=$(date +%y%m%d)
zip_file=${tmp_dir}/${timestamp}_cryptLocal.zip
zip -r "${zip_file}" "${trg_dir}/"
# gpg encrypt the content
gpg --encrypt --sign --recipient frode@klevstul.com "${zip_file}"
# delete the .zip file
srm -v "${zip_file}"
# move the .gpg file to the target dir
mv "${zip_file}.gpg" "${trg_dir}/"
ls -al "${trg_dir}/"