Skip to content

Commit af74e06

Browse files
committed
guix: make it possible to override gpg binary
For example on Qubes OS one might want to use qubes-gpg-client-wrapper instead
1 parent bb0b39c commit af74e06

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)