diff options
| author | polwex <polwex@sortug.com> | 2025-10-06 01:01:41 +0700 |
|---|---|---|
| committer | polwex <polwex@sortug.com> | 2025-10-06 01:01:41 +0700 |
| commit | c4b392a179048f936c062f5ffccc2bc25627e500 (patch) | |
| tree | 09be0904be8ec4d7ea52992ef7580d42ed0c28c1 /vere/boot-fake-ship.sh | |
working
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..785f3ce --- /dev/null +++ b/vere/boot-fake-ship.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -xeuo pipefail + +urbit_binary=$GITHUB_WORKSPACE/$URBIT_BINARY +solid_pill=$GITHUB_WORKSPACE/solid.pill + +curl -LJ -o $solid_pill https://github.com/urbit/urbit/raw/84ebb321314b3fbc08253de5213f19450ffbfb3e/bin/solid.pill +curl -LJ -o urbit.tar.gz https://github.com/urbit/urbit/archive/84ebb321314b3fbc08253de5213f19450ffbfb3e.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 $solid_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 |
