emma
/
protonkey
Archived
1
0
Fork 0

messed up find & replace

This commit is contained in:
Emma Tebibyte 2023-01-03 20:18:06 -05:00
parent e17419097a
commit 08aaf1cab3
1 changed files with 11 additions and 11 deletions

View File

@ -17,26 +17,26 @@
# along with this program. If not, see https://www.gnu.org/licenses/. # along with this program. If not, see https://www.gnu.org/licenses/.
if ! test -n "$1"; then if ! test -n "$1"; then
printf "Usage: %s [ProtonMail address]\n" "$0" 1>&2 printf "Usage: %s [ProtonMail address]\n" "$0" 1>&2
exit 64 # syexits(3) EX_USAGE exit 64 # syexits(3) EX_USAGE
fi fi
for command in \ for command in \
curl \ curl \
gpg gpg
do do
if ! command -v "$command" > /dev/null; then if ! command -v "$command" > /dev/null; then
printf "%s: Missing dependency: %s(1)\n" "$0" "$command" 1>&2 printf "%s: Missing dependency: %s(1)\n" "$0" "$command" 1>&2
exit 69 # sysexits(3) EX_UNAVAILABLE exit 69 # sysexits(3) EX_UNAVAILABLE
fi fi
done done
URL="https://api.protonmail.ch/pks/lookup?op=get&search=$1" URL="https://api.protonmail.ch/pks/lookup?op=get&search=$1"
RESPONSE="$(curl -s "$URL")" RESPONSE="$(curl -s "$URL")"
if ! printf "%s\n" "$RESPONSE" | gpg --import >/dev/null 2>&1; then if ! printf "%s\n" "$RESPONSE" | gpg --import >/dev/null 2>&1; then
printf "%s\n" "$RESPONSE" 1>&2 printf "%s\n" "$RESPONSE" 1>&2
exit 76 # sysexits(3) EX_PROTOCOL exit 76 # sysexits(3) EX_PROTOCOL
else else
exit 0 exit 0
fi fi