summaryrefslogtreecommitdiff
path: root/scripts/install-freebsd.sh
diff options
context:
space:
mode:
authorinfo@mode42.com <info@mode42.com>2026-08-07 18:23:28 +0000
committerinfo@mode42.com <info@mode42.com>2026-08-07 18:23:28 +0000
commitfa05a5f8238e9e1417235711656e5062ccc843a7 (patch)
tree46fbbd18de54492b59307c16efcc7f3152723238 /scripts/install-freebsd.sh
Initial push
Diffstat (limited to 'scripts/install-freebsd.sh')
-rwxr-xr-xscripts/install-freebsd.sh111
1 files changed, 111 insertions, 0 deletions
diff --git a/scripts/install-freebsd.sh b/scripts/install-freebsd.sh
new file mode 100755
index 0000000..3cc89ed
--- /dev/null
+++ b/scripts/install-freebsd.sh
@@ -0,0 +1,111 @@
+#!/usr/bin/env bash
+# install-freebsd.sh — MAX25-Stack-Lite FreeBSD build + install (daemon, max25-bcpr, terminal, CRDOP/OSS)
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+PREFIX="${PREFIX:-/usr/local}"
+ETC="${ETC:-${PREFIX}/etc/max25}"
+INSTALL_DEPS=0
+BUILD_ONLY=0
+BUILD_DIR="${BUILD_DIR:-build}"
+
+usage() {
+ cat <<EOF
+MAX25-Stack-Lite install — FreeBSD
+
+Usage: $0 [options]
+
+Options:
+ --deps Install pkg build/runtime dependencies
+ --build-only Build only, do not install
+ --prefix DIR Install prefix (default: /usr/local)
+ --build-dir D CMake build dir (default: build)
+ -h, --help This help
+
+Build (default): max25d, max25-bcpr, max25-terminal, CRDOP (OSS audio)
+
+After install:
+ sudo mkdir -p /var/run/max25 ${ETC}
+ sudo cp ${PREFIX}/share/max25/max25d.lite.bcpr.ini.example ${ETC}/max25d.ini
+ sudo cp ${PREFIX}/share/max25-bcpr/max25-bcpr.freebsd.ini.example ${ETC}/max25-bcpr.ini
+ sudo max25-bcpr-ctl start --ini ${ETC}/max25-bcpr.ini
+ sudo ${ROOT}/scripts/run-max25d.sh ${ETC}/max25d.ini
+
+Doc index: docs/README.md (stub — depth docs live in the research vault)
+EOF
+}
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --deps) INSTALL_DEPS=1; shift ;;
+ --build-only) BUILD_ONLY=1; shift ;;
+ --prefix) PREFIX="$2"; shift 2 ;;
+ --build-dir) BUILD_DIR="$2"; shift 2 ;;
+ -h|--help) usage; exit 0 ;;
+ *) echo "Unknown option: $1" >&2; usage; exit 1 ;;
+ esac
+done
+
+if [[ "$(uname -s)" != "FreeBSD" ]]; then
+ echo "install-freebsd.sh: FreeBSD only" >&2
+ exit 1
+fi
+
+echo "== MAX25 install: $(uname -s) $(uname -m) → ${PREFIX} =="
+
+if [[ "$INSTALL_DEPS" -eq 1 ]]; then
+ pkgs=(cmake python3 ncurses sox git gmake pkgconf)
+ echo "Installing packages: ${pkgs[*]}"
+ pkg install -y "${pkgs[@]}"
+fi
+
+BUILD_DIR="${BUILD_DIR}" "${ROOT}/scripts/build-freebsd.sh"
+
+if [[ "$BUILD_ONLY" -eq 1 ]]; then
+ echo "== build done (no install) =="
+ exit 0
+fi
+
+echo "-- install to ${PREFIX}"
+if [[ "$(id -u)" -eq 0 ]]; then
+ cmake --install "${ROOT}/${BUILD_DIR}" --prefix "${PREFIX}"
+else
+ sudo cmake --install "${ROOT}/${BUILD_DIR}" --prefix "${PREFIX}"
+fi
+
+_install_ini() {
+ local src="$1" dst="$2"
+ if [[ ! -f "$dst" ]] && [[ -f "$src" ]]; then
+ mkdir -p "$(dirname "$dst")"
+ if [[ "$(id -u)" -eq 0 ]]; then
+ cp "$src" "$dst"
+ else
+ sudo cp "$src" "$dst"
+ fi
+ echo " installed $dst (from example)"
+ fi
+}
+
+if [[ "$(id -u)" -eq 0 ]] || sudo -n true 2>/dev/null; then
+ _install_ini "${ROOT}/share/max25-bcpr/max25-bcpr.freebsd.ini.example" "${ETC}/max25-bcpr.ini"
+ _install_ini "${ROOT}/share/max25/max25d.lite.bcpr.ini.example" "${ETC}/max25d.ini"
+fi
+
+echo ""
+echo "== MAX25-Stack-Lite installed to ${PREFIX} =="
+echo " max25d, max25-terminal → ${PREFIX}/bin"
+echo " max25-bcpr-ctl, max25-bcprd-init → ${PREFIX}/sbin"
+echo " examples → ${PREFIX}/share/max25/"
+echo ""
+echo "Next steps (PC-COM / ExSys cuau2 — edit INI before live RF):"
+echo " pw groupmod dialer -m \$USER"
+echo " sudo mkdir -p /var/run/max25 ${ETC}"
+echo " sudo chown \$USER:dialer /var/run/max25"
+echo " # ${ETC}/max25-bcpr.ini: serial=/dev/cuau2 iobase=0xd090 irq=36"
+echo " # ${ETC}/max25d.ini: [daemon] user=… group=dialer"
+echo " sudo max25-bcpr-ctl start --ini ${ETC}/max25-bcpr.ini"
+echo " sudo ${ROOT}/scripts/run-max25d.sh ${ETC}/max25d.ini"
+echo " max25-terminal -H 127.0.0.1 -p 7325 -d max25e0"
+echo ""
+echo "Optional: CRDOP/OSS → ${PREFIX}/share/crdop/crdop.freebsd.ini.example"
+echo ""
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com