#!/bin/bash

set -x

true "${bold}INFO: Currently running script: $BASH_SOURCE $@${reset}"

## Last resort only.
#export GPG_AGENT_INFO=/tmp/gpg-ayQ880/S.gpg-agent:5863:1

## Idea, hopefully not required.
#source /home/user/.gnupg/gpg-agent-info-host

gpg_exit_code="0"

gpg \
   --no-options \
   --no-emit-version \
   --no-comments \
   --display-charset utf-8 \
   --personal-digest-preferences SHA512 \
   --cert-digest-algo SHA512 \
   --default-preference-list "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed" \
   --keyserver-options no-honor-keyserver-url \
   --fixed-list-mode \
   --keyid-format 0xlong \
   --list-options show-uid-validity \
   --sig-notation issuer-fpr@notations.openpgp.fifthhorseman.net=%g \
   "$@"

gpg_exit_code="$?"

if [ "$gpg_exit_code" = "0" ]; then
   true "${bold}INFO: End of: $BASH_SOURCE | $dist_build_error_counter error(s) detected. (benchmark: skipped)${reset}"
else
   true "${bold}${red}INFO: End of: $BASH_SOURCE ERROR detected. (benchmark: skipped)${reset}"
fi

exit "$gpg_exit_code"
