+ deploy rclone config
plus better naming of gpg key deployer script
This commit is contained in:
49
dots/bin/deployGnupgKeys.sh
Executable file
49
dots/bin/deployGnupgKeys.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# klevstul :: 24.06 :: docs: docs/gpg.md
|
||||
|
||||
dir_checker() {
|
||||
dir=$1
|
||||
|
||||
if [ ! -d ${dir} ]; then
|
||||
echo "error: missing directory '${dir}'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
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}
|
||||
|
||||
echo "please, remember the hint: bibL2"
|
||||
|
||||
# list the source dir
|
||||
ls -al ${src_dir}
|
||||
|
||||
# get the first file .zip.gpg in the directory
|
||||
the_file=$(find . -name "*.zip.gpg" -print | head -n 1)
|
||||
echo "file located: '${the_file}'"
|
||||
|
||||
# decrypt .gpg
|
||||
gpg --decrypt --output ${tmp_dir}/gpgKeys.zip ${the_file}
|
||||
|
||||
# extract .zip
|
||||
unzip -j -d ${tmp_dir} ${tmp_dir}/gpgKeys.zip
|
||||
|
||||
# delete decrypted zip file
|
||||
srm -v ${tmp_dir}/gpgKeys.zip
|
||||
|
||||
# import keys, and delete the source files afterwards
|
||||
for file in ${tmp_dir}/*.asc; do
|
||||
echo "processing '${file}'"
|
||||
|
||||
gpg --import ${file}
|
||||
trash-put ${file}
|
||||
done
|
||||
|
||||
gpg --list-secret-keys --keyid-format LONG
|
||||
Reference in New Issue
Block a user