0
0
#!/usr/bin/env bash
# On the staging VM, as stg: 0009's page checkout, $SWC_DIR/page, the target's pageRepo. The suite tarball carries the
# page (page/: web/webrtc with its modules, scripts/page-round.mjs and browser.mjs, COMMIT) when the host that put it had
# SWC_PAGE_REPO (a built checkout of the requester page repo); node and Chrome come here as pinned downloads
# (tools.sh), under page/tools, which the test host's page.round uses when they are there.
# Prints the pageRepo path, nothing without a page in the suite; a node or a Chrome that does not run fails it (what the
# binary said, on stderr) and prints no path. Usage: page.sh
set -euo pipefail
D=${SWC_DIR:-/home/stg/stg} R=${SWC_REPO:-${SWC_DIR:-/home/stg/stg}/suite}
src=$R/page P=$D/page
[ -f "$src/scripts/page-round.mjs" ] || exit 0
mkdir -p "$P"
rm -rf "$P/web" "$P/scripts" "$P/COMMIT"
cp -r "$src/web" "$src/scripts" "$src/COMMIT" "$P/"
T=$("$(dirname "$0")/tools.sh" node chrome)
node=$("$T/node/bin/node" --version 2>&1) || { echo "page.sh: node does not run: $node" >&2; exit 1; }
chrome=$("$T/chrome/chrome" --version 2>&1) || { echo "page.sh: chrome does not run: $chrome" >&2; exit 1; }
echo "page.sh: $node $chrome page $(cat "$P/COMMIT")" >&2
echo "$P"