Updated vns_import to use vns_gpgid, as well as create nonexistent paths

This commit is contained in:
Vera Lewis
2024-04-01 19:39:42 -05:00
parent 5e4ec8f765
commit 96848fb85c

13
vns
View File

@@ -301,10 +301,17 @@ vns_import () {
esac esac
fi fi
printf "%s:" "Specify GPG Public Key: " #printf "%s:" "Specify GPG Public Key: "
local gpg_key=''; read -r gpg_key #local gpg_key=''; read -r gpg_key
gpg2 --batch -r "$gpg_key" -o "$VNS_STORE/$2.gpg" -e "$1" # Create any necessary directories
mkdir -p "$VNS_STORE/$(dirname "$2.gpg")"
if [ "${1##*.}" == "gpg" ]; then
gpg --batch --decrypt "$1" | gpg2 --batch "$(vns_gpgid)" -o "$VNS_STORE/$2.gpg" --encrypt
else
gpg2 --batch "$(vns_gpgid)" -o "$VNS_STORE/$2.gpg" --encrypt "$1"
fi
vns_git add "$VNS_STORE/$2.gpg" vns_git add "$VNS_STORE/$2.gpg"
vns_git commit -m "Imported file $1 as $2" vns_git commit -m "Imported file $1 as $2"