interplane.Get Omega
Read in your language

omega-mission

Omega Mission: seeded-Omega mission orchestrator (hash-chained journal, tiered command checks). Host-tested; live dispatch not yet run.

Brought by drakestapleton

branch main Branches Tags History

omega-mission / install.sh

28 lines · 1234 bytes Raw Blame History
1#!/bin/sh
2set -eu
3cd "$(dirname "$0")"
4# Installation only; no build, worker dispatch, or service changes.
5[ -x build/mission ] || { echo 'build first' >&2; exit 2; }
6if [ "$#" = 2 ]; then prefix=$1; bindir=$2
7elif [ "$#" = 0 ]; then
8 head=$(git rev-parse HEAD)
9 # The versioned prefix must name the commit the binary was compiled from.
10 [ "$(cat build/mission.head 2>/dev/null)" = "$head" ] || { echo 'build/mission is not built from clean HEAD; run build.sh' >&2; exit 2; }
11 prefix="$HOME/.local/opt/omega-mission/$(printf '%.8s' "$head")"
12 bindir="$HOME/.local/bin"
13else echo 'usage: install.sh [PREFIX BINDIR]' >&2; exit 2
14fi
15link="$bindir/mission"
16[ ! -e "$link" ] || [ -L "$link" ] || { echo "refusing to replace non-symlink $link" >&2; exit 2; }
17if [ -e "$prefix/mission" ]; then
18 # Immutable prefix: identical bytes re-point the link; different bytes refuse.
19 cmp -s build/mission "$prefix/mission" || { echo 'immutable install prefix holds different bytes' >&2; exit 2; }
20else
21 mkdir -p "$prefix"
22 cp build/mission "$prefix/mission.new"
23 chmod 755 "$prefix/mission.new"
24 mv "$prefix/mission.new" "$prefix/mission"
25fi
26mkdir -p "$bindir"
27ln -sfn "$prefix/mission" "$link"
28printf '%s\n' "$link"