diff options
| author | info@mode42.com <info@mode42.com> | 2026-08-07 18:25:13 +0000 |
|---|---|---|
| committer | info@mode42.com <info@mode42.com> | 2026-08-07 18:25:13 +0000 |
| commit | 04d965d67a7264a1c7c211494aebda1953df7603 (patch) | |
| tree | 0ebd700a6e219f84a26a656f4bee8778bc75da7b /scripts/install-max25.sh | |
Initial push
Diffstat (limited to 'scripts/install-max25.sh')
| -rwxr-xr-x | scripts/install-max25.sh | 116 |
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..c21f673 --- /dev/null +++ b/scripts/install-max25.sh @@ -0,0 +1,116 @@ +#!/usr/bin/env bash +# MainAX25-Stack — 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 +MainAX25-Stack 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 + max25-tx-rx-test --device modem --live + run-max25-terminal -U /run/max25/modem.sock + +See docs/LINUX-HOST-SETUP.md · docs/DEV/TNC-MODEM-DEV.md +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 (TNC host):" +echo " sudo usermod -aG dialout \$USER # serial access" +echo " sudo cp share/max25/max25d.ini.host.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 docs/BAYCOM.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 |
