diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-13 15:01:16 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-13 15:01:16 +0200 |
| commit | 416ea5dcce60a115a77a347611141a722cba5c92 (patch) | |
| tree | c96fb6bf2e071395f2a71c05cc7a114ac6eb7e3a /.extras | |
| parent | f273077105877e2b0558702e0eaa47f34a36c01a (diff) | |
| download | sbo-slackbuilds-416ea5dcce60a115a77a347611141a722cba5c92.tar.gz sbo-slackbuilds-416ea5dcce60a115a77a347611141a722cba5c92.zip | |
image-builder: fix false GPG-update warning from SIGPIPE on yes pipe
bootstrap fed slackpkg update gpg with "yes YES |". When slackpkg exits
first (key already valid), yes takes SIGPIPE and, under set -e/pipefail,
the pipeline reports non-zero even though the key import succeeded, firing
a bogus "slackpkg GPG update failed" warning on every run.
Read slackpkg own status via PIPESTATUS[1] instead of the pipeline status,
inside an if so set -e/pipefail does not abort on the SIGPIPE; capture
PIPESTATUS as the first command in each branch so no intervening command
resets it. Verified: warning gone on re-run, key still imports.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to '.extras')
| -rwxr-xr-x | .extras/image-builder/bootstrap.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/.extras/image-builder/bootstrap.sh b/.extras/image-builder/bootstrap.sh index 0698d55..ff766d1 100755 --- a/.extras/image-builder/bootstrap.sh +++ b/.extras/image-builder/bootstrap.sh @@ -446,7 +446,15 @@ FSTAB # as a safety net; with the CA database now valid the prompt should not # appear because the download succeeds on the first attempt. _log "Importing Slackware GPG key via slackpkg..." - yes YES | chroot "${ROOTFS}" /usr/sbin/slackpkg -batch=on -default_answer=y update gpg || _warn "slackpkg GPG update failed; check the output above." + # Check slackpkg's own exit status, not the pipeline's: 'yes' takes SIGPIPE + # when slackpkg exits first, which can make the pipeline non-zero even on + # success (false "GPG update failed" warning). Wrapping in 'if' exempts the + # pipeline from set -e/pipefail so we can read PIPESTATUS[1] (slackpkg's own + # status) instead of the SIGPIPE-poisoned pipeline status. + local gpg_rc + if yes YES | chroot "${ROOTFS}" /usr/sbin/slackpkg -batch=on -default_answer=y update gpg + then gpg_rc="${PIPESTATUS[1]}"; else gpg_rc="${PIPESTATUS[1]}"; fi + [[ "${gpg_rc}" -eq 0 ]] || _warn "slackpkg GPG update failed; check the output above." _log "Updating slackpkg package list..." chroot "${ROOTFS}" /usr/sbin/slackpkg -batch=on -default_answer=y update || _warn "slackpkg update failed; cache will build on first container run." |
