Skip to content

Commit

Permalink
978 location / service restart cornercase fixup (#211)
Browse files Browse the repository at this point in the history
* skyaware978: use piaware location

* fix docker not being detected in fa_services.tcl

/.dockerenv is not a docker standard don't rely on it
the container uses a custom fa_services.tcl anyhow, just hardcode
is_docker to return 1
  • Loading branch information
wiedehopf authored Oct 21, 2024
1 parent dcbf4c7 commit 53a3625
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/dump1090
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DUMP1090_CMD+=("--write-json" "/run/dump1090-fa")
DUMP1090_CMD+=("--net-bind-address" "0.0.0.0")

# use location from /var/cache/piaware/location.env
source /var/cache/piaware/location.env || true
source /var/cache/piaware/location.env &>/dev/null || true
if [[ -n "$PIAWARE_LAT" ]] && [[ -n "$PIAWARE_LON" ]]; then
DUMP1090_CMD+=("--lat" "$PIAWARE_LAT")
DUMP1090_CMD+=("--lon" "$PIAWARE_LON")
Expand Down
15 changes: 11 additions & 4 deletions rootfs/etc/s6-overlay/scripts/skyaware978
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ fi

mkdir -p /run/skyaware978

set -eo pipefail
ARGS=()
ARGS+=(--connect "${UAT_RECEIVER_HOST:-127.0.0.1}:${UAT_RECEIVER_PORT:-30978}")
ARGS+=(--json-dir "/run/skyaware978")

# use location from /var/cache/piaware/location.env
source /var/cache/piaware/location.env &>/dev/null || true
if [[ -n "$PIAWARE_LAT" ]] && [[ -n "$PIAWARE_LON" ]]; then
ARGS+=("--lat" "$PIAWARE_LAT")
ARGS+=("--lon" "$PIAWARE_LON")
fi

# shellcheck disable=SC2016
exec "${s6wrap[@]}" skyaware978 \
--connect "${UAT_RECEIVER_HOST:-127.0.0.1}:${UAT_RECEIVER_PORT:-30978}" \
--json-dir "/run/skyaware978"
exec "${s6wrap[@]}" skyaware978 "${ARGS[@]}"
9 changes: 5 additions & 4 deletions rootfs/usr/lib/piaware_packages/fa_services.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ namespace eval ::fa_services {
# return 1 if we have invoke-rc.d
proc has_invoke_rcd {} {
# Check if we are running on docker because no runlevel exists to use invoke-rc.d and return immediately 0
if {[is_docker]} {
logger "has_invoke_rcd: Running on docker ignoring invoke-rc.d"
return 0
if {[is_docker]} {
logger "has_invoke_rcd: Running on docker ignoring invoke-rc.d"
return 0
}

if {![info exists ::invoke_rcd_path]} {
Expand Down Expand Up @@ -69,7 +69,8 @@ namespace eval ::fa_services {

# return 1 if it looks like we're using docker
proc is_docker {} {
return [file isfile /.dockerenv]
return 1
#return [file isfile /.dockerenv]
}

# return a list of systemd service unitfiles matching pattern
Expand Down

0 comments on commit 53a3625

Please sign in to comment.