1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-12-23 21:02:01 +00:00

hardened LOGLEVEL param handling

This commit is contained in:
kx1t 2024-05-08 10:00:36 -04:00
parent b2fe64b2a6
commit 51970b4934

View file

@ -17,11 +17,9 @@
# If not, see <https://www.gnu.org/licenses/>.
#---------------------------------------------------------------------------------------------
APPNAME="readsb"
source /scripts/common
source /scripts/interpret_ultrafeeder_config
s6wrap=(s6wrap --quiet --timestamps --prepend="${APPNAME}")
s6wrap=(s6wrap --quiet --timestamps --prepend="${SCRIPT_NAME}")
mkdir -p /run/readsb
@ -342,8 +340,11 @@ if chk_enabled "$PROMETHEUS_ENABLE"; then
READSB_CMD+=("--write-prom=/run/readsb-prometheus.prom")
fi
LOGLEVEL="${LOGLEVEL:-verbose}"
# shellcheck disable=SC2086,SC2069
if ! [[ "${LOGLEVEL,,}" =~ ^(verbose|error|none)$ ]]; then
[[ -n "$LOGLEVEL" ]] && "${s6wrap[@]}" --args echo "[WARNING] LOGLEVEL set to an unknown value. Defaulting to \"verbose\"" || true
LOGLEVEL="verbose"
fi
# shellcheck disable=SC2086
if [[ "${LOGLEVEL,,}" == "verbose" ]]; then
exec "${s6wrap[@]}" --args "${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS
elif [[ "${LOGLEVEL,,}" == "error" ]]; then