From 9804c49a2c254610015249d59060f156019c3888 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Sep 2017 21:36:00 +0100 Subject: [PATCH] Check if an error is returned when getting public key ID --- src/freedombone-base-email | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/freedombone-base-email b/src/freedombone-base-email index 2bde27d7..5bdea62a 100755 --- a/src/freedombone-base-email +++ b/src/freedombone-base-email @@ -1381,11 +1381,15 @@ function configure_gpg { if [ ${#MY_GPG_PUBLIC_KEY_ID} -lt 4 ]; then echo $'GPG public key ID could not be obtained' else - chown -R $MY_USERNAME:$MY_USERNAME $gpg_dir - chmod 700 $gpg_dir - chmod 600 $gpg_dir/* - mark_completed $FUNCNAME - return + if [[ "$MY_GPG_PUBLIC_KEY_ID" == *'error'* ]]; then + echo $"Can't locate gpg key" + else + chown -R $MY_USERNAME:$MY_USERNAME $gpg_dir + chmod 700 $gpg_dir + chmod 600 $gpg_dir/* + mark_completed $FUNCNAME + return + fi fi fi