From be08514799759d8154186ce38f3af385a7254f95 Mon Sep 17 00:00:00 2001 From: Taylor Vaughn Date: Tue, 9 Jun 2015 19:18:11 +0000 Subject: [PATCH 1/3] config updated to support lat/lon saved in file --- debian/config-template | 71 ++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/debian/config-template b/debian/config-template index 2a9d343..8af69fb 100644 --- a/debian/config-template +++ b/debian/config-template @@ -1,19 +1,16 @@ -## TEMPLATE FILE - This is used to create /etc/default/dump1090-mutability ## -## The first three lines will be discarded ## - # dump1090-mutability configuration file # This is a POSIX shell fragment. # You can edit this file directly, or use # "dpkg-reconfigure dump1090-mutability" # Set to "yes" to start dump1090 on boot. -START_DUMP1090= +START_DUMP1090="yes" # User to run dump1090 as. -DUMP1090_USER= +DUMP1090_USER="dump1090" # Logfile to log to -LOGFILE= +LOGFILE="/var/log/dump1090-mutability.log" # # Receiver options @@ -21,41 +18,47 @@ LOGFILE= # RTLSDR device index or serial number to use # If set to "none", dump1090 will be started in --net-only mode -DEVICE= +DEVICE="" # RTLSDR gain in dB. # If set to "max" (the default) the maximum supported gain is used. # If set to "agc", the tuner AGC is used to set the gain. -GAIN= +GAIN="max" # RTLSDR frequency correction in PPM -PPM= +PPM="0" # If yes, enable sampling at 2.4MHz. Otherwise, 2.0MHz is used. -OVERSAMPLE= +OVERSAMPLE="yes" # If yes, enables phase-enhancement of messages -PHASE_ENHANCE= +PHASE_ENHANCE="yes" # # Decoding options # # If yes, fixes messages with correctable CRC errors. -FIX_CRC= +FIX_CRC="yes" # If yes, enables aggressive fixes to damaged messages. # Use with caution - it can increase the rate of undetected errors. -AGGRESSIVE= +AGGRESSIVE="no" # If set, supplies a reference location for local position decoding. -LAT= -LON= +LATLONFILE=/var/lib/dump1090/latlon +if [ -e $LATLONFILE ]; then + LAT=$(sed -n '1p' < $LATLONFILE) + LON=$(sed -n '2p' < $LATLONFILE) +else + LAT="" + LON="" +fi # If set, provides the absolute maximum receiver range used to # filter bad position reports, and to determine when local position # decoding is safe to use. Specify this in nautical miles (NM). -MAX_RANGE= +MAX_RANGE="300" # # Networking options @@ -67,62 +70,62 @@ MAX_RANGE= # /usr/share/dump1090-mutability and JSON_DIR (below) using a proper # webserver. See /etc/lighttpd/conf-available/90-dump1090.conf # for an example configuration ("sudo lighty-enable-mod dump1090" to enable) -HTTP_PORT= +HTTP_PORT="0" # Port to listen on for raw (AVR-format) input connections. 0 disables. -RAW_INPUT_PORT= +RAW_INPUT_PORT="30001" # Port to listen on for raw (AVR-format) output connections. 0 disables. -RAW_OUTPUT_PORT= +RAW_OUTPUT_PORT="30002" # Port to listen on for SBS-format output connections. 0 disables. -SBS_OUTPUT_PORT= +SBS_OUTPUT_PORT="30003" # Port to listen on for Beast-format input connections. 0 disables. -BEAST_INPUT_PORT= +BEAST_INPUT_PORT="30004" # Port to listen on for Beast-format output connections. 0 disables. -BEAST_OUTPUT_PORT= +BEAST_OUTPUT_PORT="30005" # Port to listen on for FATSV-format output connections. 0 disables. -FATSV_OUTPUT_PORT= +FATSV_OUTPUT_PORT="10001" # TCP heartbeat interval in seconds. 0 disables. -NET_HEARTBEAT= +NET_HEARTBEAT="60" # Minimum output buffer size per write, in bytes. -NET_OUTPUT_SIZE= +NET_OUTPUT_SIZE="500" # Maximum buffering time before writing, in seconds. -NET_OUTPUT_INTERVAL= +NET_OUTPUT_INTERVAL="1" # TCP buffer size, in bytes -NET_BUFFER= +NET_BUFFER="262144" # Bind ports on a particular address. If unset, binds to all interfaces. # This defaults to binding to localhost. If you need to allow remote # connections, change this. -NET_BIND_ADDRESS= +NET_BIND_ADDRESS="127.0.0.1" # # Misc options # # Interval (in seconds) between logging stats to the logfile. 0 disables. -STATS_INTERVAL= +STATS_INTERVAL="3600" # Path to write json state to (for use with an external webserver). Blank disables. -JSON_DIR= +JSON_DIR="/run/dump1090-mutability" # Interval between writing json state (in seconds). 0 disables. -JSON_INTERVAL= +JSON_INTERVAL="1" # Accuracy of receiver location to write to json state, one of "exact" / "approximate" / "none" -JSON_LOCATION_ACCURACY= +JSON_LOCATION_ACCURACY="approximate" # Set to yes to log all decoded messages # This can get large fast! -LOG_DECODED_MESSAGES= +LOG_DECODED_MESSAGES="no" # Additional options that are passed to the Daemon. -EXTRA_ARGS= +EXTRA_ARGS="" From 84413b20f48ee3947878f8e1befe0f96301a2327 Mon Sep 17 00:00:00 2001 From: Taylor Vaughn Date: Tue, 9 Jun 2015 22:03:14 +0000 Subject: [PATCH 2/3] we should edit init file. We dont actually want to hard code the template --- debian/config-template | 71 ++++++++++++++++----------------- debian/dump1090-mutability.init | 9 ++++- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/debian/config-template b/debian/config-template index 8af69fb..2a9d343 100644 --- a/debian/config-template +++ b/debian/config-template @@ -1,16 +1,19 @@ +## TEMPLATE FILE - This is used to create /etc/default/dump1090-mutability ## +## The first three lines will be discarded ## + # dump1090-mutability configuration file # This is a POSIX shell fragment. # You can edit this file directly, or use # "dpkg-reconfigure dump1090-mutability" # Set to "yes" to start dump1090 on boot. -START_DUMP1090="yes" +START_DUMP1090= # User to run dump1090 as. -DUMP1090_USER="dump1090" +DUMP1090_USER= # Logfile to log to -LOGFILE="/var/log/dump1090-mutability.log" +LOGFILE= # # Receiver options @@ -18,47 +21,41 @@ LOGFILE="/var/log/dump1090-mutability.log" # RTLSDR device index or serial number to use # If set to "none", dump1090 will be started in --net-only mode -DEVICE="" +DEVICE= # RTLSDR gain in dB. # If set to "max" (the default) the maximum supported gain is used. # If set to "agc", the tuner AGC is used to set the gain. -GAIN="max" +GAIN= # RTLSDR frequency correction in PPM -PPM="0" +PPM= # If yes, enable sampling at 2.4MHz. Otherwise, 2.0MHz is used. -OVERSAMPLE="yes" +OVERSAMPLE= # If yes, enables phase-enhancement of messages -PHASE_ENHANCE="yes" +PHASE_ENHANCE= # # Decoding options # # If yes, fixes messages with correctable CRC errors. -FIX_CRC="yes" +FIX_CRC= # If yes, enables aggressive fixes to damaged messages. # Use with caution - it can increase the rate of undetected errors. -AGGRESSIVE="no" +AGGRESSIVE= # If set, supplies a reference location for local position decoding. -LATLONFILE=/var/lib/dump1090/latlon -if [ -e $LATLONFILE ]; then - LAT=$(sed -n '1p' < $LATLONFILE) - LON=$(sed -n '2p' < $LATLONFILE) -else - LAT="" - LON="" -fi +LAT= +LON= # If set, provides the absolute maximum receiver range used to # filter bad position reports, and to determine when local position # decoding is safe to use. Specify this in nautical miles (NM). -MAX_RANGE="300" +MAX_RANGE= # # Networking options @@ -70,62 +67,62 @@ MAX_RANGE="300" # /usr/share/dump1090-mutability and JSON_DIR (below) using a proper # webserver. See /etc/lighttpd/conf-available/90-dump1090.conf # for an example configuration ("sudo lighty-enable-mod dump1090" to enable) -HTTP_PORT="0" +HTTP_PORT= # Port to listen on for raw (AVR-format) input connections. 0 disables. -RAW_INPUT_PORT="30001" +RAW_INPUT_PORT= # Port to listen on for raw (AVR-format) output connections. 0 disables. -RAW_OUTPUT_PORT="30002" +RAW_OUTPUT_PORT= # Port to listen on for SBS-format output connections. 0 disables. -SBS_OUTPUT_PORT="30003" +SBS_OUTPUT_PORT= # Port to listen on for Beast-format input connections. 0 disables. -BEAST_INPUT_PORT="30004" +BEAST_INPUT_PORT= # Port to listen on for Beast-format output connections. 0 disables. -BEAST_OUTPUT_PORT="30005" +BEAST_OUTPUT_PORT= # Port to listen on for FATSV-format output connections. 0 disables. -FATSV_OUTPUT_PORT="10001" +FATSV_OUTPUT_PORT= # TCP heartbeat interval in seconds. 0 disables. -NET_HEARTBEAT="60" +NET_HEARTBEAT= # Minimum output buffer size per write, in bytes. -NET_OUTPUT_SIZE="500" +NET_OUTPUT_SIZE= # Maximum buffering time before writing, in seconds. -NET_OUTPUT_INTERVAL="1" +NET_OUTPUT_INTERVAL= # TCP buffer size, in bytes -NET_BUFFER="262144" +NET_BUFFER= # Bind ports on a particular address. If unset, binds to all interfaces. # This defaults to binding to localhost. If you need to allow remote # connections, change this. -NET_BIND_ADDRESS="127.0.0.1" +NET_BIND_ADDRESS= # # Misc options # # Interval (in seconds) between logging stats to the logfile. 0 disables. -STATS_INTERVAL="3600" +STATS_INTERVAL= # Path to write json state to (for use with an external webserver). Blank disables. -JSON_DIR="/run/dump1090-mutability" +JSON_DIR= # Interval between writing json state (in seconds). 0 disables. -JSON_INTERVAL="1" +JSON_INTERVAL= # Accuracy of receiver location to write to json state, one of "exact" / "approximate" / "none" -JSON_LOCATION_ACCURACY="approximate" +JSON_LOCATION_ACCURACY= # Set to yes to log all decoded messages # This can get large fast! -LOG_DECODED_MESSAGES="no" +LOG_DECODED_MESSAGES= # Additional options that are passed to the Daemon. -EXTRA_ARGS="" +EXTRA_ARGS= diff --git a/debian/dump1090-mutability.init b/debian/dump1090-mutability.init index 39b2415..4c6a917 100644 --- a/debian/dump1090-mutability.init +++ b/debian/dump1090-mutability.init @@ -63,8 +63,13 @@ if [ "x$OVERSAMPLE" = "xyes" ]; then ARGS="$ARGS --oversample"; fi if [ "x$FIX_CRC" = "xyes" ]; then ARGS="$ARGS --fix"; fi if [ "x$PHASE_ENHANCE" = "xyes" ]; then ARGS="$ARGS --phase-enhance"; fi if [ "x$AGGRESSIVE" = "xyes" ]; then ARGS="$ARGS --aggressive"; fi -if [ -n "$LAT" ]; then ARGS="$ARGS --lat $LAT"; fi -if [ -n "$LON" ]; then ARGS="$ARGS --lon $LON"; fi +LATLONFILE=/var/lib/dump1090/latlon +if [ -e $LATLONFILE ]; them + LATVAL=$(sed -n '1p' < $LATLONFILE) + LONVAL=$(sed -n '2p' < $LATLONFILE) +fi +if [ -n "$LAT" ]; then ARGS="$ARGS --lat $LAT"; else if [ -n $LATVAL ]; then ARGS="$ARGS --lat $LATVAL"; fi +if [ -n "$LON" ]; then ARGS="$ARGS --lon $LON"; else if [ -n $LONVAL ]; then ARGS="$ARGS --lon $LONVAL"; fi ARGS="$ARGS --max-range $MAX_RANGE"; fi # net: From 4837fb615d26317673c462b067562de727119265 Mon Sep 17 00:00:00 2001 From: Taylor Vaughn Date: Wed, 10 Jun 2015 15:26:11 +0000 Subject: [PATCH 3/3] fixed typo and bad if statement syntax --- debian/dump1090-mutability.init | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/dump1090-mutability.init b/debian/dump1090-mutability.init index 4c6a917..b84ee3e 100644 --- a/debian/dump1090-mutability.init +++ b/debian/dump1090-mutability.init @@ -64,12 +64,12 @@ if [ "x$FIX_CRC" = "xyes" ]; then ARGS="$ARGS --fix"; fi if [ "x$PHASE_ENHANCE" = "xyes" ]; then ARGS="$ARGS --phase-enhance"; fi if [ "x$AGGRESSIVE" = "xyes" ]; then ARGS="$ARGS --aggressive"; fi LATLONFILE=/var/lib/dump1090/latlon -if [ -e $LATLONFILE ]; them +if [ -e $LATLONFILE ]; then LATVAL=$(sed -n '1p' < $LATLONFILE) LONVAL=$(sed -n '2p' < $LATLONFILE) fi -if [ -n "$LAT" ]; then ARGS="$ARGS --lat $LAT"; else if [ -n $LATVAL ]; then ARGS="$ARGS --lat $LATVAL"; fi -if [ -n "$LON" ]; then ARGS="$ARGS --lon $LON"; else if [ -n $LONVAL ]; then ARGS="$ARGS --lon $LONVAL"; fi +if [ -n "$LAT" ]; then ARGS="$ARGS --lat $LAT"; elif [ -n $LATVAL ]; then ARGS="$ARGS --lat $LATVAL"; fi +if [ -n "$LON" ]; then ARGS="$ARGS --lon $LON"; elif [ -n $LONVAL ]; then ARGS="$ARGS --lon $LONVAL"; fi ARGS="$ARGS --max-range $MAX_RANGE"; fi # net: