Add live hotspot network diagnostics

This commit is contained in:
2026-07-31 21:01:02 +02:00
parent d1239d66af
commit 37e2cb154e
19 changed files with 490 additions and 11 deletions
+8 -1
View File
@@ -38,7 +38,7 @@ fi
echo "[1/7] Installing operating-system packages"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y ca-certificates curl gnupg git rsync sudo util-linux avahi-daemon sqlite3 android-tools-adb build-essential network-manager wpasupplicant
apt-get install -y ca-certificates curl gnupg git rsync sudo util-linux avahi-daemon sqlite3 android-tools-adb build-essential network-manager wpasupplicant conntrack
node_major=""
if command -v node >/dev/null 2>&1; then
@@ -116,10 +116,13 @@ install -m 0644 "${SCRIPT_DIR}/systemd/pi-car-companion.service" /etc/systemd/sy
install -m 0644 "${SCRIPT_DIR}/systemd/pi-car-companion-update.service" /etc/systemd/system/pi-car-companion-update.service
install -m 0644 "${SCRIPT_DIR}/systemd/pi-car-companion-network.service" /etc/systemd/system/pi-car-companion-network.service
install -m 0644 "${SCRIPT_DIR}/systemd/pi-car-companion-network-configure.service" /etc/systemd/system/pi-car-companion-network-configure.service
install -m 0644 "${SCRIPT_DIR}/systemd/pi-car-companion-network-observer.service" /etc/systemd/system/pi-car-companion-network-observer.service
install -m 0440 "${SCRIPT_DIR}/systemd/pi-car-companion.sudoers" /etc/sudoers.d/pi-car-companion
visudo -cf /etc/sudoers.d/pi-car-companion >/dev/null
install -d -m 0755 /etc/avahi/services
install -m 0644 "${SCRIPT_DIR}/config/pi-car-companion.service.xml" /etc/avahi/services/pi-car-companion.service
install -d -m 0755 /etc/NetworkManager/dnsmasq-shared.d
install -m 0644 "${SCRIPT_DIR}/config/dnsmasq-shared-pi-car-companion.conf" /etc/NetworkManager/dnsmasq-shared.d/pi-car-companion.conf
if [[ ! -f "${CONFIG_DIR}/companion.env" ]]; then
cat > "${CONFIG_DIR}/companion.env" <<EOF
@@ -140,6 +143,7 @@ NETWORK_MANAGER_ENABLED=false
NETWORK_STATUS_PATH=${DATA_DIR}/network-status.json
NETWORK_COMMAND_PATH=${DATA_DIR}/network-command.json
NETWORK_CONFIGURATION_REQUEST_PATH=${DATA_DIR}/network-configuration-request.json
NETWORK_ACTIVITY_PATH=${DATA_DIR}/network-activity.json
NETWORK_HOTSPOT_INTERFACE=wlan0
NETWORK_UPSTREAM_INTERFACE=wlan1
NETWORK_HOTSPOT_CONNECTION=pi-car-hotspot
@@ -160,6 +164,7 @@ ensure_env_default NETWORK_MANAGER_ENABLED false
ensure_env_default NETWORK_STATUS_PATH "${DATA_DIR}/network-status.json"
ensure_env_default NETWORK_COMMAND_PATH "${DATA_DIR}/network-command.json"
ensure_env_default NETWORK_CONFIGURATION_REQUEST_PATH "${DATA_DIR}/network-configuration-request.json"
ensure_env_default NETWORK_ACTIVITY_PATH "${DATA_DIR}/network-activity.json"
ensure_env_default NETWORK_HOTSPOT_INTERFACE wlan0
ensure_env_default NETWORK_UPSTREAM_INTERFACE wlan1
ensure_env_default NETWORK_HOTSPOT_CONNECTION pi-car-hotspot
@@ -179,10 +184,12 @@ echo "[6/7] Enabling start-on-boot services"
systemctl daemon-reload
systemctl enable --now avahi-daemon
systemctl enable pi-car-companion.service
systemctl enable pi-car-companion-network-observer.service
if grep -qx 'NETWORK_MANAGER_ENABLED=true' "${CONFIG_DIR}/companion.env"; then
systemctl enable --now pi-car-companion-network.service
fi
systemctl restart pi-car-companion.service
systemctl restart pi-car-companion-network-observer.service
echo "[7/7] Verifying the service"
for _attempt in {1..20}; do