diff --git a/vns b/vns index cb4d2a8..f482aa3 100644 --- a/vns +++ b/vns @@ -301,10 +301,17 @@ vns_import () { esac fi - printf "%s:" "Specify GPG Public Key: " - local gpg_key=''; read -r gpg_key + #printf "%s:" "Specify GPG Public Key: " + #local gpg_key=''; read -r gpg_key + + # Create any necessary directories + mkdir -p "$VNS_STORE/$(dirname "$2.gpg")" - gpg2 --batch -r "$gpg_key" -o "$VNS_STORE/$2.gpg" -e "$1" + 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 commit -m "Imported file $1 as $2"