Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tar1090-update improvements / rudimentary support for offline tiles #172

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions rootfs/etc/s6-overlay/startup.d/02-tar1090-update
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions rootfs/etc/s6-overlay/startup.d/04-tar1090-configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 0 additions & 31 deletions rootfs/tar1090-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Loading