From 68b5e02a74eb3a2afffbd873091c49c35219944f Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Sun, 8 Mar 2026 18:48:33 +0300 Subject: [PATCH] fix: run-builder.sh uses BUILDER_USER from .env, not hardcoded Co-Authored-By: Claude Sonnet 4.6 --- .env.example | 1 + scripts/run-builder.sh | 38 ++++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.env.example b/.env.example index 770e6d1..6adee9f 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ BUILDER_HOST= +BUILDER_USER= diff --git a/scripts/run-builder.sh b/scripts/run-builder.sh index 45dc552..8c89df5 100755 --- a/scripts/run-builder.sh +++ b/scripts/run-builder.sh @@ -1,5 +1,5 @@ #!/bin/sh -# run-builder.sh — trigger debug ISO build on remote Alpine builder VM +# run-builder.sh — trigger ISO build on remote Debian 12 builder VM # # Usage: # sh scripts/run-builder.sh @@ -18,10 +18,15 @@ if [ -f "$ENV_FILE" ]; then fi BUILDER_HOST="${BUILDER_HOST:-}" +BUILDER_USER="${BUILDER_USER:-}" if [ -z "$BUILDER_HOST" ]; then echo "ERROR: BUILDER_HOST not set. Copy .env.example to .env and set the address." exit 1 fi +if [ -z "$BUILDER_USER" ]; then + echo "ERROR: BUILDER_USER not set. Set it in .env." + exit 1 +fi EXTRA_ARGS="" while [ $# -gt 0 ]; do @@ -32,7 +37,7 @@ while [ $# -gt 0 ]; do done echo "=== bee builder ===" -echo "Builder: ${BUILDER_HOST}" +echo "Builder: ${BUILDER_USER}@${BUILDER_HOST}" echo "" # --- check local repo is in sync with remote --- @@ -53,10 +58,10 @@ fi echo "repo: in sync with remote ($LOCAL)" echo "" -ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" /bin/sh </dev/null || true +chmod +x iso/overlay/usr/local/bin/* 2>/dev/null || true # Kill any previous build session screen -S bee-build -X quit 2>/dev/null || true echo "--- starting build in screen session (survives SSH disconnect) ---" echo "--- log: \$LOG ---" -screen -dmS bee-build sh -c "sh iso/builder/build.sh ${EXTRA_ARGS} > \$LOG 2>&1; echo \$? > /tmp/bee-build-exit" +screen -dmS bee-build sh -c "sudo sh iso/builder/build.sh ${EXTRA_ARGS} > \$LOG 2>&1; echo \$? > /tmp/bee-build-exit" # Stream log until build finishes echo "--- streaming build log (Ctrl+C safe — build continues on VM) ---" -while screen -list | grep -q bee-build; do - tail -n +1 -f "\$LOG" 2>/dev/null & TAIL_PID=\$! - sleep 1 - while screen -list | grep -q bee-build; do sleep 2; done - kill \$TAIL_PID 2>/dev/null || true - break +tail -n +1 -f "\$LOG" 2>/dev/null & +TAIL_PID=\$! +while screen -list 2>/dev/null | grep -q bee-build; do + sleep 2 done +sleep 1 +kill \$TAIL_PID 2>/dev/null || true + tail -n 20 "\$LOG" 2>/dev/null || true EXIT_CODE=\$(cat /tmp/bee-build-exit 2>/dev/null || echo 1) @@ -95,14 +101,14 @@ echo "" echo "=== downloading ISO ===" LOCAL_ISO_DIR="${REPO_ROOT}/iso/out" mkdir -p "${LOCAL_ISO_DIR}" -if command -v rsync >/dev/null 2>&1 && ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" command -v rsync >/dev/null 2>&1; then +if command -v rsync >/dev/null 2>&1 && ssh -o StrictHostKeyChecking=no "${BUILDER_USER}@${BUILDER_HOST}" command -v rsync >/dev/null 2>&1; then rsync -az --progress \ -e "ssh -o StrictHostKeyChecking=no" \ - "root@${BUILDER_HOST}:/root/bee/dist/*.iso" \ + "${BUILDER_USER}@${BUILDER_HOST}:/home/${BUILDER_USER}/bee/dist/*.iso" \ "${LOCAL_ISO_DIR}/" else scp -o StrictHostKeyChecking=no \ - "root@${BUILDER_HOST}:/root/bee/dist/*.iso" \ + "${BUILDER_USER}@${BUILDER_HOST}:/home/${BUILDER_USER}/bee/dist/*.iso" \ "${LOCAL_ISO_DIR}/" fi echo ""