Repository navigation
Expand file tree
/
Copy pathfetch-pinned-chrome.sh
More file actions
executable file
·63 lines (56 loc) · 2.45 KB
/
Copy pathfetch-pinned-chrome.sh
File metadata and controls
executable file
·63 lines (56 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
#
# Fetch a pinned Chrome for Testing + matching chromedriver into client/chrome/.
#
# Why pin: the experiment measures latency through a browser, so the browser is part of the
# apparatus and must not drift. Concretely, Chrome 149 refuses the SDP answer produced by
# mediasoup 3.14.15 -
# "Failed to set remote answer sdp: RTP extension ID reassignment not supported"
# - so publishing fails outright on a current system Chrome. 130.0.6723.116 is the version
# the thesis ran on and works.
#
# Writes the resolved paths into client/config.json so the harness uses them.
set -euo pipefail
CHROME_VERSION="${CHROME_VERSION:-130.0.6723.116}"
PLATFORM="${PLATFORM:-linux64}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEST="$SCRIPT_DIR/client/chrome/$CHROME_VERSION"
BASE="https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/$PLATFORM"
usage() { echo "Usage: $0 [--version X.Y.Z.W] [--no-config]"; exit 0; }
WRITE_CONFIG=1
while [[ $# -gt 0 ]]; do
case $1 in
--version) CHROME_VERSION="$2"; DEST="$SCRIPT_DIR/client/chrome/$CHROME_VERSION"; BASE="https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/$PLATFORM"; shift ;;
--no-config) WRITE_CONFIG=0 ;;
-h|--help) usage ;;
*) echo "Unknown parameter: $1"; usage ;;
esac
shift
done
CHROME_BIN="$DEST/chrome-$PLATFORM/chrome"
DRIVER_BIN="$DEST/chromedriver-$PLATFORM/chromedriver"
if [ ! -x "$CHROME_BIN" ] || [ ! -x "$DRIVER_BIN" ]; then
mkdir -p "$DEST"
echo "Fetching Chrome for Testing $CHROME_VERSION ($PLATFORM) into $DEST"
for artefact in chrome chromedriver; do
url="$BASE/$artefact-$PLATFORM.zip"
if ! curl -fsSL -o "$DEST/$artefact.zip" "$url"; then
echo "Failed to download $url"
echo "Check the version exists: https://googlechromelabs.github.io/chrome-for-testing/"
exit 1
fi
unzip -q -o "$DEST/$artefact.zip" -d "$DEST"
rm -f "$DEST/$artefact.zip"
done
chmod +x "$CHROME_BIN" "$DRIVER_BIN"
else
echo "Already present at $DEST"
fi
echo "chrome: $("$CHROME_BIN" --version)"
echo "chromedriver: $("$DRIVER_BIN" --version | head -1)"
if [ "$WRITE_CONFIG" = "1" ]; then
CONFIG="$SCRIPT_DIR/client/config.json"
jq --arg b "$CHROME_BIN" --arg d "$DRIVER_BIN" \
'.chrome = {binaryPath: $b, driverPath: $d}' "$CONFIG" > "$CONFIG.tmp" && mv "$CONFIG.tmp" "$CONFIG"
echo "Wrote both paths into client/config.json"
fi