Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mcp/blob/main/tools/install.sh # omega-mcp aien-dev/omega-mcp Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mcp / tools / install.sh` 57 lines ยท 3887 bytes Raw Blame History 1 #!/bin/sh 2 # Install this checkout's build/ as a new release beside running servers; never in place. 3 # 4 # tools/install.sh PREFIX NAME 5 # 6 # PREFIX (for example ~/workspace/omega-mcp/build) gains PREFIX/releases/NAME/{omega-mcp,omc,data, 7 # agent-maintenance-mcp,agent-qa-mcp} and the symlink PREFIX/current -> releases/NAME, switched with one 8 # rename. Start the compiler server as PREFIX/current/omega-mcp. The two agent servers are the binaries 9 # tools/register-locked.sh points a locked client file at. 10 # A server finds its compiler, its data and its own in-sandbox reaper beside its real executable 11 # (/proc/self/exe), so a server that is already running keeps the release it started from: a running server 12 # re-executes its own file as the reaper of every compile and run, and a different file at that path breaks it. 13 # Nothing that exists is overwritten or removed. Refused (exit 2): an existing release NAME (with the live 14 # processes that run from it), a PREFIX/current that is not a symlink, and a build/omc that is not the pin. 15 # Rollback: mv -T PREFIX/current.rollback PREFIX/current (prepared when a release was current before). 16 # tools/releases.sh PREFIX lists the releases and the legacy PREFIX/omega-mcp with their live processes. 17 set -eu 18 [ $# -eq 2 ] || { echo "usage: tools/install.sh PREFIX NAME" >&2; exit 2; } 19 prefix=$1 name=$2 20 case $name in ''|.*|*[!A-Za-z0-9._-]*) echo "install.sh: refused: bad release name '$name'" >&2; exit 2 ;; esac 21 src=$(cd "$(dirname "$0")/.." && pwd -P) 22 pin=$(sed -n 's/^omc-sha256 //p' "$src/PIN") 23 got=$(sha256sum "$src/build/omc" | cut -d' ' -f1) 24 [ "$got" = "$pin" ] || { echo "install.sh: refused: build/omc is $got, not the pin $pin (run ./build.sh)" >&2; exit 2; } 25 [ -x "$src/build/omega-mcp" ] && [ -x "$src/build/agent-maintenance-mcp" ] && [ -x "$src/build/agent-qa-mcp" ] && [ -f "$src/build/data/reference.json" ] || { echo "install.sh: refused: build/ is incomplete (run ./build.sh)" >&2; exit 2; } 26 mkdir -p "$prefix/releases" 27 prefix=$(cd "$prefix" && pwd -P) 28 rel=$prefix/releases/$name 29 # live: PIDs whose executable is DIR/omega-mcp 30 live() { for d in /proc/[0-9]*; do [ "$(readlink "$d/exe" 2>/dev/null)" = "$1/omega-mcp" ] && printf ' %s' "${d#/proc/}"; done; true; } 31 if [ -e "$rel" ] || [ -L "$rel" ]; then 32 echo "install.sh: refused: $rel exists; its omega-mcp is the executable of live process(es):$(live "$rel") (none listed = no live process); install under a new NAME" >&2 33 exit 2 34 fi 35 if [ -e "$prefix/current" ] && [ ! -L "$prefix/current" ]; then 36 echo "install.sh: refused: $prefix/current exists and is not a symlink" >&2; exit 2 37 fi 38 prev=$(readlink "$prefix/current" 2>/dev/null || true) 39 tmp=$prefix/releases/.$name.tmp 40 rm -rf "$tmp" 41 mkdir "$tmp" 42 cp -p "$src/build/omega-mcp" "$src/build/agent-maintenance-mcp" "$src/build/agent-qa-mcp" "$src/build/omc" "$tmp/" 43 cp -Rp "$src/build/data" "$tmp/data" 44 [ "$(sha256sum "$tmp/omc" | cut -d' ' -f1)" = "$pin" ] || { echo "install.sh: copy of omc differs" >&2; exit 2; } 45 cmp -s "$tmp/omega-mcp" "$src/build/omega-mcp" || { echo "install.sh: copy of omega-mcp differs" >&2; exit 2; } 46 cmp -s "$tmp/agent-maintenance-mcp" "$src/build/agent-maintenance-mcp" || { echo "install.sh: copy of agent-maintenance-mcp differs" >&2; exit 2; } 47 cmp -s "$tmp/agent-qa-mcp" "$src/build/agent-qa-mcp" || { echo "install.sh: copy of agent-qa-mcp differs" >&2; exit 2; } 48 mv -T "$tmp" "$rel" 49 ln -s "releases/$name" "$prefix/.current.next" 50 mv -T "$prefix/.current.next" "$prefix/current" 51 if [ -n "$prev" ]; then 52 ln -s "$prev" "$prefix/.current.rollback.next" 53 mv -T "$prefix/.current.rollback.next" "$prefix/current.rollback" 54 fi 55 echo "install.sh: $prefix/current -> releases/$name (omega-mcp $(sha256sum "$rel/omega-mcp" | cut -c1-16)..., omc ${pin%"${pin#????????????????}"}...)" 56 [ -n "$prev" ] && echo "install.sh: rollback: mv -T $prefix/current.rollback $prefix/current (-> $prev)" 57 exit 0