aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / scripts / allen / contacts / install-contacts.sh
| 1 | #!/bin/sh |
| 2 | # Build and install allen-contacts-ingest (seeded Omega; system units, User=allen-contacts) |
| 3 | # and the allen-contacts CLI. Layout per CONTRACT.md "Users and directories". |
| 4 | # Usage: OMC=/path/to/seed/out/omc sh install-contacts.sh (uses sudo -n) |
| 5 | # The compiler must be the pinned one: omega-mv 3364a1dfd0ca50c1b82bf19ba34932d8bc10a7a9, |
| 6 | # seed/out/omc sha256 below, reproduced by sh seed/omega-from-seed.sh at that commit. |
| 7 | set -eu |
| 8 | OMC_SHA=befb8199db8c4bca188a494dfaac2a6f0ee5c36fcea11188c75666c55fce8a1d |
| 9 | src=$(cd "$(dirname "$0")" && pwd) |
| 10 | S="sudo -n" |
| 11 | : "${OMC:?set OMC to the pinned seed/out/omc}" |
| 12 | |
| 13 | [ "$(sha256sum "$OMC" | cut -d' ' -f1)" = "$OMC_SHA" ] || { echo "omc is not the pinned compiler" >&2; exit 1; } |
| 14 | tmp=$(mktemp -d) |
| 15 | trap 'rm -rf "$tmp"' EXIT |
| 16 | if nice -n 19 "$OMC" < "$src/allen_contacts_ingest.om" > "$tmp/allen-contacts-ingest" 2> "$tmp/err"; then |
| 17 | : |
| 18 | else |
| 19 | echo "omc refused allen_contacts_ingest.om:" >&2; cat "$tmp/err" >&2; exit 1 |
| 20 | fi |
| 21 | [ ! -s "$tmp/err" ] || { cat "$tmp/err" >&2; exit 1; } |
| 22 | sha256sum "$src/allen_contacts_ingest.om" "$tmp/allen-contacts-ingest" |
| 23 | |
| 24 | $S getent passwd allen-contacts >/dev/null |
| 25 | $S getent group allen-drop >/dev/null |
| 26 | [ -d /var/lib/allen-chat ] || $S install -d -o root -g root -m 0755 /var/lib/allen-chat |
| 27 | $S install -d -o allen-contacts -g allen-drop -m 2730 /var/lib/allen-chat/contacts-drop |
| 28 | $S install -d -o allen-contacts -g allen-contacts -m 0700 /var/lib/allen-contacts \ |
| 29 | /var/lib/allen-contacts/quarantine |
| 30 | |
| 31 | $S install -d -o root -g root -m 0755 /opt/allen-contacts |
| 32 | $S install -o root -g root -m 0755 "$tmp/allen-contacts-ingest" /opt/allen-contacts/ |
| 33 | $S install -o root -g root -m 0644 "$src/allen_contacts_ingest.om" \ |
| 34 | "$src/allen_contacts_ingest.py" /opt/allen-contacts/ |
| 35 | $S install -o root -g root -m 0755 "$src/allen-contacts" /usr/local/bin/allen-contacts |
| 36 | |
| 37 | $S install -o root -g root -m 0644 "$src/allen-contacts-ingest.service" \ |
| 38 | "$src/allen-contacts-ingest.path" /etc/systemd/system/ |
| 39 | $S systemd-analyze verify /etc/systemd/system/allen-contacts-ingest.service \ |
| 40 | /etc/systemd/system/allen-contacts-ingest.path |
| 41 | $S systemctl daemon-reload |
| 42 | $S systemctl enable allen-contacts-ingest.path |
| 43 | $S systemctl restart allen-contacts-ingest.path |
| 44 | systemctl is-active allen-contacts-ingest.path |