summaryrefslogtreecommitdiff
path: root/scripts/install-max25.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-max25.sh
Initial push
Diffstat (limited to 'scripts/install-max25.sh')
-rwxr-xr-xscripts/install-max25.sh116
1 files changed, 116 insertions, 0 deletions
diff --git a/scripts/install-max25.sh b/scripts/install-max25.sh
new file mode 100755
index 0000000..44e3eb4
--- /dev/null
+++ b/scripts/install-max25.sh
@@ -0,0 +1,116 @@
+#!/usr/bin/env bash
+# install-max25.sh — MAX25-Stack-Lite build and install on Linux (daemon, bcpr, terminal, tests).
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+PREFIX="${PREFIX:-/usr/local}"
+INSTALL_DEPS=0
+BUILD_ONLY=0
+BUILD_DIR="${BUILD_DIR:-build}"
+
+usage() {
+ cat <<EOF
+MAX25-Stack-Lite install — Linux
+
+Usage: $0 [options]
+
+Options:
+ --deps Install apt build 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
+
+After install:
+ run-max25d
+ ./scripts/tx-rx-test.sh --device modem --live # from the source tree; RX before TX (§0.20)
+ run-max25-terminal -U /run/max25/modem.sock
+
+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)" != "Linux" ]]; then
+ echo "install-max25.sh: Linux only" >&2
+ exit 1
+fi
+
+echo "== MAX25 install: $(uname -s) $(uname -m) → ${PREFIX} =="
+
+if [[ "$INSTALL_DEPS" -eq 1 ]]; then
+ if command -v apt-get >/dev/null 2>&1; then
+ sudo apt-get update
+ pkgs=(build-essential make cmake pkg-config git python3 libncurses-dev libasound2-dev)
+ sudo apt-get install -y "${pkgs[@]}" || true
+ fi
+fi
+
+cd "$ROOT"
+echo "-- cmake (BCPR+TERMINAL+DAEMON ON — max25-bcpr default)"
+cmake -B "${BUILD_DIR}" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DMAX25_BUILD_MAX25_BCPR=ON \
+ -DMAX25_BUILD_TERMINAL=ON \
+ -DMAX25_BUILD_DAEMON=ON \
+ -DMAX25_BUNDLE_AX25=OFF
+cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 2)"
+
+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 "${BUILD_DIR}" --prefix "$PREFIX"
+else
+ sudo cmake --install "${BUILD_DIR}" --prefix "$PREFIX"
+fi
+
+echo ""
+echo "== MAX25 installed to ${PREFIX} =="
+echo " max25d, kiss_bridge.py, max25-terminal, max25-ctl -> ${PREFIX}/bin"
+echo " max25-bcpr-ctl -> ${PREFIX}/sbin (when MAX25_BUILD_MAX25_BCPR=ON)"
+echo " examples -> ${PREFIX}/share/max25/"
+echo ""
+
+echo ""
+echo "Next steps (serial TNC / USB KISS):"
+echo " sudo usermod -aG dialout \$USER # serial access"
+echo " sudo cp share/max25/max25d.lite.ini.example /etc/max25/max25d.ini"
+echo " sudo max25d -c /etc/max25/max25d.ini"
+echo " max25-terminal -U /run/max25/modem.sock"
+echo ""
+echo "BayCom/based (max25-bcpr): built by default (MAX25_BUILD_MAX25_BCPR=ON)."
+echo " See stacks/max25-bcpr/README.md · share/max25-bcpr/max25-bcpr.ini.example"
+echo ""
+ETC="${ETC:-/etc/max25}"
+if [[ "$(id -u)" -eq 0 ]] || sudo -n true 2>/dev/null; then
+ _install_ini() {
+ local src="$1" dst="$2"
+ if [[ ! -f "$dst" ]] && [[ -f "$src" ]]; then
+ mkdir -p "$ETC"
+ if [[ "$(id -u)" -eq 0 ]]; then
+ cp "$src" "$dst"
+ else
+ sudo cp "$src" "$dst"
+ fi
+ echo " installed $dst (from example)"
+ fi
+ }
+ _install_ini "$ROOT/share/max25-bcpr/max25-bcpr.ini.example" "$ETC/max25-bcpr.ini"
+ if [[ -f "$ETC/bcpr.ini" ]] && [[ ! -L "$ETC/max25-bcpr.ini" ]]; then
+ echo " note: legacy $ETC/bcpr.ini kept — paths /tmp/bcpr auto-map to /tmp/max25-bcpr at runtime"
+ fi
+fi
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com