Fix: GPG-Search

This commit is contained in:
Bandie 2021-01-04 22:04:43 +01:00
parent 7bb30f09f5
commit 333d5c9e3c
Signed by: Bandie
GPG Key ID: 843D7FA93BA46312
2 changed files with 20 additions and 10 deletions

15
start
View File

@ -99,18 +99,21 @@ function gpgSearch() {
echo "Searching for GPG key..."
gpg --keyserver "hkps://keys.openpgp.org" --search "$(cat $TMP)"
if [ $? -eq 0 ]; then
export FFP=$(gpg -k "$(cat $TMP)" | head -n 2 | tail -n 1 | awk '{print $1}' | sed 's/.\{4\}/& /g;s/^\(.*\) $/\1/g')
FFP=$(gpg -k "$(cat $TMP)" | head -n 2 | tail -n 1 | awk '{print $1}' | sed 's/.\{4\}/& /g;s/^\(.*\) $/\1/g')
gpg --batch --delete-key "$FFP"
if [ "$FFP" = "" ]; then
gpgSearch
diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
else
return 0
fi
else
gpgSearch
diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
fi
else
gpgSearch
diaBox "GPG Search" "This is on vaild mail address."
return 1
fi
fi
return 1
@ -137,8 +140,10 @@ function enterGPG() {
gpgSearch
if [ $? -eq 0 ]; then
enterGPG "$FFP" "no-confirm"
return 0
else
return 1
fi
return
;;
esac

View File

@ -133,18 +133,21 @@ function gpgSearch() {
echo "Searching for GPG key..."
gpg --keyserver "hkps://keys.openpgp.org" --search "$(cat $TMP)"
if [ $? -eq 0 ]; then
export FFP=$(gpg -k "$(cat $TMP)" | head -n 2 | tail -n 1 | awk '{print $1}' | sed 's/.\{4\}/& /g;s/^\(.*\) $/\1/g')
FFP=$(gpg -k "$(cat $TMP)" | head -n 2 | tail -n 1 | awk '{print $1}' | sed 's/.\{4\}/& /g;s/^\(.*\) $/\1/g')
gpg --batch --delete-key "$FFP"
if [ "$FFP" = "" ]; then
gpgSearch
diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
else
return 0
fi
else
gpgSearch
diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
fi
else
gpgSearch
diaBox "GPG Search" "This is on vaild mail address."
return 1
fi
fi
return 1
@ -171,8 +174,10 @@ function enterGPG() {
gpgSearch
if [ $? -eq 0 ]; then
enterGPG "$FFP" "no-confirm"
return 0
else
return 1
fi
return
;;
esac