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..." echo "Searching for GPG key..."
gpg --keyserver "hkps://keys.openpgp.org" --search "$(cat $TMP)" gpg --keyserver "hkps://keys.openpgp.org" --search "$(cat $TMP)"
if [ $? -eq 0 ]; then 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" gpg --batch --delete-key "$FFP"
if [ "$FFP" = "" ]; then if [ "$FFP" = "" ]; then
gpgSearch diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
else else
return 0 return 0
fi fi
else else
gpgSearch diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
fi fi
else else
gpgSearch diaBox "GPG Search" "This is on vaild mail address."
return 1
fi fi
fi fi
return 1 return 1
@ -137,8 +140,10 @@ function enterGPG() {
gpgSearch gpgSearch
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
enterGPG "$FFP" "no-confirm" enterGPG "$FFP" "no-confirm"
return 0
else
return 1
fi fi
return
;; ;;
esac esac

View File

@ -133,18 +133,21 @@ function gpgSearch() {
echo "Searching for GPG key..." echo "Searching for GPG key..."
gpg --keyserver "hkps://keys.openpgp.org" --search "$(cat $TMP)" gpg --keyserver "hkps://keys.openpgp.org" --search "$(cat $TMP)"
if [ $? -eq 0 ]; then 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" gpg --batch --delete-key "$FFP"
if [ "$FFP" = "" ]; then if [ "$FFP" = "" ]; then
gpgSearch diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
else else
return 0 return 0
fi fi
else else
gpgSearch diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
fi fi
else else
gpgSearch diaBox "GPG Search" "This is on vaild mail address."
return 1
fi fi
fi fi
return 1 return 1
@ -171,8 +174,10 @@ function enterGPG() {
gpgSearch gpgSearch
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
enterGPG "$FFP" "no-confirm" enterGPG "$FFP" "no-confirm"
return 0
else
return 1
fi fi
return
;; ;;
esac esac