Live video on the AT Protocol
1#!/bin/bash
2
3set -euo pipefail
4
5SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6DIR="$(realpath $SCRIPT_DIR/..)"
7
8tart list --format json | jq -r '.[] | select(.State == "running") | .Name' | xargs -L 1 tart stop
9IMAGE=sonoma-$(date +%s)
10tart clone ghcr.io/cirruslabs/macos-sonoma-xcode:15.3 $IMAGE
11bash -c "tart run $IMAGE --no-graphics --dir=streamplace:$DIR --dir=signing:/Volumes/UnlockedKey &"
12while ! tart ip $IMAGE; do echo 'waiting for ip...' && sleep 1; done;
13export EXIT="0"
14cat util/mac-build.sh | sshpass -p admin ssh -o "StrictHostKeyChecking no" admin@$(tart ip $IMAGE) bash -c 'cat > mac-build.sh && bash mac-build.sh' || export EXIT=1
15# tart stop $IMAGE
16# if [[ $EXIT != "0" ]]; then
17# echo "build failed"
18# exit $EXIT
19# fi