- audit binary is only rebuilt when .go files are newer than the binary - rsync replaces scp for ISO download (delta transfer on repeat builds) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
67 lines
1.5 KiB
Bash
Executable File
67 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# run-builder.sh — trigger debug ISO build on remote Alpine builder VM
|
|
#
|
|
# Usage:
|
|
# sh scripts/run-builder.sh
|
|
# sh scripts/run-builder.sh --authorized-keys /path/to/authorized_keys
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
|
|
# load .env
|
|
ENV_FILE="${REPO_ROOT}/.env"
|
|
if [ -f "$ENV_FILE" ]; then
|
|
# shellcheck disable=SC1090
|
|
. "$ENV_FILE"
|
|
fi
|
|
|
|
BUILDER_HOST="${BUILDER_HOST:-}"
|
|
if [ -z "$BUILDER_HOST" ]; then
|
|
echo "ERROR: BUILDER_HOST not set. Copy .env.example to .env and set the address."
|
|
exit 1
|
|
fi
|
|
|
|
EXTRA_ARGS=""
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--authorized-keys) EXTRA_ARGS="--authorized-keys $2"; shift 2 ;;
|
|
*) echo "unknown arg: $1"; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
echo "=== bee builder ==="
|
|
echo "Builder: ${BUILDER_HOST}"
|
|
echo ""
|
|
|
|
ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" /bin/sh <<EOF
|
|
set -e
|
|
REPO=/root/bee
|
|
|
|
if [ ! -d "\$REPO/.git" ]; then
|
|
echo "--- cloning bee repo ---"
|
|
git clone https://git.mchus.pro/reanimator/bee.git "\$REPO"
|
|
fi
|
|
|
|
cd "\$REPO"
|
|
echo "--- pulling latest ---"
|
|
git pull --ff-only
|
|
|
|
echo "--- running build ---"
|
|
sh iso/builder/build-debug.sh ${EXTRA_ARGS}
|
|
EOF
|
|
|
|
echo ""
|
|
echo "=== downloading ISO ==="
|
|
LOCAL_ISO_DIR="${REPO_ROOT}/iso/out"
|
|
mkdir -p "${LOCAL_ISO_DIR}"
|
|
rsync -az --progress \
|
|
-e "ssh -o StrictHostKeyChecking=no" \
|
|
"root@${BUILDER_HOST}:/root/bee/dist/*.iso" \
|
|
"${LOCAL_ISO_DIR}/"
|
|
echo ""
|
|
echo "=== build complete ==="
|
|
echo "ISO saved to: ${LOCAL_ISO_DIR}/"
|
|
ls -lh "${LOCAL_ISO_DIR}/"*.iso 2>/dev/null || true
|