mirror of
https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git
synced 2024-12-04 11:40:09 +00:00
fixup adsbx stats UUID (#137)
fixup adsbx stats UUID in cases where UUID and adsbx specific uuids differ, there was a bug of UUID_FILE being set to /run/uuid by adsbx-stats script in /etc/default/adsbexchange-stats the json-status script should read from UUID_FILE=/usr/local/share/adsbexchange/adsbx-uuid just export ADSBX_UUID in adsbx-stats which then invokes adsbexchange-json-status. in there use ADSBX_UUID instead of doing the redirect via the UUID file cleanup the whole configuration file stuff for adsbx-stats, just customize json-status a bit also speed up build as build-essential doesn't need to be installed on the mlat-client baseimage, it already has it
This commit is contained in:
commit
8cf302610c
4 changed files with 24 additions and 30 deletions
|
@ -3,9 +3,10 @@ FROM ghcr.io/sdr-enthusiasts/docker-baseimage:mlatclient AS buildimage
|
||||||
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=bind,source=./,target=/app/ \
|
--mount=type=bind,source=./,target=/app/ \
|
||||||
apt-get update -q -y && \
|
# this baseimage has build-essential installed, no need to install it
|
||||||
apt-get install -o Dpkg::Options::="--force-confnew" -y --no-install-recommends -q \
|
#apt-get update -q -y && \
|
||||||
build-essential && \
|
#apt-get install -o Dpkg::Options::="--force-confnew" -y --no-install-recommends -q \
|
||||||
|
# build-essential && \
|
||||||
gcc -static /app/downloads/distance-in-meters.c -o /distance -lm -O2
|
gcc -static /app/downloads/distance-in-meters.c -o /distance -lm -O2
|
||||||
|
|
||||||
FROM ghcr.io/sdr-enthusiasts/docker-tar1090:latest
|
FROM ghcr.io/sdr-enthusiasts/docker-tar1090:latest
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# DEPRECATED, see ./rootfs/usr/local/bin/adsbexchange-json-status
|
||||||
|
|
||||||
#
|
#
|
||||||
# Upload output data from decoder to remote server
|
# Upload output data from decoder to remote server
|
||||||
#
|
#
|
||||||
|
|
|
@ -35,29 +35,25 @@ fi
|
||||||
# prep work:
|
# prep work:
|
||||||
mkdir -p /run/adsbexchange-stats
|
mkdir -p /run/adsbexchange-stats
|
||||||
|
|
||||||
# Install the Stats package:
|
|
||||||
if [[ ! -f /etc/default/adsbexchange-stats ]]; then
|
|
||||||
echo -e "UUID_FILE=/run/uuid\nJSON_PATHS=(\"/run/readsb\")" > /etc/default/adsbexchange-stats
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set the UUID:
|
# set the UUID:
|
||||||
if [[ ! -f /usr/local/share/adsbexchange/adsbx-uuid ]]; then
|
|
||||||
# get UUID from ULTRAFEEDER_CONFIG if it exists
|
# get UUID from ULTRAFEEDER_CONFIG if it exists
|
||||||
for entry in "${READSB_CONF_ARR[@]}"; do
|
for entry in "${READSB_CONF_ARR[@]}"; do
|
||||||
|
echo "$entry"
|
||||||
if echo "$entry" | grep -q 'adsbexchange.*uuid'; then
|
if echo "$entry" | grep -q 'adsbexchange.*uuid'; then
|
||||||
ADSBX_UUID="$(sed 's|.*adsbexchange.*uuid=\([a-f0-9-]\+\).*|\1|g' <<< "$entry")"
|
ADSBX_UUID="$(sed 's|.*adsbexchange.*uuid=\([a-f0-9-]\+\).*|\1|g' <<< "$entry")"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
ADSBX_UUID="${ADSBX_UUID:-${UUID}}" || true # ...else get it from the UUID param
|
ADSBX_UUID="${ADSBX_UUID:-${UUID}}" || true # ...else get it from the UUID param
|
||||||
ADSBX_UUID="${ADSBX_UUID:-$(cat /proc/sys/kernel/random/uuid 2>/dev/null)}" || true # ...else generate a random one
|
ADSBX_UUID="${ADSBX_UUID:-$(cat /proc/sys/kernel/random/uuid 2>/dev/null)}" || true # ...else generate a random one
|
||||||
|
|
||||||
if [[ -n "$ADSBX_UUID" ]]; then
|
if [[ -n "$ADSBX_UUID" ]]; then
|
||||||
mkdir -p /usr/local/share/adsbexchange
|
# export the variable, it's used by json-status which is started by this script at the very end
|
||||||
echo "$ADSBX_UUID" > /usr/local/share/adsbexchange/adsbx-uuid
|
export ADSBX_UUID
|
||||||
"${s6wrap[@]}" echo "Using UUID $ADSBX_UUID for AdsbExchange"
|
"${s6wrap[@]}" echo "Using UUID $ADSBX_UUID for AdsbExchange"
|
||||||
else
|
else
|
||||||
"${s6wrap[@]}" echo "WARNING: no UUID can be identified to be used with AdsbExchange; a random one will be generated every time the container is started."
|
"${s6wrap[@]}" echo "WARNING: no UUID can be identified to be used with AdsbExchange; a random one will be generated every time the container is started."
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# wait until readsb is established...
|
# wait until readsb is established...
|
||||||
if ! pgrep readsb >/dev/null; then
|
if ! pgrep readsb >/dev/null; then
|
||||||
|
|
|
@ -17,7 +17,7 @@ DNS_IGNORE_LOCAL=1
|
||||||
|
|
||||||
# List all paths, IN PREFERRED ORDER, separated by a SPACE
|
# List all paths, IN PREFERRED ORDER, separated by a SPACE
|
||||||
# By default, only use the json from the feed client
|
# By default, only use the json from the feed client
|
||||||
JSON_PATHS=("/run/adsbexchange-feed")
|
JSON_PATHS=("/run/readsb")
|
||||||
|
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
# If you know what you're doing, and you want to override the search path, you can do it easily in
|
# If you know what you're doing, and you want to override the search path, you can do it easily in
|
||||||
|
@ -27,11 +27,6 @@ JSON_PATHS=("/run/adsbexchange-feed")
|
||||||
# You can enable this old path by setting "USE_OLD_PATH=1", preferrably in /etc/default/adsbexchange-stats
|
# You can enable this old path by setting "USE_OLD_PATH=1", preferrably in /etc/default/adsbexchange-stats
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
|
|
||||||
# UUID file
|
|
||||||
UUID_FILE="/boot/adsbx-uuid"
|
|
||||||
if [[ ! -f "$UUID_FILE" ]]; then
|
|
||||||
UUID_FILE="/usr/local/share/adsbexchange/adsbx-uuid"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# source local overrides (commonly the JSON_PATH, or DNS cache settings)
|
# source local overrides (commonly the JSON_PATH, or DNS cache settings)
|
||||||
if [ -r /etc/default/adsbexchange-stats ]; then
|
if [ -r /etc/default/adsbexchange-stats ]; then
|
||||||
|
@ -95,7 +90,7 @@ while [ "x$JSON_DIR" = "x" ]; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
UUID=$(cat $UUID_FILE)
|
UUID=$ADSBX_UUID
|
||||||
|
|
||||||
if ! [[ $UUID =~ ^\{?[A-F0-9a-f]{8}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{12}\}?$ ]]; then
|
if ! [[ $UUID =~ ^\{?[A-F0-9a-f]{8}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{12}\}?$ ]]; then
|
||||||
# Data in UUID file is invalid
|
# Data in UUID file is invalid
|
||||||
|
|
Loading…
Reference in a new issue