#!/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}/"