diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 293e13f..2f2b0f2 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,6 +44,9 @@ declare -r confdir='@sysconfdir@' declare -r BUILDSCRIPT='@BUILDSCRIPT@' declare -r startdir="$PWD" +# gpg fails if PKGBUILD exports HOME without --homedir +export GPGHOME="${HOME}/.gnupg" + packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx' \ 'debug') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') @@ -1167,7 +1170,7 @@ check_pgpsigs() { continue fi - if ! gpg --quiet --batch --status-file "$statusfile" --verify "$file" "$sourcefile" 2> /dev/null; then + if ! gpg --homedir "${GPGHOME}" --quiet --batch --status-file "$statusfile" --verify "$file" "$sourcefile" 2> /dev/null; then printf '%s' "$(gettext "FAILED")" >&2 if ! pubkey=$(awk '/NO_PUBKEY/ { print $3; exit 1; }' "$statusfile"); then printf ' (%s)' "$(gettext "unknown public key") $pubkey" >&2 @@ -1894,8 +1897,7 @@ create_signature() { SIGNWITHKEY="-u ${GPGKEY}" fi # The signature will be generated directly in ascii-friendly format - gpg --detach-sign --use-agent ${SIGNWITHKEY} "$filename" &>/dev/null || ret=$? - + gpg --homedir "${GPGHOME}" --detach-sign --use-agent ${SIGNWITHKEY} "$filename" || ret=$? if (( ! ret )); then msg2 "$(gettext "Created signature file %s.")" "$filename.sig" @@ -2751,7 +2753,7 @@ fi # check if gpg signature is to be created and if signing key is valid if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; then SIGNPKG='y' - if ! gpg --list-key ${GPGKEY} &>/dev/null; then + if ! gpg --homedir "${GPGHOME}" --list-key ${GPGKEY} &>/dev/null; then if [[ ! -z $GPGKEY ]]; then error "$(gettext "The key %s does not exist in your keyring.")" "${GPGKEY}" else