Files
lnx-arch/dots/bin/deployGnupgKeys.sh

50 lines
983 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2026-02-25 08:23:35 -05:00
# klevstul :: 24.06 :: docs: docs/gpg.md
dir_checker() {
dir=$1
if [ ! -d ${dir} ]; then
echo "error: missing directory '${dir}'"
exit 1
fi
}
2026-02-25 08:23:35 -05:00
src_dir=/home/poq/syncDir/secrets/gnupg
tmp_dir=/tmp
this_file_name=`basename "$0"`
echo "$this_file_name"
dir_checker ${src_dir}
dir_checker ${tmp_dir}
2026-03-18 08:37:28 -05:00
2026-03-17 20:20:30 -05:00
echo "please, remember the hint: bibL2"
2026-02-24 18:35:15 -05:00
2026-03-18 08:42:14 -05:00
# list the source dir
ls -al ${src_dir}
2026-03-18 09:00:48 -05:00
# get the first file .zip.gpg in the directory
the_file=$(find . -name "*.zip.gpg" -print | head -n 1)
2026-03-18 09:03:51 -05:00
echo "file located: '${the_file}'"
2026-03-18 09:00:48 -05:00
2026-02-25 08:23:35 -05:00
# decrypt .gpg
2026-03-18 09:03:51 -05:00
gpg --decrypt --output ${tmp_dir}/gpgKeys.zip ${the_file}
2026-02-25 08:23:35 -05:00
# extract .zip
unzip -j -d ${tmp_dir} ${tmp_dir}/gpgKeys.zip
# delete decrypted zip file
srm -v ${tmp_dir}/gpgKeys.zip
2026-03-18 09:06:52 -05:00
# import keys, and delete the source files afterwards
2026-02-25 08:23:35 -05:00
for file in ${tmp_dir}/*.asc; do
echo "processing '${file}'"
2026-02-25 08:23:35 -05:00
gpg --import ${file}
trash-put ${file}
done
gpg --list-secret-keys --keyid-format LONG