1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-11-22 05:40:10 +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/>. # If not, see <https://www.gnu.org/licenses/>.
#--------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------
APPNAME="readsb"
source /scripts/common source /scripts/common
source /scripts/interpret_ultrafeeder_config source /scripts/interpret_ultrafeeder_config
s6wrap=(s6wrap --quiet --timestamps --prepend="${APPNAME}") s6wrap=(s6wrap --quiet --timestamps --prepend="${SCRIPT_NAME}")
mkdir -p /run/readsb mkdir -p /run/readsb
@ -342,8 +340,11 @@ if chk_enabled "$PROMETHEUS_ENABLE"; then
READSB_CMD+=("--write-prom=/run/readsb-prometheus.prom") READSB_CMD+=("--write-prom=/run/readsb-prometheus.prom")
fi fi
LOGLEVEL="${LOGLEVEL:-verbose}" if ! [[ "${LOGLEVEL,,}" =~ ^(verbose|error|none)$ ]]; then
# shellcheck disable=SC2086,SC2069 [[ -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 if [[ "${LOGLEVEL,,}" == "verbose" ]]; then
exec "${s6wrap[@]}" --args "${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS exec "${s6wrap[@]}" --args "${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS
elif [[ "${LOGLEVEL,,}" == "error" ]]; then elif [[ "${LOGLEVEL,,}" == "error" ]]; then