Files
mi8-platina-linux/scripts/phone-mesh-dispatcher.sh
T
shenlei 139bb1fc21
Offline project checks / check (push) Canceled after 0s
feat(mesh): integrate MeshPort/EasyTier P2P mesh network with NetworkManager auto-connect
- Add platina-mesh CLI (scripts/phone-mesh.py) for status inspection, control, and JSON telemetry.
- Add OpenRC service (scripts/phone-mesh.openrc) for managing easytier-core daemon.
- Add NetworkManager dispatcher hook (scripts/phone-mesh-dispatcher.sh) to automatically start mesh when external default route is active and stop when disconnected.
- Add default mesh configuration (scripts/easytier.conf) with node identity Platina (192.168.20.10).
- Integrate mesh runtime into image overlay builder (scripts/image-runtime.py).
- Add unit tests for mesh control and image runtime integration (142 tests passing).
2026-11-10 09:50:00 +09:00

33 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# Platina Linux MeshPort / EasyTier auto-connect dispatcher
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
interface="${1:-}"
action="${2:-}"
# Ignore virtual tun/tap/dummy devices created by mesh networking
case "$interface" in
lo|tun*|tap*|dummy*) exit 0 ;;
esac
case "$action" in
up|dhcp4-change|reapply)
# Check if an active default route to the external network exists
if ip route show default 2>/dev/null | grep -q 'default via'; then
if [ -x /usr/local/sbin/platina-mesh ]; then
/usr/local/sbin/platina-mesh --auto-up >/dev/null 2>&1 || true
fi
fi
;;
down)
# If no default route remains, stop mesh service to conserve battery
if ! ip route show default 2>/dev/null | grep -q 'default via'; then
if [ -x /usr/local/sbin/platina-mesh ]; then
/usr/local/sbin/platina-mesh --auto-down >/dev/null 2>&1 || true
fi
fi
;;
esac
exit 0