This commit is contained in:
committer@tuxwarrior
2026-02-25 08:23:35 -05:00
parent 49b8e595cb
commit 2620282282
10 changed files with 123 additions and 31 deletions

View File

@@ -0,0 +1,41 @@
#!/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.zip
zip -r "${zip_file}" "${src_dir}/" -i "*.asc"
# 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}/"