diff options
| -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." |
