Add CONFIG_STYLE to default config for unambiguous detection of
new-style config. Try to handle un-upgraded config files in start-dump1090-fa. Always pass --quiet to dump1090-fa.
This commit is contained in:
parent
d6405ddefd
commit
899ee2530c
|
|
@ -57,3 +57,6 @@ EXTRA_OPTIONS=""
|
||||||
# If OVERRIDE_OPTIONS is set, only those options are used; all other options
|
# If OVERRIDE_OPTIONS is set, only those options are used; all other options
|
||||||
# in this config file are ignored.
|
# in this config file are ignored.
|
||||||
OVERRIDE_OPTIONS=""
|
OVERRIDE_OPTIONS=""
|
||||||
|
|
||||||
|
# This is a marker to make it easier for scripts to identify a v6-style config file
|
||||||
|
CONFIG_STYLE=6
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,17 @@ fi
|
||||||
|
|
||||||
# process options
|
# process options
|
||||||
|
|
||||||
|
# if there's no CONFIG_STYLE, infer a version
|
||||||
|
if [ -z "$CONFIG_STYLE" ]
|
||||||
|
then
|
||||||
|
if [ -n "$RECEIVER_OPTIONS" -o -n "$DECODER_OPTIONS" -o -n "$NET_OPTIONS" -o -n "$JSON_OPTIONS" ]
|
||||||
|
then
|
||||||
|
CONFIG_STYLE=5
|
||||||
|
else
|
||||||
|
CONFIG_STYLE=6
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
is_slow_cpu() {
|
is_slow_cpu() {
|
||||||
case "$SLOW_CPU" in
|
case "$SLOW_CPU" in
|
||||||
yes) return 0 ;;
|
yes) return 0 ;;
|
||||||
|
|
@ -36,51 +47,61 @@ is_slow_cpu() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTS="--quiet"
|
if [ "$CONFIG_STYLE" = "5" ]
|
||||||
|
|
||||||
if [ "${RECEIVER:-none}" = "none" ]
|
|
||||||
then
|
then
|
||||||
OPTS="$OPTS --device-type none"
|
# old style config file
|
||||||
|
echo "/etc/default/dump1090-fa is using the old config style, please consider updating it" >&2
|
||||||
|
OPTS="$RECEIVER_OPTIONS $DECODER_OPTIONS $NET_OPTIONS $JSON_OPTIONS"
|
||||||
|
elif [ -n "$OVERRIDE_OPTIONS" ]
|
||||||
|
then
|
||||||
|
# ignore all other settings, use only provided options
|
||||||
|
OPTS="$OVERRIDE_OPTIONS"
|
||||||
else
|
else
|
||||||
if [ -n "$RECEIVER" ]; then OPTS="$OPTS --device-type $RECEIVER"; fi
|
# build a list of options based on config settings
|
||||||
if [ -n "$RECEIVER_SERIAL" ]; then OPTS="$OPTS --device-index $RECEIVER_SERIAL"; fi
|
OPTS=""
|
||||||
if [ -n "$RECEIVER_GAIN" ]; then OPTS="$OPTS --gain $RECEIVER_GAIN"; fi
|
|
||||||
if [ -n "$WISDOM" -a -f "$WISDOM" ]; then OPTS="$OPTS --wisdom $WISDOM"; fi
|
|
||||||
|
|
||||||
if [ "$ADAPTIVE_DYNAMIC_RANGE" = "yes" ]; then OPTS="$OPTS --adaptive-range"; fi
|
if [ "${RECEIVER:-none}" = "none" ]
|
||||||
if [ -n "$ADAPTIVE_DYNAMIC_RANGE_TARGET" ]; then OPTS="$OPTS --adaptive-range-target $ADAPTIVE_DYNAMIC_RANGE_TARGET"; fi
|
|
||||||
if [ "$ADAPTIVE_BURST" = "yes" ]; then OPTS="$OPTS --adaptive-burst"; fi
|
|
||||||
if [ -n "$ADAPTIVE_MIN_GAIN" ]; then OPTS="$OPTS --adaptive-min-gain $ADAPTIVE_MIN_GAIN"; fi
|
|
||||||
if [ -n "$ADAPTIVE_MAX_GAIN" ]; then OPTS="$OPTS --adaptive-max-gain $ADAPTIVE_MAX_GAIN"; fi
|
|
||||||
|
|
||||||
if is_slow_cpu
|
|
||||||
then
|
then
|
||||||
OPTS="$OPTS --adaptive-duty-cycle 10 --no-fix-df"
|
OPTS="$OPTS --device-type none"
|
||||||
|
else
|
||||||
|
if [ -n "$RECEIVER" ]; then OPTS="$OPTS --device-type $RECEIVER"; fi
|
||||||
|
if [ -n "$RECEIVER_SERIAL" ]; then OPTS="$OPTS --device-index $RECEIVER_SERIAL"; fi
|
||||||
|
if [ -n "$RECEIVER_GAIN" ]; then OPTS="$OPTS --gain $RECEIVER_GAIN"; fi
|
||||||
|
if [ -n "$WISDOM" -a -f "$WISDOM" ]; then OPTS="$OPTS --wisdom $WISDOM"; fi
|
||||||
|
|
||||||
|
if [ "$ADAPTIVE_DYNAMIC_RANGE" = "yes" ]; then OPTS="$OPTS --adaptive-range"; fi
|
||||||
|
if [ -n "$ADAPTIVE_DYNAMIC_RANGE_TARGET" ]; then OPTS="$OPTS --adaptive-range-target $ADAPTIVE_DYNAMIC_RANGE_TARGET"; fi
|
||||||
|
if [ "$ADAPTIVE_BURST" = "yes" ]; then OPTS="$OPTS --adaptive-burst"; fi
|
||||||
|
if [ -n "$ADAPTIVE_MIN_GAIN" ]; then OPTS="$OPTS --adaptive-min-gain $ADAPTIVE_MIN_GAIN"; fi
|
||||||
|
if [ -n "$ADAPTIVE_MAX_GAIN" ]; then OPTS="$OPTS --adaptive-max-gain $ADAPTIVE_MAX_GAIN"; fi
|
||||||
|
|
||||||
|
if is_slow_cpu
|
||||||
|
then
|
||||||
|
OPTS="$OPTS --adaptive-duty-cycle 10 --no-fix-df"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$ERROR_CORRECTION" = "yes" ]; then OPTS="$OPTS --fix"; fi
|
||||||
|
|
||||||
|
if [ -n "$RECEIVER_LAT" -a -n "$RECEIVER_LON" ]; then
|
||||||
|
OPTS="$OPTS --lat $RECEIVER_LAT --lon $RECEIVER_LON"
|
||||||
|
elif [ -n "$PIAWARE_LAT" -a -n "$PIAWARE_LON" ]; then
|
||||||
|
OPTS="$OPTS --lat $PIAWARE_LAT --lon $PIAWARE_LON"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$MAX_RANGE" ]; then OPTS="$OPTS --max-range $MAX_RANGE"; fi
|
||||||
|
|
||||||
|
if [ -n "$NET_RAW_INPUT_PORTS" ]; then OPTS="$OPTS --net-ri-port $NET_RAW_INPUT_PORTS"; fi
|
||||||
|
if [ -n "$NET_RAW_OUTPUT_PORTS" ]; then OPTS="$OPTS --net-ro-port $NET_RAW_OUTPUT_PORTS"; fi
|
||||||
|
if [ -n "$NET_SBS_OUTPUT_PORTS" ]; then OPTS="$OPTS --net-sbs-port $NET_SBS_OUTPUT_PORTS"; fi
|
||||||
|
if [ -n "$NET_BEAST_INPUT_PORTS" ]; then OPTS="$OPTS --net-bi-port $NET_BEAST_INPUT_PORTS"; fi
|
||||||
|
if [ -n "$NET_BEAST_OUTPUT_PORTS" ]; then OPTS="$OPTS --net-bo-port $NET_BEAST_OUTPUT_PORTS"; fi
|
||||||
|
|
||||||
|
if [ -n "$JSON_LOCATION_ACCURACY" ]; then OPTS="$OPTS --json-location-accuracy $JSON_LOCATION_ACCURACY"; fi
|
||||||
|
|
||||||
|
if [ -n "$EXTRA_OPTIONS" ]; then OPTS="$OPTS $EXTRA_OPTIONS"; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ERROR_CORRECTION" = "yes" ]; then OPTS="$OPTS --fix"; fi
|
exec /usr/bin/dump1090-fa --quiet $OPTS "$@"
|
||||||
|
|
||||||
if [ -n "$RECEIVER_LAT" -a -n "$RECEIVER_LON" ]; then
|
|
||||||
OPTS="$OPTS --lat $RECEIVER_LAT --lon $RECEIVER_LON"
|
|
||||||
elif [ -n "$PIAWARE_LAT" -a -n "$PIAWARE_LON" ]; then
|
|
||||||
OPTS="$OPTS --lat $PIAWARE_LAT --lon $PIAWARE_LON"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$MAX_RANGE" ]; then OPTS="$OPTS --max-range $MAX_RANGE"; fi
|
|
||||||
|
|
||||||
if [ -n "$NET_RAW_INPUT_PORTS" ]; then OPTS="$OPTS --net-ri-port $NET_RAW_INPUT_PORTS"; fi
|
|
||||||
if [ -n "$NET_RAW_OUTPUT_PORTS" ]; then OPTS="$OPTS --net-ro-port $NET_RAW_OUTPUT_PORTS"; fi
|
|
||||||
if [ -n "$NET_SBS_OUTPUT_PORTS" ]; then OPTS="$OPTS --net-sbs-port $NET_SBS_OUTPUT_PORTS"; fi
|
|
||||||
if [ -n "$NET_BEAST_INPUT_PORTS" ]; then OPTS="$OPTS --net-bi-port $NET_BEAST_INPUT_PORTS"; fi
|
|
||||||
if [ -n "$NET_BEAST_OUTPUT_PORTS" ]; then OPTS="$OPTS --net-bo-port $NET_BEAST_OUTPUT_PORTS"; fi
|
|
||||||
|
|
||||||
if [ -n "$JSON_LOCATION_ACCURACY" ]; then OPTS="$OPTS --json-location-accuracy $JSON_LOCATION_ACCURACY"; fi
|
|
||||||
|
|
||||||
if [ -n "$EXTRA_OPTIONS" ]; then OPTS="$OPTS $EXTRA_OPTIONS"; fi
|
|
||||||
|
|
||||||
if [ -n "$OVERRIDE_OPTIONS" ]; then OPTS="$OVERRIDE_OPTIONS"; fi
|
|
||||||
|
|
||||||
exec /usr/bin/dump1090-fa $OPTS "$@"
|
|
||||||
# exec failed, do not restart
|
# exec failed, do not restart
|
||||||
exit 64
|
exit 64
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,6 @@ then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use EXTRA_OPTIONS as a marker for a new-style config file
|
|
||||||
if grep -q EXTRA_OPTIONS ${OLDCONFIG}
|
|
||||||
then
|
|
||||||
echo "$OLDCONFIG seems to already be a new-style config, nothing to upgrade" >&2
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f $PACKAGECONFIG ]
|
if [ ! -f $PACKAGECONFIG ]
|
||||||
then
|
then
|
||||||
echo "$PACKAGECONFIG does not exist, cannot continue" >&2
|
echo "$PACKAGECONFIG does not exist, cannot continue" >&2
|
||||||
|
|
@ -60,6 +53,23 @@ EXTRAS_NET_HEARTBEAT="60"
|
||||||
# read the old config
|
# read the old config
|
||||||
. "$OLDCONFIG"
|
. "$OLDCONFIG"
|
||||||
|
|
||||||
|
# if there's no CONFIG_STYLE, infer a version
|
||||||
|
if [ -z "$CONFIG_STYLE" ]
|
||||||
|
then
|
||||||
|
if [ -n "$RECEIVER_OPTIONS" -o -n "$DECODER_OPTIONS" -o -n "$NET_OPTIONS" -o -n "$JSON_OPTIONS" ]
|
||||||
|
then
|
||||||
|
CONFIG_STYLE=5
|
||||||
|
else
|
||||||
|
CONFIG_STYLE=6
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CONFIG_STYLE" = "6" ]
|
||||||
|
then
|
||||||
|
echo "$OLDCONFIG seems to already be a new-style config, nothing to upgrade" >&2
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# process all the options from the old config file and accumulate settings in env vars
|
# process all the options from the old config file and accumulate settings in env vars
|
||||||
process_options() {
|
process_options() {
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue