This commit is contained in:
1 parent
2b3e3ec83b
commit
c78f225433
5 files changed
+657
-16
No files matched your search
+14
-11
@@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Case 2 row C2-13a (design 9.3, 10 step 2c): render and install the two
|
||||
# system units a hub runs as (plus P1's proxy with --proxy), [email protected] (enabled as
|
||||
# mosaic-bus@<business>.service) and mosaic-webui.service, from the existing
|
||||
# templates, which it doesn't change.
|
||||
# Case 2 row C2-13a (design 9.3, 10 step 2c): render and install the system
|
||||
# units a hub runs as: [email protected] (enabled as
|
||||
# mosaic-bus@<business>.service) and mosaic-webui.service, plus P1's
|
||||
# mosaic-proxy.service under --proxy, from the existing templates, which it
|
||||
# doesn't change.
|
||||
#
|
||||
# case2-unit.sh --user NAME --home DIR --business ID --copy ID --node PATH
|
||||
# [--profile factory|library] [--proxy] [--pm] [--claude PATH]
|
||||
@@ -10,9 +11,10 @@
|
||||
#
|
||||
# Root runs it from a root-owned checkout of the reviewed commit outside
|
||||
# <home>, never from the release, because <user> can write the release. It
|
||||
# writes both units under /etc/systemd/system as root:root 0644, runs
|
||||
# `systemctl daemon-reload`, enables both, then starts the bus and then the
|
||||
# Console (Q189). Both come back after a boot on their own. It never links
|
||||
# writes the bus and Console units (and the proxy unit under --proxy) under
|
||||
# /etc/systemd/system as root:root 0644, runs `systemctl daemon-reload`,
|
||||
# enables them, then starts the proxy (under --proxy), the bus and the
|
||||
# Console (Q189). They come back after a boot on their own. It never links
|
||||
# a unit file into place. Root only stats files under <home> and reads bounded
|
||||
# stdout from a config/target query run as the stack user through sudo. Root
|
||||
# never imports copy code. This adds sudo and GNU timeout to the installer
|
||||
@@ -464,7 +466,7 @@ render() {
|
||||
fi
|
||||
# The added lines go at the end of [Service], before its trailing blank
|
||||
# lines. In [Install], WantedBy=multi-user.target replaces
|
||||
# WantedBy=default.target in both units, so both start at boot (Q189).
|
||||
# WantedBy=default.target in each unit, so each starts at boot (Q189).
|
||||
printf '%s\n' "$text" | awk -v add="$add" '
|
||||
function blanks_out() { for (; blanks > 0; blanks--) print "" }
|
||||
/^\[.*\]$/ {
|
||||
@@ -567,8 +569,9 @@ WEBUI_TEXT="$(render webui "$WEBUI_TEMPLATE")" || exit 1
|
||||
check_unit bus "$BUS_TEXT" "rendered $BUS_UNIT" "$COPY"
|
||||
check_unit webui "$WEBUI_TEXT" "rendered $WEBUI_UNIT" "$COPY"
|
||||
|
||||
# A re-install: each installed unit passes the same checks, both name one
|
||||
# copy, and each equals the render once its copy id is the new one.
|
||||
# A re-install: each installed unit passes the same checks, the bus and
|
||||
# Console units (and the proxy unit under --proxy) name one copy, and each
|
||||
# equals the render once its copy id is the new one.
|
||||
[ -d "$UNIT_DIR" ] && [ ! -L "$UNIT_DIR" ] || die "no unit directory $UNIT_DIR"
|
||||
installed_ids=''
|
||||
PAIRS=("bus:$BUS_UNIT:BUS_TEXT" "webui:$WEBUI_UNIT:WEBUI_TEXT")
|
||||
@@ -591,7 +594,7 @@ for pair in "${PAIRS[@]}"; do
|
||||
[[ "$old" =~ ^[0-9a-f]{40}$ ]] || die "installed $path names no copy under $COPIES"
|
||||
check_unit "$kind" "$text" "installed $path" "$COPIES/$old"
|
||||
[ "$text" = "$(printf '%s\n' "${!var}" | sed "s|$COPY|$COPIES/$old|g")" ] \
|
||||
|| die "installed $path differs from the render in more than the copy id; the node path, serve flags, --pm and --claude must equal the installed ones"
|
||||
|| die "installed $path differs from the render in more than the copy id; the node path, serve flags, --pm, --claude and --proxy must equal the installed ones"
|
||||
installed_ids="$installed_ids $old"
|
||||
done
|
||||
read -r -a ids <<<"$installed_ids"
|
||||
|
||||
Reference in new issue
Block a user