Skip to content

Commit b307279

Browse files
committed
Merge bitcoin/bitcoin#24552: guix: make it possible to override gpg binary
af74e06 guix: make it possible to override gpg binary (Pavol Rusnak) Pull request description: For example on Qubes OS one might want to use qubes-gpg-client-wrapper instead Fixes bitcoin/bitcoin#24346 ACKs for top commit: laanwj: Concept and code review ACK af74e06 Tree-SHA512: 9e56b5fab231f8908fff15c88fe5b356ac4a31a14a27ae2dd3b6e876f32628910a666a4e2da5bf7c5d159de66cf57652c94c81cdc3b1c3d39a23c23e2c77dd03
2 parents 696d394 + af74e06 commit b307279

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

contrib/guix/guix-attest

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ source "$(dirname "${BASH_SOURCE[0]}")/libexec/prelude.bash"
1919
################
2020

2121
check_tools cat env basename mkdir diff sort
22+
2223
if [ -z "$NO_SIGN" ]; then
23-
check_tools gpg
24+
# make it possible to override the gpg binary
25+
GPG=${GPG:-gpg}
26+
27+
# $GPG can contain extra arguments passed to the binary
28+
# so let's check only the existence of arg[0]
29+
# shellcheck disable=SC2206
30+
GPG_ARRAY=($GPG)
31+
check_tools "${GPG_ARRAY[0]}"
2432
fi
2533

2634
################
@@ -90,7 +98,7 @@ if [ -z "${signer_name}" ]; then
9098
signer_name="$gpg_key_name"
9199
fi
92100

93-
if [ -z "$NO_SIGN" ] && ! gpg --dry-run --list-secret-keys "${gpg_key_name}" >/dev/null 2>&1; then
101+
if [ -z "$NO_SIGN" ] && ! ${GPG} --dry-run --list-secret-keys "${gpg_key_name}" >/dev/null 2>&1; then
94102
echo "ERR: GPG can't seem to find any key named '${gpg_key_name}'"
95103
exit 1
96104
fi
@@ -239,11 +247,11 @@ mkdir -p "$outsigdir"
239247
echo "Signing SHA256SUMS to produce SHA256SUMS.asc"
240248
for i in *.SHA256SUMS; do
241249
if [ ! -e "$i".asc ]; then
242-
gpg --detach-sign \
243-
--digest-algo sha256 \
244-
--local-user "$gpg_key_name" \
245-
--armor \
246-
--output "$i".asc "$i"
250+
${GPG} --detach-sign \
251+
--digest-algo sha256 \
252+
--local-user "$gpg_key_name" \
253+
--armor \
254+
--output "$i".asc "$i"
247255
else
248256
echo "Signature already there"
249257
fi

0 commit comments

Comments
 (0)