diff options
author | polwex <polwex@sortug.com> | 2025-10-05 21:56:51 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-10-05 21:56:51 +0700 |
commit | fcedfddf00b3f994e4f4e40332ac7fc192c63244 (patch) | |
tree | 51d38e62c7bdfcc5f9a5e9435fe820c93cfc9a3d /vere/boot-fake-ship.sh |
claude is gud
Diffstat (limited to 'vere/boot-fake-ship.sh')
-rwxr-xr-x | vere/boot-fake-ship.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/vere/boot-fake-ship.sh b/vere/boot-fake-ship.sh new file mode 100755 index 0000000..f9b6362 --- /dev/null +++ b/vere/boot-fake-ship.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -xeuo pipefail + +urbit_binary=$GITHUB_WORKSPACE/$URBIT_BINARY +brass_pill=$GITHUB_WORKSPACE/brass.pill + +curl -LJ -o $brass_pill https://github.com/urbit/urbit/raw/592b957a30b302cb7ae7fea78c6804c9d63d97ef/bin/brass.pill +curl -LJ -o urbit.tar.gz https://github.com/urbit/urbit/archive/592b957a30b302cb7ae7fea78c6804c9d63d97ef.tar.gz + +mkdir ./urbit +tar xfz urbit.tar.gz -C ./urbit --strip-components=1 +cp -RL ./urbit/tests ./urbit/pkg/arvo/tests + +$urbit_binary --lite-boot --daemon --fake bus \ + --bootstrap $brass_pill \ + --arvo ./urbit/pkg/arvo \ + --pier ./pier + +cleanup() { + if [ -f ./pier/.vere.lock ]; then + kill $(< ./pier/.vere.lock) || true + fi + set +x +} + +trap cleanup EXIT +port=$(grep loopback ./pier/.http.ports | awk -F ' ' '{print $1}') + +lensd() { + curl -s \ + --data "{\"source\":{\"dojo\":\"$1\"},\"sink\":{\"stdout\":null}}" \ + "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' +} + +lensa() { + curl -s \ + --data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \ + "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g' +} + +check() { + [ 3 -eq $(lensd 3) ] +} + +lensd '+vat %base' + +if check && sleep 10 && check; then + echo "boot success" + lensa hood '+hood/exit' + while [ -f ./pier/.vere.lock ]; do + echo "waiting for pier to shut down" + sleep 5 + done +else + echo "boot failure" + kill $(< ./pier/.vere.lock) || true + set +x + exit 1 +fi |