#!/usr/bin/env bash # Zorruno — MeshCore Phone App Mode v1.0 — 2026-10-03 # Install on beaver; preserves an existing credentials file and leaves the # service stopped until you have entered credentials and explicitly started it. set -euo pipefail if [ "$(id -u)" -ne 0 ]; then echo 'Run with sudo: sudo bash install.sh' >&2 exit 1 fi source_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" command -v docker >/dev/null docker inspect meshcore-webui >/dev/null apt-get update apt-get install -y python3-venv install -d -m 0755 /opt/meshcore-phone-mode python3 -m venv /opt/meshcore-phone-mode/venv /opt/meshcore-phone-mode/venv/bin/python -m pip install -r "$source_dir/requirements.txt" if systemctl is-active --quiet meshcore-phone-mode.service; then systemctl stop meshcore-phone-mode.service fi install -m 0644 "$source_dir/controller.py" /opt/meshcore-phone-mode/controller.py install -m 0644 "$source_dir/requirements.txt" /opt/meshcore-phone-mode/requirements.txt if [ ! -e /etc/meshcore-phone-mode.ini ]; then install -m 0600 "$source_dir/meshcore-phone-mode.ini.example" /etc/meshcore-phone-mode.ini fi install -m 0644 "$source_dir/meshcore-phone-mode.service" /etc/systemd/system/meshcore-phone-mode.service systemctl daemon-reload echo 'Installed. Edit /etc/meshcore-phone-mode.ini locally, then run:' echo 'sudo systemctl enable --now meshcore-phone-mode.service'