1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-11-21 21:30:11 +00:00

partial mlat-gps feature commit

This commit is contained in:
kx1t 2024-05-18 16:39:49 -04:00 committed by Matthias Wirth
parent 311e562dbf
commit ca46b9c906
7 changed files with 71 additions and 6 deletions

View file

@ -1,3 +1,14 @@
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base AS build
RUN set -x && \
apt-get update -y && \
apt-get install -q -o Dpkg::Options::="--force-confnew" -y \
git gcc && \
cd / && \
git clone --depth=1 --single-branch https://github.com/sdr-enthusiasts/docker-vesselalert.git && \
cd /docker-vesselalert/src && \
gcc -static distance.c -o distance -lm -Ofast
FROM ghcr.io/sdr-enthusiasts/docker-tar1090:latest FROM ghcr.io/sdr-enthusiasts/docker-tar1090:latest
LABEL org.opencontainers.image.source = "https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder" LABEL org.opencontainers.image.source = "https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder"
@ -58,6 +69,7 @@ RUN TEMP_PACKAGES=() && \
echo "alias nano=\"nano -l\"" >> /root/.bashrc echo "alias nano=\"nano -l\"" >> /root/.bashrc
COPY rootfs/ / COPY rootfs/ /
COPY --from=build /docker-vesselalert/src/distance /usr/local/bin/distance
# Add Container Version # Add Container Version
RUN set -x && \ RUN set -x && \

View file

@ -0,0 +1,2 @@
#!/bin/sh
exec /etc/s6-overlay/scripts/gpsd_mlat_restart

View file

@ -0,0 +1 @@
longrun

View file

@ -0,0 +1,50 @@
#!/command/with-contenv bash
# shellcheck shell=bash disable=SC2015,SC2016,SC1091,SC2001,SC2154
#---------------------------------------------------------------------------------------------
# Copyright (C) 2023-2024, Ramon F. Kolb (kx1t) and contributors
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#---------------------------------------------------------------------------------------------
source /scripts/common
# Check if GPSD_IN has been enabled
if ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_CONFIG" && ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_NET_CONNECTOR"; then
"${s6wrap[@]}" echo "GPSD not enabled - no need to check receiver location"
exec sleep infinity
fi
# Now wait a bit to allow GPS to establish itself
sleep "${GPSD_INITIAL_WAIT:-300}"
# Make sure that receiver.json exists; if it doesn't we need to wait for it
while ! [[ -f /run/readsb/receiver.json ]]; do
sleep 1 & wait $!
done
# Get initial lat/lon/alt
lat="$(jq -r .lat /run/readsb/receiver.json)"
lon="$(jq -r .lon /run/readsb/receiver.json)"
while :; do
sleep "${GPSD_CHECK_INTERVAL:30}" & wait $!
new_lat="$(jq -r .lat /run/readsb/receiver.json)"
new_lon="$(jq -r .lon /run/readsb/receiver.json)"
new_alt="$(jq -r .alt_m_amsl /run/readsb/receiver.json)"
distance="$(nice -n 20 distance "$lat" "$lon" "$new_lat" "$new_lon")"
if (( ${distance%%.*} > ${GPSD_MIN_DISTANCE} )); then
"${s6wrap[@]}" echo "Receiver moved ${distance%%.*} meters - restarting all mlat-clients"
pkill -f "/usr/bin/python3 /usr/bin/mlat-client" >/dev/null 2>&1
fi
done

View file

@ -51,17 +51,17 @@ then
exec sleep infinity exec sleep infinity
fi fi
if [[ -z "$LAT$READSB_LAT" ]]; then if [[ -z "$LAT$READSB_LAT" ]] && ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_CONFIG" && ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_NET_CONNECTOR"; then
"${s6wrap[@]}" --args echo "ERROR: READSB_LAT or LAT must be defined - MLAT will be disabled." "${s6wrap[@]}" --args echo "ERROR: READSB_LAT or LAT must be defined or GPSD must be enabled - MLAT will be disabled."
exec sleep infinity exec sleep infinity
fi fi
if [[ -z "$LONG$READSB_LON" ]]; then if [[ -z "$LONG$READSB_LON" ]] && ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_CONFIG" && ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_NET_CONNECTOR"; then
"${s6wrap[@]}" --args echo "ERROR: READSB_LON or LONG must be defined - MLAT will be disabled." "${s6wrap[@]}" --args echo "ERROR: READSB_LON or LONG must be defined or GPSD must be enabled - MLAT will be disabled."
exec sleep infinity exec sleep infinity
fi fi
if [[ -z "$ALT$READSB_ALT" ]]; then if [[ -z "$ALT$READSB_ALT" ]] && ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_CONFIG" && ! grep -qi "gpsd_in" <<< "$ULTRAFEEDER_NET_CONNECTOR"; then
"${s6wrap[@]}" --args echo "ERROR: READSB_ALT or ALT must be defined - MLAT will be disabled." "${s6wrap[@]}" --args echo "ERROR: READSB_ALT or ALT must be defined or GPSD must be enabled - MLAT will be disabled."
exec sleep infinity exec sleep infinity
fi fi