sots-engine/tools/sync-build.sh

17 lines
830 B
Bash
Executable file

#!/usr/bin/env bash
# From the dev box: push this tree to the build box's share and run tools/build-shim.sh there.
# The share (/bulk-storage/re-lab on host "spicy") is /srv/re-lab inside CT111.
set -euo pipefail
cd "$(dirname "$0")/.."
HOST=${HOST:-spicy}
CT=${CT:-111}
REMOTE_TREE=${REMOTE_TREE:-/bulk-storage/re-lab/build/sots-engine} # host path
CT_TREE=${CT_TREE:-/srv/re-lab/build/sots-engine} # same dir, seen from the CT
BUILD_ID=$(git describe --always --dirty 2>/dev/null || echo nogit)-$(date -u +%Y%m%dT%H%MZ)
# unprivileged CT: uid 0 in the container is 100000 on the host
rsync -a --delete --chown=100000:100000 \
--exclude .git --exclude '/build-*/' --exclude '/build/' \
./ "$HOST:$REMOTE_TREE/"
ssh "$HOST" pct exec "$CT" -- env BUILD_ID="$BUILD_ID" bash "$CT_TREE/tools/build-shim.sh"