#!/usr/bin/env bash # founder-crossfeed-inboxes.sh — FOUNDER-RUN as root. # Cross-vertical inbox interconnect under /home/_crossfeed/inbox/. # Semantics per dir: owner=, group=users, mode 3775 # (setgid+sticky): any vertical may CREATE files in any inbox; only the # file's author or the inbox OWNER may move/delete. Homes stay 700. set -uo pipefail [ "$(id -un)" = root ] || { echo "run as: sudo bash $0" >&2; exit 1; } declare -A VMAP=( [bod]=TSGBOD [cco]=TSGCCO [cto]=TSGCTO [coo]=TSGCOO [founder]=reachableceo ) echo "== preflight ==" for v in "${!VMAP[@]}"; do acct=${VMAP[$v]}; id "$acct" >/dev/null 2>&1 || { echo "missing acct $acct" >&2; exit 1; } done echo "ok: all five accounts exist" echo "== create inbox tree ==" for v in bod cco cto coo founder; do acct=${VMAP[$v]} d=/home/_crossfeed/inbox/$v mkdir -p "$d" chown "$acct":users "$d" chmod 3775 "$d" echo " $d -> $acct:users 3775" done echo "== update crossfeed README ==" grep -q 'inbox/' /home/_crossfeed/README.md || cat >> /home/_crossfeed/README.md <<'EOF' ## inbox/ — cross-vertical direct messaging (2026-08-28) /home/_crossfeed/inbox// — mode 3775, owner is the receiving vertical, group users. Any vertical may DROP a file in any inbox (name: MSG---.md). Only the author or the receiving vertical consumes/moves/deletes. This is for lightweight cross-vertical coordination when a Redmine/Discourse round trip is overkill; requests with teeth still go via the founder or systems of record, never MSG files. Receiving PMO scans own inbox at turn start (alongside peers' STATUS). EOF echo " README updated" echo "== drop NOTICE into each vertical's inbox-pmo ==" for v in bod cco cto coo; do acct=${VMAP[$v]} home=$(getent passwd "$acct" | cut -d: -f6) [ -d "$home/.coordinate/inbox-pmo" ] || continue cat > "$home/.coordinate/inbox-pmo/NOTICE-crossfeed-inbox.md" <<'EOF' Founder directive: /home/_crossfeed/inbox// is live. Cross-vertical direct messaging: any PMO may drop MSG---.md in another vertical's inbox (dirs 3775: anyone creates, only author or inbox owner removes). Scan YOUR inbox at turn start. Lightweight coordination only — requests with teeth go via the founder or systems of record. Archive this notice after reading. EOF chown "$acct:$acct" "$home/.coordinate/inbox-pmo/NOTICE-crossfeed-inbox.md" echo " NOTICE -> $acct" done echo "== verify ==" ls -la /home/_crossfeed/inbox/