42 lines
854 B
Bash
Executable File
42 lines
854 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# klevstul :: 26.02.25
|
|
|
|
|
|
src_dir=/home/poq/.local/share/Cryptomator/mnt/cryptLocal/content/keys/openPgp/.gnupg
|
|
tmp_dir=/tmp
|
|
trg_dir=/home/poq/syncDir/secrets/gnupg
|
|
|
|
# make sure the dirs are available
|
|
if ! [ -d "$src_dir" ]
|
|
then
|
|
echo ""
|
|
echo "ERROR: can not open '$src_dir'! is the cryptLocal vault mounted?"
|
|
echo ""
|
|
exit
|
|
fi
|
|
|
|
if ! [ -d "$trg_dir" ]
|
|
then
|
|
echo ""
|
|
echo "ERROR: can not open '$trg_dir'!"
|
|
echo ""
|
|
exit
|
|
fi
|
|
|
|
# zip the content
|
|
timestamp=$(date +%y%m%d)
|
|
zip_file=${tmp_dir}/${timestamp}_gnupgKeys.bibL2.zip
|
|
zip -r "${zip_file}" "${src_dir}/" -i "*.asc"
|
|
|
|
# gpg : symmetric encrypt the content (as we will have no key pair when decrypting)
|
|
gpg --symmetric "${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}/"
|