Files
lnx-arch/dots/bin/importGnupgKeys.sh
committer@tuxwarrior 7e271470d3 + dir exist checks
2026-03-18 08:37:28 -05:00

44 lines
843 B
Bash
Executable File

#!/usr/bin/env bash
# klevstul :: 24.06 :: docs: docs/gpg.md
src_dir=/home/poq/syncDir/secrets/gnupg
tmp_dir=/tmp
this_file_name=`basename "$0"`
echo "$this_file_name"
if [ ! -d ${src_dir} ]; then
echo "error: missing directory '${src_dir}'"
exit 1
fi
if [ ! -d ${tmp_dir} ]; then
echo "error: missing directory '${tmp_dir}'"
exit 1
fi
echo "please, remember the hint: bibL2"
# copy .zip.gpg to tmp dir
cp ${src_dir}/*.zip.gpg ${tmp_dir}
# decrypt .gpg
gpg --decrypt --output ${tmp_dir}/gpgKeys.zip ${tmp_dir}/*.zip.gpg
# extract .zip
unzip -j -d ${tmp_dir} ${tmp_dir}/gpgKeys.zip
# delete decrypted zip file
srm -v ${tmp_dir}/gpgKeys.zip
# import keys
for file in ${tmp_dir}/*.asc; do
echo "processing '${file}'"
gpg --import ${file}
trash-put ${file}
done
gpg --list-secret-keys --keyid-format LONG