okami.mom/albedo
git clone https://git.nkp.pet/okami.mom/albedo
159a58a
main
1#!/usr/bin/env bash 2# Compile the daemon and copy its code into $1 beside a launcher, then print the 3# launcher's path for ALBEDO_DAEMON. Test daemons boot from the copy instead of 4# `gleam run`: none of them takes the build lock, so they boot side by side and 5# beside a running `gleam test`, and a rebuild during the run cannot change the 6# code under a daemon that is still loading modules. 7set -euo pipefail 8root =" $( cd " $( dirname " $ 0" ) /.." && pwd ) " 9out =" $ 1 " 10# A reused directory would keep the previous beams, and `ln -s` would follow its 11# old priv link into the checkout. 12rm -rf " $ out " 13(cd " $ root " && gleam build) >&2 14mkdir -p " $ out " 15for ebin in " $ root " /build/dev/erlang/*/ebin;do 16package =" $( dirname " $ ebin " ) " 17name =" $( basename " $ package " ) " 18mkdir -p " $ out / $ name " 19cp -R " $ ebin " " $ out / $ name /ebin" 20# priv keeps pointing at the source tree, as under `gleam run`. 21if [ -e" $ package /priv" ];then 22ln -s " $( cd " $ package /priv" && pwd -P ) " " $ out / $ name /priv" 23fi 24done 25cat > " $ out /albedo-daemon" <<EOF 26#!/bin/sh 27exec " $ root /priv/bin/albedo-daemon" erl -pa " $ out "/*/ebin -eval 'albedo@@main:run(albedo)' -noshell -extra "\$@" 28EOF 29chmod +x" $ out /albedo-daemon" 30echo " $ out /albedo-daemon"