From 0a1a8d5c334e904c7c3bb20651d2f49a60653695 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Mon, 8 Apr 2024 14:50:15 +0200 Subject: [PATCH 1/3] add rudimentary support for offline maps --- .../etc/s6-overlay/startup.d/04-tar1090-configure | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rootfs/etc/s6-overlay/startup.d/04-tar1090-configure b/rootfs/etc/s6-overlay/startup.d/04-tar1090-configure index ab4561a..7fdfae2 100755 --- a/rootfs/etc/s6-overlay/startup.d/04-tar1090-configure +++ b/rootfs/etc/s6-overlay/startup.d/04-tar1090-configure @@ -190,6 +190,20 @@ fi } >> "${TAR1090_INSTALL_DIR}/html-webroot/config.js" +# https://github.com/wiedehopf/adsb-wiki/wiki/offline-map-tiles-tar1090 +# volumes: +# - /usr/local/share/osm_tiles_offline:/usr/local/share/osm_tiles_offline +# in case offlinemaps is used, configure via config.js +MAX_OFFLINE="" +for i in {0..15}; do + if [[ -d /usr/local/share/osm_tiles_offline/$i ]]; then + MAX_OFFLINE=$i + fi +done +if [[ -n "$MAX_OFFLINE" ]]; then + echo "offlineMapDetail=$MAX_OFFLINE;" >> "${TAR1090_INSTALL_DIR}/html-webroot/config.js" +fi + if chk_enabled "$TAR1090_LABEL_GROUND_SHOWALL"; then sed -i 's/this.speed > 5/this.speed >= 0/' "${TAR1090_INSTALL_DIR}/html-webroot/planeObject_*.js" >/dev/null 2>&1 || true fi From 2456bfbf58285c28f84ae439c99037685c80ae20 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Mon, 8 Apr 2024 13:08:33 +0200 Subject: [PATCH 2/3] fix and improve aircraft.csv.gz file updating quiet down tar1090-update a bit --- rootfs/etc/s6-overlay/startup.d/02-tar1090-update | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rootfs/etc/s6-overlay/startup.d/02-tar1090-update b/rootfs/etc/s6-overlay/startup.d/02-tar1090-update index ca17478..2f7ee0a 100755 --- a/rootfs/etc/s6-overlay/startup.d/02-tar1090-update +++ b/rootfs/etc/s6-overlay/startup.d/02-tar1090-update @@ -20,17 +20,20 @@ fi # aircraft-db if [[ "$TAR1090_ENABLE_AC_DB" == "true" ]]; then git ls-remote https://github.com/wiedehopf/tar1090-db | grep refs/heads/csv > "/run/aircraft.csv.gz.version.new" - if ! diff "${TAR1090_INSTALL_DIR}/aircraft.csv.gz.version" "${TAR1090_INSTALL_DIR}/aircraft.csv.gz.version.new"; then - curl -o "${TAR1090_INSTALL_DIR}/aircraft.csv.gz" "https://raw.githubusercontent.com/wiedehopf/tar1090-db/csv/aircraft.csv.gz" - mv -f "/run/aircraft.csv.gz.version.new" "${TAR1090_INSTALL_DIR}/aircraft.csv.gz.version" || true + if ! diff -q "${TAR1090_INSTALL_DIR}/aircraft.csv.gz.version" "/run/aircraft.csv.gz.version.new" &>/dev/null; then + echo "Downloading https://raw.githubusercontent.com/wiedehopf/tar1090-db/csv/aircraft.csv.gz" + if curl --silent --show-error -o "${TAR1090_INSTALL_DIR}/aircraft.csv.gz.tmp" "https://raw.githubusercontent.com/wiedehopf/tar1090-db/csv/aircraft.csv.gz"; then + mv -f "${TAR1090_INSTALL_DIR}/aircraft.csv.gz.tmp" "${TAR1090_INSTALL_DIR}/aircraft.csv.gz" + mv -f "/run/aircraft.csv.gz.version.new" "${TAR1090_INSTALL_DIR}/aircraft.csv.gz.version" + fi fi fi # Print tar1090 version -pushd "${TAR1090_INSTALL_DIR}/git" || exit 1 +pushd "${TAR1090_INSTALL_DIR}/git" >/dev/null || exit 1 if [[ -z "$TAR1090_VERSION" ]]; then TAR1090_VERSION=$(git rev-parse --short HEAD) fi echo "tar1090 version: ${TAR1090_VERSION}" export TAR1090_VERSION -popd || exit 1 +popd >/dev/null || exit 1 From dabfaf70610cf8af794825ddaaca2f646bb05809 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Mon, 8 Apr 2024 17:30:59 +0200 Subject: [PATCH 3/3] further quiet down tar1090-update --- rootfs/tar1090-install.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/rootfs/tar1090-install.sh b/rootfs/tar1090-install.sh index 750bd68..cec7d30 100755 --- a/rootfs/tar1090-install.sh +++ b/rootfs/tar1090-install.sh @@ -4,7 +4,6 @@ set -e trap 'echo "[ERROR] Error in line $LINENO when executing: $BASH_COMMAND"' ERR -renice 10 $$ srcdir=/run/readsb repo="https://github.com/wiedehopf/tar1090" @@ -433,33 +432,3 @@ if [[ $lighttpd == yes ]]; then fi fi -if useSystemd && systemctl show lighttpd 2>/dev/null | grep -qs -F -e 'UnitFileState=enabled' -e 'ActiveState=active'; then - echo "Restarting lighttpd ..." - systemctl restart lighttpd || ! pgrep systemd -fi - -echo -------------- - - -if [[ $nginx == yes ]]; then - echo - echo "To configure nginx for tar1090, please add the following line(s) in the server {} section:" - echo - for service in "${services[@]}"; do - echo "include ${ipath}/nginx-${service}.conf;" - done -fi - -echo -------------- - -if [[ $lighttpd == yes ]]; then - for name in $names; do - echo "All done! Webinterface available at http://$(ip route get 1.2.3.4 | grep -m1 -o -P 'src \K[0-9,.]*')/$name" - done -elif [[ $nginx == yes ]]; then - for name in $names; do - echo "All done! Webinterface once nginx is configured will be available at http://$(ip route get 1.2.3.4 | grep -m1 -o -P 'src \K[0-9,.]*')/$name" - done -else - echo "All done! You'll need to configure your webserver yourself, see ${ipath}/nginx-tar1090.conf for a reference nginx configuration" -fi