Merge branch 'dev' into staging

This commit is contained in:
eric1tran 2021-08-24 16:52:07 +00:00
commit 8b9dd42676
1 changed files with 44 additions and 35 deletions

41
debian/upgrade-config vendored
View File

@ -64,14 +64,8 @@ then
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() {
process_v5_options() {
while [ $# -gt 0 ]
do
opt="$1"
@ -99,9 +93,6 @@ process_options() {
*) EXTRA_OPTIONS="$EXTRA_OPTIONS ${opt}" ;;
esac
done
}
process_options $RECEIVER_OPTIONS $DECODER_OPTIONS $NET_OPTIONS $JSON_OPTIONS
# update EXTRA_OPTIONS for any non-default special settings
if [ "${EXTRAS_PPM:-0}" != "0" ]; then EXTRA_OPTIONS="$EXTRA_OPTIONS --ppm $EXTRAS_PPM"; fi
@ -121,13 +112,17 @@ if [ "${NET_RAW_OUTPUT_PORTS}" = "0" ]; then NET_RAW_OUTPUT_PORTS=""; fi
if [ "${NET_SBS_INPUT_PORTS}" = "0" ]; then NET_SBS_OUTPUT_PORTS=""; fi
if [ "${NET_BEAST_INPUT_PORTS}" = "0" ]; then NET_BEAST_INPUT_PORTS=""; fi
if [ "${NET_BEAST_OUTPUT_PORTS}" = "0" ]; then NET_BEAST_OUTPUT_PORTS=""; fi
}
SEDSCRIPT=$(mktemp -t dump1090XXX.sed)
# set up the sedscript
# nb: all values either derived from env vars or the package defaults,
# except for adaptive gain settings which we default to off on upgraded
# installs. New installs using the package defaults will default to on.
if [ "$CONFIG_STYLE" = "5" ]
then
echo "Generating a v6-style config from the v5-style config in $OLDCONFIG" >&2
# nb: all values either derived from env vars or the package defaults
process_v5_options $RECEIVER_OPTIONS $DECODER_OPTIONS $NET_OPTIONS $JSON_OPTIONS
FROMCONFIG=$PACKAGECONFIG
cat >>$SEDSCRIPT <<EOF
s@^ENABLED=.*@ENABLED=${ENABLED}@
s@^RECEIVER=.*@RECEIVER=${RECEIVER}@
@ -143,12 +138,26 @@ s@^NET_BEAST_INPUT_PORTS=.*@NET_BEAST_INPUT_PORTS=${NET_BEAST_INPUT_PORTS}@
s@^NET_BEAST_OUTPUT_PORTS=.*@NET_BEAST_OUTPUT_PORTS=${NET_BEAST_OUTPUT_PORTS}@
s@^JSON_LOCATION_ACCURACY=.*@JSON_LOCATION_ACCURACY=${JSON_LOCATION_ACCURACY}@
s@^EXTRA_OPTIONS=.*@EXTRA_OPTIONS="$EXTRA_OPTIONS"@
EOF
else
# Existing config file doesn't seem to be a v5, just turn off adaptive gain settings
# as this is an upgrade but otherwise leave it unchanged. (This happens when
# there were no changes made by the user to the config file before upgrading; dpkg
# will install the new v6 default config file automatically in that case)
FROMCONFIG=$OLDCONFIG
fi
# All upgrades get adaptive gain defaulting to off, to preserve the behaviour of
# existing installs. New installs using the package defaults will default to on.
echo "Disabling adaptive gain in $OLDCONFIG as this is an upgrade from pre-v6" >&2
cat >>$SEDSCRIPT <<EOF
s@^ADAPTIVE_DYNAMIC_RANGE=.*@ADAPTIVE_DYNAMIC_RANGE=no@
s@^ADAPTIVE_BURST=.*@ADAPTIVE_BURST=no@
EOF
# substitute into the standard config file to generate our customized config
if ! sed -f $SEDSCRIPT <$PACKAGECONFIG >$NEWCONFIG
# substitute into the config file template to generate our customized config
if ! sed -f $SEDSCRIPT <$FROMCONFIG >$NEWCONFIG
then
echo "Something went wrong trying to upgrade $OLDCONFIG, giving up.." >&2
exit 1