Enhance 5G modem management with integrated web GUI and connection control

- Introduced a web GUI for managing 5G connections, replacing the standalone 5g-router service.
- Updated scripts to ensure exclusive access to the AT port, preventing conflicts.
- Improved troubleshooting documentation in 5G_MODEM_TROUBLESHOOTING.md, adding checks for processes using the AT port.
- Enhanced connection management in the web app, including auto-connect and detailed status APIs.
- Updated installation scripts to reflect changes in service management and dependencies.
This commit is contained in:
nearxos
2026-02-02 10:34:25 +02:00
parent 78f7ccc6db
commit 9dc35a57a2
14 changed files with 1224 additions and 115 deletions

View File

@@ -2,7 +2,11 @@
# Alpine 5G Router install/deploy scripts and config to this device
# Run from repo root: ./scripts/install.sh
# Or from scripts/: ./install.sh (uses script dir to find repo root)
# Rev: 1 (see REVISION in repo root)
# Rev: 2 (see REVISION in repo root)
#
# NOTE: As of Rev 2, 5g-webgui handles both Web GUI AND 5G connection management.
# The standalone 5g-router service is kept for manual/fallback use but is
# NOT enabled by default. Use 5g-webgui instead.
set -e
@@ -27,7 +31,7 @@ else
echo "Keeping existing $CONFIG"
fi
# Scripts
# Scripts (kept for manual use and diagnostics)
install -m 755 "$SCRIPTS/connect-5g.sh" "$BIN/connect-5g.sh"
install -m 755 "$SCRIPTS/status-5g.sh" "$BIN/status-5g.sh"
install -m 755 "$SCRIPTS/modem-status-at.sh" "$BIN/modem-status-at.sh"
@@ -45,9 +49,9 @@ if [ -f "$ROOT/configure_fm350_5g.sh" ]; then
echo "Installed configure_fm350_5g.sh"
fi
# OpenRC service
# Legacy 5g-router service (kept for manual/fallback use, NOT enabled by default)
install -m 755 "$ETC/init.d/5g-router" "$INITD/5g-router"
echo "Installed $INITD/5g-router"
echo "Installed $INITD/5g-router (legacy use 5g-webgui instead)"
# iptables rules (restore at boot ensure iptables-restore service exists)
mkdir -p "$IPTABLES_SAVE"
@@ -57,17 +61,12 @@ if [ -d /etc/init.d ] && [ ! -f /etc/init.d/iptables-restore ]; then
echo "Tip: enable iptables restore at boot: rc-update add iptables-restore"
fi
# Log file
# Log files
touch "$LOG_DIR/5g-router.log" 2>/dev/null && chmod 644 "$LOG_DIR/5g-router.log" || true
touch "$LOG_DIR/speedtest-5g.log" 2>/dev/null && chmod 644 "$LOG_DIR/speedtest-5g.log" || true
touch "$LOG_DIR/5g-webgui.log" 2>/dev/null && chmod 644 "$LOG_DIR/5g-webgui.log" || true
# Enable 5g-router at boot
if command -v rc-update >/dev/null 2>&1; then
rc-update add 5g-router default 2>/dev/null || true
echo "Added 5g-router to default runlevel"
fi
# Web GUI (optional)
# Web GUI with integrated 5G connection management
WEBGUI_SRC="$ROOT/web"
WEBGUI_DEST="/usr/local/share/5g-webgui"
if [ -d "$WEBGUI_SRC" ] && [ -f "$WEBGUI_SRC/app.py" ]; then
@@ -75,14 +74,36 @@ if [ -d "$WEBGUI_SRC" ] && [ -f "$WEBGUI_SRC/app.py" ]; then
cp -r "$WEBGUI_SRC"/* "$WEBGUI_DEST/"
chmod 755 "$WEBGUI_DEST/run.sh" 2>/dev/null || true
install -m 755 "$ETC/init.d/5g-webgui" "$INITD/5g-webgui"
echo "Installed Web GUI at $WEBGUI_DEST. Enable with: rc-update add 5g-webgui default"
echo " Then: apk add python3 py3-flask && service 5g-webgui start"
# Enable 5g-webgui at boot (this now handles connection management)
if command -v rc-update >/dev/null 2>&1; then
rc-update add 5g-webgui default 2>/dev/null || true
echo "Added 5g-webgui to default runlevel"
# Disable old 5g-router if it was enabled
rc-update del 5g-router default 2>/dev/null || true
fi
echo ""
echo "Installed Web GUI with 5G connection management at $WEBGUI_DEST"
echo " Install dependencies: apk add python3 py3-flask && pip install pyserial"
echo " Start service: service 5g-webgui start"
echo " Login at http://<device-ip>:5000 (default: admin/admin, support/support change passwords)"
else
echo "Web GUI source not found; skipping."
echo "Enabling legacy 5g-router service instead..."
if command -v rc-update >/dev/null 2>&1; then
rc-update add 5g-router default 2>/dev/null || true
echo "Added 5g-router to default runlevel"
fi
fi
echo ""
echo "Done. Edit $CONFIG if needed, then: service 5g-router start"
echo "Or run once: $BIN/connect-5g.sh"
echo "Status: $BIN/status-5g.sh"
echo "Done. Edit $CONFIG if needed."
echo ""
echo "To start:"
echo " service 5g-webgui start (recommended: includes Web GUI + 5G connection)"
echo " OR"
echo " service 5g-router start (legacy: 5G connection only, no Web GUI)"
echo ""
echo "Status: Visit http://<device-ip>:5000 or run: $BIN/status-5g.sh"