-
Notifications
You must be signed in to change notification settings - Fork 36
/
run
51 lines (39 loc) · 1.17 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
set -eo pipefail
mkdir -p /run/dump1090-fa
DUMP1090_BIN="/usr/local/bin/dump1090"
# Global settings
DUMP1090_CMD=("--quiet")
DUMP1090_CMD+=("--lat" "$LAT")
DUMP1090_CMD+=("--lon" "$LONG")
DUMP1090_CMD+=("--net")
DUMP1090_CMD+=("--fix")
DUMP1090_CMD+=("--gnss")
DUMP1090_CMD+=("--json-location-accuracy" "2")
DUMP1090_CMD+=("--write-json" "/run/dump1090-fa")
DUMP1090_CMD+=("--net-bind-address" "0.0.0.0")
# Handle "--modeac"
if [[ "$ALLOW_MODEAC" == "yes" ]]; then
DUMP1090_CMD+=("--modeac")
fi
# If a BEASTHOST is specified
if [[ -n "$BEASTHOST" ]]; then
DUMP1090_CMD+=("--net-only")
# Default - rtlsdr mode
else
DUMP1090_CMD+=("--device-type" "rtlsdr")
if [[ -n "$DUMP1090_DEVICE" ]]; then
DUMP1090_CMD+=("--device" "$DUMP1090_DEVICE")
fi
if [[ -n "$RTLSDR_PPM" ]]; then
DUMP1090_CMD+=("--ppm" "$RTLSDR_PPM")
fi
if [[ -n "$RTLSDR_GAIN" ]]; then
DUMP1090_CMD+=("--gain" "$RTLSDR_GAIN")
fi
fi
# shellcheck disable=SC2016
"${DUMP1090_BIN}" "${DUMP1090_CMD[@]}" \
2>&1 | stdbuf -o0 awk '{print "[dump1090] " strftime("%Y/%m/%d %H:%M:%S", systime()) " " $0}'
sleep 5