Skip to content

Commit

Permalink
move adsb.lol station map check out of interpret_ultrafeeder_config (#…
Browse files Browse the repository at this point in the history
…159)

this script is sourced by multiple scripts and we only need to do show
the station map URL once

also curl has long maximum timeouts which can block important services
from starting up if there is an issue with adsb.lol or the network / DNS
  • Loading branch information
fredclausen authored Nov 10, 2024
2 parents 136e88d + 031c3cf commit 245b69e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
Empty file.
2 changes: 2 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/aggregator-urls/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec /etc/s6-overlay/scripts/aggregator-urls
1 change: 1 addition & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/aggregator-urls/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
34 changes: 34 additions & 0 deletions rootfs/etc/s6-overlay/scripts/aggregator-urls
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/command/with-contenv bash
# shellcheck shell=bash disable=SC2015,SC2016,SC1091

#---------------------------------------------------------------------------------------------
# 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
source /scripts/interpret_ultrafeeder_config

# wait 30 seconds for connections to be established
sleep 30

if [[ "${READSB_CONF_ARR[*]}" =~ "in.adsb.lol" ]]; then
myadsblol="$(curl -sLD - https://my.adsb.lol -o /dev/null -w '%{url_effective}' 2>&1 | sed '/location: /h;g;$!d;s/^.* \(.*\)$/\1/')"
if [[ -n "$myadsblol" ]] && [[ ! $myadsblol =~ sorry-but-i-could-not-find-your-receiver ]]; then
"${s6wrap[@]}" echo "ADSB.LOL station map available at $myadsblol"
fi
fi

# one shots have weird behaviour, just use longrun and stop the service once this is done
stop_service
8 changes: 0 additions & 8 deletions rootfs/scripts/interpret_ultrafeeder_config
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ do
done
# Now add $readsb_str to the READSB_CONF_ARR() as --net-connector argument:
READSB_CONF_ARR+=("--net-connector=${readsb_str}")

if [[ ${param[1],,} == "in.adsb.lol" ]]; then
myadsblol="$(curl -sLD - https://my.adsb.lol -o /dev/null -w '%{url_effective}' 2>&1 | sed '/location: /h;g;$!d;s/^.* \(.*\)$/\1/')"
if [[ -n "$myadsblol" ]] && [[ ! $myadsblol =~ sorry-but-i-could-not-find-your-receiver ]]; then
"${s6wrap[@]}" echo "ADSB.LOL station map available at $myadsblol"
fi
fi

;;

mlat)
Expand Down

0 comments on commit 245b69e

Please sign in to comment.