shrub/nix/pkgs/pill/solid.sh

100 lines
2.3 KiB
Bash
Raw Normal View History

source $stdenv/setup
set -euo pipefail
ARVO=${ARVO?:ARVO location is unset}
cp -r $src ./pier
chmod -R u+rw ./pier
urbit -d ./pier
cleanup () {
if [ -f ./pier/.vere.lock ]; then
kill $(< ./pier/.vere.lock) || true
fi
}
trap cleanup EXIT
2022-04-05 19:26:44 +03:00
port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1)
lensa() {
# -f elided, this can hit server-side timeouts
curl -s \
--data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \
"http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g'
}
lensf() {
# -f elided, this can hit server-side timeouts
d=$(echo $1 | sed 's/\./\//g')
curl -sJO \
--data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"output-pill\":\"$d\"}}" \
"http://localhost:$port"
}
header "updating %base"
# Update pill strategy to ensure correct staging
2022-04-05 19:26:44 +03:00
lensa hood "+hood/mount /=base="
2022-04-05 19:26:44 +03:00
until [ -d ./pier/base ]; do
sleep 1
done
# Update :lens, :dojo and dependencies
# FIXME: reduce this list
2022-04-05 19:26:44 +03:00
cp $ARVO/app/lens.hoon ./pier/base/app/
cp $ARVO/app/dojo.hoon ./pier/base/app/
cp $ARVO/lib/plume.hoon ./pier/base/lib/
cp $ARVO/lib/server.hoon ./pier/base/lib/
cp $ARVO/lib/sole.hoon ./pier/base/lib/
cp $ARVO/lib/xray.hoon ./pier/base/lib/
cp $ARVO/lib/pprint.hoon ./pier/base/lib/
2022-04-05 19:26:44 +03:00
mkdir -p ./pier/base/mar/lens/
2022-04-05 19:26:44 +03:00
cp $ARVO/mar/lens/* ./pier/base/mar/lens/
2022-04-05 19:26:44 +03:00
cp $ARVO/sur/lens.hoon ./pier/base/sur/
cp $ARVO/sur/plum.hoon ./pier/base/sur/
cp $ARVO/sur/sole.hoon ./pier/base/sur/
cp $ARVO/sur/xray.hoon ./pier/base/sur/
# Update +solid and its dependencies
2022-04-05 19:26:44 +03:00
cp $ARVO/lib/pill.hoon ./pier/base/lib/
cp $ARVO/gen/solid.hoon ./pier/base/gen/
2022-04-05 19:26:44 +03:00
chmod -R u+rw ./pier/base/
2022-04-05 19:26:44 +03:00
lensa hood "+hood/commit %base"
lensa hood "+hood/unmount %base"
# FIXME: horrible hack to ensure the update is applied first
sleep 10
2022-04-05 19:26:44 +03:00
header "updating %stage"
# Stage new desk for pill contents
2022-04-05 19:26:44 +03:00
lensa hood '+hood/merge %stage our %base'
lensa hood "+hood/mount /=stage="
until [ -d ./pier/stage ]; do
sleep 1
done
rm -rf ./pier/stage
cp -r $ARVO ./pier/stage
chmod -R u+rw ./pier/stage
2022-04-05 19:26:44 +03:00
lensa hood "+hood/commit %stage"
lensa hood "+hood/unmount %stage"
header "running +solid"
lensf solid.pill '+solid /=stage=/sys, =dub &'
lensa hood '+hood/exit'
stopNest