From 2871e04693515d64a3c8f20f7b555b4af2094b20 Mon Sep 17 00:00:00 2001 From: yiekheng Date: Sun, 3 May 2026 10:44:16 +0800 Subject: [PATCH] fix(scripts): typo in publish.sh buildx error ('sudosudo') MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ${SUDO:+...}${SUDO:-...} is not the right ternary — ${SUDO:+x} expands to 'x' when SUDO is non-empty AND ${SUDO:-y} expands to 'y' when SUDO is empty, but they're not exclusive substitutions of the same variable in this context, so 'sudo' (the value of $SUDO when set) leaked into the output as 'sudosudo'. Replaced with an explicit if/else. --- scripts/publish.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index 577ca52..218d006 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -62,9 +62,10 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" PLATFORMS="${CM_IMAGE_PLATFORMS:-linux/amd64}" if ! "${DOCKER[@]}" buildx version >/dev/null 2>&1; then + RUNNER="$([[ -n "${SUDO}" ]] && echo "root via sudo" || echo "current user")" cat <&2 Docker Buildx isn't reachable as the user this script runs docker as -(${SUDO:+root via sudo}${SUDO:-current user}). +(${RUNNER}). Likely cause: buildx is installed at the per-user path ~/.docker/cli-plugins/docker-buildx, which sudo doesn't see.