Fix bootstrap.sh: go not found on PATH after install

/usr/local/bin wasn't guaranteed to be on PATH in non-interactive
shells, so the symlinked go binary was invisible to later steps.
Export PATH explicitly and fail fast if go is still missing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-07-10 17:48:22 +02:00
co-authored by Claude Sonnet 5
parent 18188f44b8
commit 6e0e6813f1
+8
View File
@@ -37,15 +37,23 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update apt-get update
apt-get install -y git wireguard-tools nftables curl ca-certificates apt-get install -y git wireguard-tools nftables curl ca-certificates
export PATH="/usr/local/go/bin:/usr/local/bin:$PATH"
if ! command -v go >/dev/null 2>&1; then if ! command -v go >/dev/null 2>&1; then
echo "Installing Go ${GO_VERSION}..." echo "Installing Go ${GO_VERSION}..."
ARCH="$(dpkg --print-architecture)" ARCH="$(dpkg --print-architecture)"
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" -o /tmp/go.tar.gz curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" -o /tmp/go.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf /tmp/go.tar.gz tar -C /usr/local -xzf /tmp/go.tar.gz
ln -sf /usr/local/go/bin/go /usr/local/bin/go ln -sf /usr/local/go/bin/go /usr/local/bin/go
rm -f /tmp/go.tar.gz rm -f /tmp/go.tar.gz
fi fi
if ! command -v go >/dev/null 2>&1; then
echo "go still not found on PATH after install attempt (/usr/local/go/bin)." >&2
exit 1
fi
if [[ -d "$SRC_DIR/.git" ]]; then if [[ -d "$SRC_DIR/.git" ]]; then
echo "Updating existing checkout at $SRC_DIR..." echo "Updating existing checkout at $SRC_DIR..."
git -C "$SRC_DIR" fetch --depth 1 origin "$REF" git -C "$SRC_DIR" fetch --depth 1 origin "$REF"