don’t open
key if already opened
This commit is contained in:
parent
356d1cdb7a
commit
4451000fef
1 changed files with 8 additions and 3 deletions
5
gpgtool
5
gpgtool
|
@ -156,9 +156,14 @@ open () {
|
|||
key=$(ls ${keypath}/${id}/*.key)
|
||||
[[ $? != 0 ]] && \
|
||||
echo "${id} does not seem to be a valid key folder, aborting …" && exit 1
|
||||
if [[ -f "${tempdir}/gpghome/private-keys-v1.d/$(basename ${key})" ]]
|
||||
then
|
||||
echo "Key ${id} already opened."
|
||||
else
|
||||
gpg --homedir "${tempdir}/gpghome" --import-options keep-ownertrust \
|
||||
--import "${keypath}/${id}/${id}.private.asc"
|
||||
[[ $? == 0 ]] && ln -sf ${key} ${tempdir}/gpghome/private-keys-v1.d/
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue