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
|
||||
# in this config file are ignored.
|
||||
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
|
||||
|
||||
# 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() {
|
||||
case "$SLOW_CPU" in
|
||||
yes) return 0 ;;
|
||||
|
|
@ -36,7 +47,18 @@ is_slow_cpu() {
|
|||
esac
|
||||
}
|
||||
|
||||
OPTS="--quiet"
|
||||
if [ "$CONFIG_STYLE" = "5" ]
|
||||
then
|
||||
# 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
|
||||
# build a list of options based on config settings
|
||||
OPTS=""
|
||||
|
||||
if [ "${RECEIVER:-none}" = "none" ]
|
||||
then
|
||||
|
|
@ -78,9 +100,8 @@ if [ -n "$NET_BEAST_OUTPUT_PORTS" ]; then OPTS="$OPTS --net-bo-port $NET_BEAST_O
|
|||
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
|
||||
|
||||
if [ -n "$OVERRIDE_OPTIONS" ]; then OPTS="$OVERRIDE_OPTIONS"; fi
|
||||
|
||||
exec /usr/bin/dump1090-fa $OPTS "$@"
|
||||
exec /usr/bin/dump1090-fa --quiet $OPTS "$@"
|
||||
# exec failed, do not restart
|
||||
exit 64
|
||||
|
|
|
|||
|
|
@ -21,13 +21,6 @@ then
|
|||
exit 0
|
||||
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 ]
|
||||
then
|
||||
echo "$PACKAGECONFIG does not exist, cannot continue" >&2
|
||||
|
|
@ -60,6 +53,23 @@ EXTRAS_NET_HEARTBEAT="60"
|
|||
# read the old config
|
||||
. "$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_options() {
|
||||
while [ $# -gt 0 ]
|
||||
|
|
|
|||
Loading…
Reference in New Issue