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
11
gpgtool
11
gpgtool
|
@ -156,9 +156,14 @@ open () {
|
||||||
key=$(ls ${keypath}/${id}/*.key)
|
key=$(ls ${keypath}/${id}/*.key)
|
||||||
[[ $? != 0 ]] && \
|
[[ $? != 0 ]] && \
|
||||||
echo "${id} does not seem to be a valid key folder, aborting …" && exit 1
|
echo "${id} does not seem to be a valid key folder, aborting …" && exit 1
|
||||||
gpg --homedir "${tempdir}/gpghome" --import-options keep-ownertrust \
|
if [[ -f "${tempdir}/gpghome/private-keys-v1.d/$(basename ${key})" ]]
|
||||||
--import "${keypath}/${id}/${id}.private.asc"
|
then
|
||||||
[[ $? == 0 ]] && ln -sf ${key} ${tempdir}/gpghome/private-keys-v1.d/
|
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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue