Rename the local deterministic launch helper from colibri-smoke-agent to colibri-test-agent, update CLI/TUI/tests/docs, and teach the FreeBSD rc.d service to source /usr/local/etc/colibri/provider.env plus set a service PATH for local spawns.\n\nChecks: cargo fmt --check; ./scripts/check-format.sh; git diff --check; cargo check -p colibri-daemon -p colibri-client -p colibri-glasspane-tui; cargo check -p colibri-client --bins; cargo test -p colibri-client --test live_socket_check -- --nocapture.
114 lines
3.2 KiB
Bash
Executable file
114 lines
3.2 KiB
Bash
Executable file
#!/bin/sh
|
|
# Stage Colibri FreeBSD service files into an ISO/image root.
|
|
#
|
|
# Usage:
|
|
# cargo build --workspace --release
|
|
# scripts/stage-colibri-iso.sh /path/to/image-root
|
|
#
|
|
# Optional env:
|
|
# COLIBRI_STAGE_CHOWN=1 # chown service dirs to colibri:colibri (requires root)
|
|
# COLIBRI_STAGE_INCLUDE_TUI=0 # skip colibri-tui even when built
|
|
# COLIBRI_STAGE_ENABLE=YES # value written in rc.conf sample (default: NO)
|
|
|
|
set -eu
|
|
|
|
if [ "${1:-}" = "" ]; then
|
|
echo "usage: $0 DESTDIR" >&2
|
|
exit 64
|
|
fi
|
|
|
|
DESTDIR=$1
|
|
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
TARGET=${CARGO_TARGET_DIR:-"$ROOT/target"}/release
|
|
|
|
BIN_DIR="$DESTDIR/usr/local/bin"
|
|
RC_DIR="$DESTDIR/usr/local/etc/rc.d"
|
|
ETC_DIR="$DESTDIR/usr/local/etc/colibri"
|
|
NEWSYSLOG_DIR="$DESTDIR/usr/local/etc/newsyslog.conf.d"
|
|
DB_DIR="$DESTDIR/var/db/colibri"
|
|
RUN_DIR="$DESTDIR/var/run/colibri"
|
|
LOG_DIR="$DESTDIR/var/log/colibri"
|
|
|
|
require_bin() {
|
|
if [ ! -x "$TARGET/$1" ]; then
|
|
echo "missing $TARGET/$1; run: cargo build --workspace --release" >&2
|
|
exit 66
|
|
fi
|
|
}
|
|
|
|
copy_bin() {
|
|
require_bin "$1"
|
|
install -m 0555 "$TARGET/$1" "$BIN_DIR/$1"
|
|
}
|
|
|
|
mkdir -p "$BIN_DIR" "$RC_DIR" "$ETC_DIR" "$NEWSYSLOG_DIR" "$DB_DIR" "$RUN_DIR" "$LOG_DIR"
|
|
|
|
copy_bin colibri-daemon
|
|
copy_bin colibri
|
|
copy_bin colibri-test-agent
|
|
|
|
if [ "${COLIBRI_STAGE_INCLUDE_TUI:-1}" != "0" ] && [ -x "$TARGET/colibri-tui" ]; then
|
|
copy_bin colibri-tui
|
|
fi
|
|
|
|
install -m 0555 "$ROOT/packaging/freebsd/colibri_daemon.in" \
|
|
"$RC_DIR/colibri_daemon"
|
|
|
|
install -m 0644 "$ROOT/packaging/freebsd/newsyslog-colibri.conf" \
|
|
"$NEWSYSLOG_DIR/colibri.conf"
|
|
|
|
cat > "$ETC_DIR/rc.conf.sample" <<EOF
|
|
# Colibri control plane service defaults for the Clawdie ISO.
|
|
# Copy or merge into /etc/rc.conf or /etc/rc.conf.d/colibri_daemon.
|
|
colibri_daemon_enable="${COLIBRI_STAGE_ENABLE:-NO}"
|
|
colibri_daemon_user="colibri"
|
|
colibri_daemon_group="colibri"
|
|
colibri_daemon_data_dir="/var/db/colibri"
|
|
colibri_daemon_run_dir="/var/run/colibri"
|
|
colibri_daemon_socket="/var/run/colibri/colibri.sock"
|
|
colibri_daemon_db_path="/var/db/colibri/colibri.sqlite"
|
|
colibri_daemon_logfile="/var/log/colibri/daemon.log"
|
|
colibri_daemon_host="\$(hostname)"
|
|
colibri_cost_mode="smart"
|
|
EOF
|
|
|
|
cat > "$ETC_DIR/README.iso" <<'EOF'
|
|
Colibri ISO staging notes
|
|
=========================
|
|
|
|
Required service account on the target system:
|
|
|
|
pw groupadd colibri
|
|
pw useradd colibri -g colibri -d /var/db/colibri -s /usr/sbin/nologin
|
|
|
|
Runtime validation:
|
|
|
|
service colibri_daemon start
|
|
colibri status
|
|
colibri create-task --title "iso check"
|
|
colibri list-tasks --status queued
|
|
service colibri_daemon stop
|
|
EOF
|
|
|
|
chmod 0750 "$DB_DIR" "$RUN_DIR" "$LOG_DIR"
|
|
|
|
if [ "${COLIBRI_STAGE_CHOWN:-0}" = "1" ]; then
|
|
chown colibri:colibri "$DB_DIR" "$RUN_DIR" "$LOG_DIR"
|
|
fi
|
|
|
|
cat <<EOF
|
|
Staged Colibri into: $DESTDIR
|
|
|
|
Installed:
|
|
/usr/local/bin/colibri-daemon
|
|
/usr/local/bin/colibri
|
|
/usr/local/bin/colibri-test-agent
|
|
/usr/local/etc/rc.d/colibri_daemon
|
|
/usr/local/etc/colibri/rc.conf.sample
|
|
/usr/local/etc/newsyslog.conf.d/colibri.conf
|
|
|
|
Next image integration steps:
|
|
1. Ensure colibri user/group exists in the image.
|
|
2. Merge rc.conf.sample into /etc/rc.conf.d/colibri_daemon or /etc/rc.conf.
|
|
3. Boot image and run docs/ISO-ACCEPTANCE-RUNBOOK.md.
|
|
EOF
|