From f5af77c433fea037bf98fb03975086226febb1c8 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 28 Dec 2014 20:37:27 +0000 Subject: [PATCH] Update to use the configuration / packaging scripts developed for dump1090-mutability. Use a plain Conflicts: piaware on faup1090, as we don't actually want to replace it. If regular piaware is installed, it'll provide a faup1090 binary anyway. --- debian/changelog | 5 +- debian/config-template | 107 +++++++++++ debian/control | 5 +- debian/dump1090-flightaware.config | 204 +++++++++++++++++++++ debian/dump1090-flightaware.init | 81 ++++----- debian/dump1090-flightaware.install | 3 +- debian/dump1090-flightaware.postinst | 75 +++++++- debian/dump1090-flightaware.postrm | 41 +++++ debian/dump1090-flightaware.templates | 249 ++++++++++++++++++++++++++ debian/rules | 4 +- 10 files changed, 720 insertions(+), 54 deletions(-) create mode 100644 debian/config-template create mode 100644 debian/dump1090-flightaware.config create mode 100644 debian/dump1090-flightaware.postrm create mode 100644 debian/dump1090-flightaware.templates diff --git a/debian/changelog b/debian/changelog index 2cf8ddd..19c91be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,10 @@ dump1090-flightaware (1.18+mu1-2) UNRELEASED; urgency=medium - * Add Breaks/Replaces: piaware (<= 1.18-2) for faup1090, as the standard + * Add Conflicts: piaware for faup1090, as the standard package provides the same binary. + * Update to use the configuration / packaging scripts developed for dump1090-mutability. - -- Oliver Jowett Sun, 07 Dec 2014 23:46:00 +0000 + -- Oliver Jowett Sun, 28 Dec 2014 20:30:19 +0000 dump1090-flightaware (1.18+mu1-1) unstable; urgency=medium diff --git a/debian/config-template b/debian/config-template new file mode 100644 index 0000000..cfea750 --- /dev/null +++ b/debian/config-template @@ -0,0 +1,107 @@ +## TEMPLATE FILE - This is used to create /etc/default/dump1090-flightaware ## +## The first three lines will be discarded ## + +# dump1090-flightaware configuration file +# This is a POSIX shell fragment. +# You can edit this file directly, or use +# "dpkg-reconfigure dump1090-flightaware" + +# Set to "yes" to start dump1090 on boot. +START_DUMP1090= + +# User to run dump1090 as. +DUMP1090_USER= + +# Logfile to log to +LOGFILE= + +# +# Receiver options +# + +# RTLSDR device index or serial number to use +# If set to "none", dump1090 will be started in --net-only mode +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= + +# RTLSDR frequency correction in PPM +PPM= + +# If yes, enables phase-enhancement of messages +PHASE_ENHANCE= + +# +# Decoding options +# + +# If yes, fixes messages with correctable CRC errors. +FIX_CRC= + +# If yes, enables aggressive fixes to damaged messages. +# Use with caution - it can increase the rate of undetected errors. +AGGRESSIVE= + +# If set, supplies a reference location for local position decoding. +LAT= +LON= + +# +# Networking options +# + +# Port to listen on for HTTP connections. 0 disables. +# HTTP defaults to being disabled unless you specify something here. I +# that you do not enable this, and instead serve the contents of +# /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= + +# Port to listen on for raw (AVR-format) input connections. 0 disables. +RAW_INPUT_PORT= + +# Port to listen on for raw (AVR-format) output connections. 0 disables. +RAW_OUTPUT_PORT= + +# Port to listen on for SBS-format output connections. 0 disables. +SBS_OUTPUT_PORT= + +# Port to listen on for Beast-format input connections. 0 disables. +BEAST_INPUT_PORT= + +# Port to listen on for Beast-format output connections. 0 disables. +BEAST_OUTPUT_PORT= + +# Port to listen on for FATSV-format output connections. 0 disables. +FATSV_OUTPUT_PORT= + +# TCP heartbeat interval in seconds. 0 disables. +NET_HEARTBEAT= + +# Minimum output buffer size per write, in bytes. +NET_OUTPUT_SIZE= + +# Maximum buffering time before writing. In units of approx 64ms (don't ask..). +NET_OUTPUT_RATE= + +# TCP buffer size, in bytes +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= + +# +# Misc options +# + +# Interval (in seconds) between logging stats to the logfile. 0 disables. +STATS_INTERVAL= + +# Additional options that are passed to the Daemon. +EXTRA_ARGS= diff --git a/debian/control b/debian/control index 0833065..9f9b61b 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: dump1090-flightaware Section: embedded Priority: extra Maintainer: Oliver Jowett -Build-Depends: debhelper(>=8), librtlsdr-dev +Build-Depends: debhelper(>=8), librtlsdr-dev, libusb-1.0-0-dev, pkg-config Standards-Version: 3.9.3 Homepage: https://github.com/flightaware/dump1090_mr Vcs-Git: https://github.com/mutability/dump1090.git -b fa-pi-package @@ -23,8 +23,7 @@ Description: ADS-B Ground Station System for RTL-SDR Package: faup1090 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Breaks: piaware (<= 1.18-2) -Replaces: piaware (<= 1.18-2) +Conflicts: piaware Description: ADS-B protocol adaptor for FlightAware This is a packaging of a FlightAware utility based on dump1090 that generates messages in FlightAware's "fatsv" protocol from Beast format ADS-B messages. diff --git a/debian/dump1090-flightaware.config b/debian/dump1090-flightaware.config new file mode 100644 index 0000000..3629d39 --- /dev/null +++ b/debian/dump1090-flightaware.config @@ -0,0 +1,204 @@ +#!/bin/sh + +NAME=dump1090-config +CONFIGFILE=/etc/default/$NAME +set -e +. /usr/share/debconf/confmodule + +db_set_yn() { + if [ "x$2" = "xyes" ]; then db_set $1 true; else db_set $1 false; fi +} + +# Load config file, if it exists. +if [ -e $CONFIGFILE ]; then + . $CONFIGFILE || true + + # Store values from config file into + # debconf db. + + db_set_yn $NAME/auto-start "$START_DUMP1090" + db_set $NAME/run-as-user "$DUMP1090_USER" + db_set $NAME/log-file "$LOGFILE" + + db_set $NAME/rtlsdr-device "$DEVICE" + db_set $NAME/rtlsdr-gain "$GAIN" + db_set $NAME/rtlsdr-ppm "$PPM" + + db_set_yn $NAME/decode-fixcrc "$FIX_CRC" + db_set_yn $NAME/decode-phase-enhance "$PHASE_ENHANCE" + db_set_yn $NAME/decode-aggressive "$AGGRESSIVE" + db_set $NAME/decode-lat "$LAT" + db_set $NAME/decode-lon "$LON" + + db_set $NAME/net-http-port "$HTTP_PORT" + db_set $NAME/net-ri-port "$RAW_INPUT_PORT" + db_set $NAME/net-ro-port "$RAW_OUTPUT_PORT" + db_set $NAME/net-bi-port "$BEAST_INPUT_PORT" + db_set $NAME/net-bo-port "$BEAST_OUTPUT_PORT" + db_set $NAME/net-sbs-port "$SBS_OUTPUT_PORT" + db_set $NAME/net-fatsv-port "$FATSV_OUTPUT_PORT" + db_set $NAME/net-heartbeat "$NET_HEARTBEAT" + db_set $NAME/net-out-size "$NET_OUTPUT_SIZE" + db_set $NAME/net-out-rate "$NET_OUTPUT_RATE" + db_set $NAME/net-buffer "$NET_BUFFER" + db_set $NAME/net-bind-address "$NET_BIND_ADDRESS" + + db_set $NAME/stats-interval "$STATS_INTERVAL" + db_set $NAME/extra-args "$EXTRA_ARGS" +fi + +# Ask questions. + +db_input_verify() { + # $1 = priority + # $2 = db key + # $3 = verification function, should return 0 if OK + PRI=$1; KEY=$2; VERIFY=$3 + + set +e + db_input $PRI $KEY; RESULT=$? + db_go + set -e + ASKED=0 + while : + do + db_get $KEY + if $VERIFY $RET; then return 0; fi + if [ $RESULT -ne 0 ]; then + # db_input failed, and the existing value does not validate + if [ $RESULT = 30 ] && [ $ASKED = 0 ] + then + # question was skipped, but existing value is invalid + # bump priority and try again (once) + PRI=high + ASKED=1 + else + # give up, use the default value + db_reset $KEY + return 0 + fi + else + # db_input was OK, but the value did not verify. + # show an error message + db_input high dump1090-mutability/invalid-$VERIFY || true + fi + + # try again + set +e + db_fset $KEY seen false + db_input high $KEY; RESULT=$? + db_go + set -e + done +} + +is_unsigned_int() { + if echo "$1" | grep -Eq '^(0|+?[1-9][0-9]*)$'; then return 0; else return 1; fi +} + +is_unsigned_int_or_empty() { + if [ -z "$1" ]; then return 0 + elif is_unsigned_int "$1"; then return 0 + else return 1; fi +} + +is_signed_int() { + if echo "$1" | grep -Eq '^(0|[+-]?[1-9][0-9]*)$'; then return 0; else return 1; fi +} + +is_signed_int_or_empty() { + if [ -z "$1" ]; then return 0 + elif is_signed_int "$1"; then return 0 + else return 1; fi +} + +is_ipaddrish() { + if echo "$1" | grep -Eq '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'; then return 0; else return 1; fi +} + +is_ipaddrish_or_empty() { + if [ -z "$1" ]; then return 0 + elif is_ipaddrish "$1"; then return 0 + else return 1; fi +} + +is_number() { + if echo "$1" | grep -Eq '^(0|[+-]?[1-9][0-9]*)(\.[0-9]+)?$'; then return 0; else return 1; fi +} + +is_number_or_empty() { + if [ -z "$1" ]; then return 0 + elif is_number "$1"; then return 0; + else return 1; fi +} + +is_valid_gain() { + if is_number "$1"; then return 0; + elif [ "$1" = "max" ]; then return 0; + elif [ "$1" = "agc" ]; then return 0; + else return 1; fi +} + +is_not_empty() { + if [ -z "$1" ]; then return 1; else return 0; fi +} + +is_port_number() { + if is_unsigned_int "$1"; then + if [ "$1" -eq 0 ]; then return 0; fi + if [ "$1" -lt 1024 ]; then return 1; fi + if [ "$1" -gt 65535 ]; then return 1; fi + return 0 + else + return 1 + fi +} + +db_input high $NAME/auto-start || true + +db_go || true; db_get $NAME/auto-start; if [ "$RET" = "true" ]; then + # all of these are only relevant if the init script is enabled + + db_input_verify low $NAME/run-as-user is_not_empty || true + db_input_verify low $NAME/log-file is_not_empty || true + + db_input medium $NAME/rtlsdr-device || true + + db_go || true; db_get $NAME/rtlsdr-device; if [ "x$RET" != "xnone" ]; then + # only if a real device was chosen: + db_input_verify medium $NAME/rtlsdr-gain is_valid_gain || true + db_input_verify medium $NAME/rtlsdr-ppm is_signed_int || true + db_input low $NAME/rtlsdr-oversample || true + fi + + db_input low $NAME/decode-fix-crc || true + db_input low $NAME/decode-aggressive || true + db_input_verify medium $NAME/decode-lat is_number_or_empty || true + + db_go || true; db_get $NAME/decode-lat; if [ -n "$RET" ]; then + # only if latitude was given: + db_input_verify medium $NAME/decode-lon is_number_or_empty || true + fi + + db_input_verify medium $NAME/net-http-port is_port_number || true + db_input_verify low $NAME/net-ri-port is_port_number || true + db_input_verify low $NAME/net-ro-port is_port_number || true + db_input_verify low $NAME/net-bi-port is_port_number || true + db_input_verify low $NAME/net-bo-port is_port_number || true + db_input_verify low $NAME/net-sbs-port is_port_number || true + db_input_verify low $NAME/net-fatsv-port is_port_number || true + db_input_verify low $NAME/net-heartbeat is_unsigned_int || true + db_input_verify low $NAME/net-out-size is_unsigned_int || true + db_input_verify low $NAME/net-out-rate is_unsigned_int || true + db_input_verify low $NAME/net-buffer is_unsigned_int || true + db_input_verify medium $NAME/net-bind-address is_ipaddrish_or_empty || true + + db_input_verify low $NAME/stats-interval is_unsigned_int || true + + db_input low $NAME/extra-args || true + + db_go || True +fi + +# Done. +db_stop diff --git a/debian/dump1090-flightaware.init b/debian/dump1090-flightaware.init index 7668774..49085f2 100644 --- a/debian/dump1090-flightaware.init +++ b/debian/dump1090-flightaware.init @@ -5,7 +5,7 @@ # Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: dump1090 daemon (MalcolmRobb variant) +# Short-Description: dump1090 daemon (flightaware variant) # Description: Receives ADS-B messages from a RTLSDR dongle # and makes them available to other applications via # a variety of network protocols. @@ -15,9 +15,9 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="dump1090-flightaware daemon" NAME=dump1090-flightaware -DAEMON=/usr/bin/$NAME +DESC="$NAME daemon" +DAEMON=/usr/bin/dump1090-flightaware ARGS="--quiet" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME @@ -25,37 +25,24 @@ SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 -# Set defaults: -START_DUMP1090=no -DUMP1090_USER=dump1090 -LOGFILE=/var/log/$NAME.log -DEVICE=0 -GAIN=max -PPM=0 -FIX_CRC=no -PHASE_ENHANCE=no -AGGRESSIVE=no -LAT= -LON= -HTTP_PORT=8080 -FATSV_OUTPUT_PORT=10001 -RAW_INPUT_PORT=30001 -RAW_OUTPUT_PORT=30002 -SBS_OUTPUT_PORT=30003 -BEAST_INPUT_PORT=30004 -BEAST_OUTPUT_PORT=30005 -NET_HEARTBEAT=60 -NET_OUTPUT_SIZE=5 -NET_OUTPUT_RATE=5 -NET_BUFFER=0 -STATS_INTERVAL=3600 -EXTRA_ARGS= - # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # work out daemon args +# sanitize missing settings +[ -z "$START_DUMP1090" ] && START_DUMP1090=no +[ -z "$DUMP1090_USER" ] && DUMP1090_USER="missing-DUMP1090_USER-setting-in-config" +[ -z "$HTTP_PORT" ] && HTTP_PORT=0 +[ -z "$RAW_INPUT_PORT" ] && RAW_INPUT_PORT=0 +[ -z "$RAW_OUTPUT_PORT" ] && RAW_OUTPUT_PORT=0 +[ -z "$SBS_OUTPUT_PORT" ] && SBS_OUTPUT_PORT=0 +[ -z "$BEAST_INPUT_PORT" ] && BEAST_INPUT_PORT=0 +[ -z "$BEAST_OUTPUT_PORT" ] && BEAST_OUTPUT_PORT=0 +[ -z "$FATSV_OUTPUT_PORT" ] && FATSV_OUTPUT_PORT=0 +[ -z "$NET_BUFFER" ] && NET_BUFFER=0 +[ -z "$JSON_INTERVAL" ] && JSON_INTERVAL=0 + # receiver: case "x$DEVICE" in x|x0) ARGS="$ARGS --net" ;; @@ -67,7 +54,7 @@ case "x$GAIN" in xagc) ARGS="$ARGS --gain -10" ;; *) ARGS="$ARGS --gain $GAIN" ;; esac -if [ "x$PPM" != "x0" ]; then ARGS="$ARGS --ppm $PPM"; fi +if [ -n "$PPM" ]; then ARGS="$ARGS --ppm $PPM"; fi # decoder: if [ "x$FIX_CRC" = "xyes" ]; then ARGS="$ARGS --fix"; fi @@ -77,20 +64,23 @@ if [ -n "$LAT" ]; then ARGS="$ARGS --lat $LAT"; fi if [ -n "$LON" ]; then ARGS="$ARGS --lon $LON"; fi # net: -if [ "x$HTTP_PORT" != "x8080" ]; then ARGS="$ARGS --net-http-port $HTTP_PORT"; fi -if [ "x$FATSV_OUTPUT_PORT" != "x10001" ]; then ARGS="$ARGS --net-fatsv-port $FATSV_OUTPUT_PORT"; fi -if [ "x$RAW_INPUT_PORT" != "x30001" ]; then ARGS="$ARGS --net-ri-port $RAW_INPUT_PORT"; fi -if [ "x$RAW_OUTPUT_PORT" != "x30002" ]; then ARGS="$ARGS --net-ro-port $RAW_OUTPUT_PORT"; fi -if [ "x$SBS_OUTPUT_PORT" != "x30003" ]; then ARGS="$ARGS --net-sbs-port $SBS_OUTPUT_PORT"; fi -if [ "x$BEAST_INPUT_PORT" != "x30004" ]; then ARGS="$ARGS --net-bi-port $BEAST_INPUT_PORT"; fi -if [ "x$BEAST_OUTPUT_PORT" != "x30005" ]; then ARGS="$ARGS --net-bo-port $BEAST_OUTPUT_PORT"; fi -if [ "x$NET_HEARTBEAT" != "x60" ]; then ARGS="$ARGS --net-heartbeat $NET_HEARTBEAT"; fi -if [ "x$NET_OUTPUT_SIZE" != "x0" ]; then ARGS="$ARGS --net-ro-size $NET_OUTPUT_SIZE"; fi -if [ "x$NET_OUTPUT_RATE" != "x0" ]; then ARGS="$ARGS --net-ro-rate $NET_OUTPUT_RATE"; fi -if [ "x$NET_BUFFER" != "x0" ]; then ARGS="$ARGS --net-buffer $NET_BUFFER"; fi + +ARGS="$ARGS --net-http-port $HTTP_PORT \ +--net-ri-port $RAW_INPUT_PORT --net-ro-port $RAW_OUTPUT_PORT \ +--net-bi-port $BEAST_INPUT_PORT --net-bo-port $BEAST_OUTPUT_PORT \ +--net-sbs-port $SBS_OUTPUT_PORT --net-fatsv-port $FATSV_OUTPUT_PORT" +if [ -n "$NET_HEARTBEAT" ]; then ARGS="$ARGS --net-heartbeat $NET_HEARTBEAT"; fi +if [ -n "$NET_OUTPUT_SIZE" ]; then ARGS="$ARGS --net-ro-size $NET_OUTPUT_SIZE"; fi +if [ -n "$NET_OUTPUT_RATE" ]; then ARGS="$ARGS --net-ro-rate $NET_OUTPUT_RATE"; fi +if [ "$NET_BUFFER" -le "65536" ]; then ARGS="$ARGS --net-buffer 0" +elif [ "$NET_BUFFER" -le "131072" ]; then ARGS="$ARGS --net-buffer 1" +elif [ "$NET_BUFFER" -le "262144" ]; then ARGS="$ARGS --net-buffer 2" +else ARGS="$ARGS --net-buffer 3"; fi +if [ -n "$NET_BIND_ADDRESS" ]; then ARGS="$ARGS --net-bind-address $NET_BIND_ADDRESS"; fi # misc: -if [ "x$STATS_INTERVAL" != "x0" ]; then ARGS="$ARGS --stats-every $STATS_INTERVAL"; fi +if [ -n "$STATS_INTERVAL" ]; then ARGS="$ARGS --stats-every $STATS_INTERVAL"; fi + if [ -n "$EXTRA_ARGS" ]; then ARGS="$ARGS $EXTRA_ARGS"; fi # Load the VERBOSE setting and other rcS variables @@ -116,9 +106,10 @@ do_start() return 2 fi - start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME --user $DUMP1090_USER --exec $DAEMON --test > /dev/null \ + start-stop-daemon --start --quiet --pidfile $PIDFILE --user $DUMP1090_USER --exec $DAEMON --test > /dev/null \ || return 1 - start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME --user $DUMP1090_USER --chuid $DUMP1090_USER --make-pidfile --background --no-close --exec $DAEMON -- \ + + start-stop-daemon --start --quiet --pidfile $PIDFILE --user $DUMP1090_USER --chuid $DUMP1090_USER --make-pidfile --background --no-close --exec $DAEMON -- \ $ARGS >>$LOGFILE 2>&1 \ || return 2 sleep 1 @@ -134,7 +125,7 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred - start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE --user $DUMP1090_USER --name $NAME + start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE --user $DUMP1090_USER --exec $DAEMON RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 sleep 1 diff --git a/debian/dump1090-flightaware.install b/debian/dump1090-flightaware.install index 1880175..cbddd65 100644 --- a/debian/dump1090-flightaware.install +++ b/debian/dump1090-flightaware.install @@ -1,3 +1,4 @@ dump1090-flightaware usr/bin view1090-flightaware usr/bin -public_html/* usr/share/dump1090-flightaware +public_html/* usr/share/dump1090-flightaware/html +debian/config-template usr/share/dump1090-flightaware diff --git a/debian/dump1090-flightaware.postinst b/debian/dump1090-flightaware.postinst index 27a2ca7..fe0eee7 100644 --- a/debian/dump1090-flightaware.postinst +++ b/debian/dump1090-flightaware.postinst @@ -17,10 +17,82 @@ set -e # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package +NAME=dump1090-flightaware +CONFIGFILE=/etc/default/$NAME +TEMPLATECONFIG=/usr/share/$NAME/config-template +SEDSCRIPT=$CONFIGFILE.sed.tmp + +subvar_raw() { + # $1 = db var value + # $2 = config var name + + # if not present in the config file, add it + test -z "$1" || grep -Eq "^ *$2=" $CONFIGFILE || echo "$2=" >> $CONFIGFILE + # add to the sedscript + echo "s@^ *$2=.*@$2=\"$1\"@" >>$SEDSCRIPT +} + +subvar() { + # $1 = db var name + # $2 = config var name + db_get $NAME/$1 + subvar_raw "$RET" "$2" +} + +subvar_yn() { + # $1 = db var name + # $2 = config var name + db_get $NAME/$1 + if [ "$RET" = "true" ]; then subvar_raw "yes" "$2"; else subvar_raw "no" "$2"; fi +} case "$1" in configure) - adduser --system --home /usr/share/dump1090-flightaware --no-create-home --quiet dump1090 + . /usr/share/debconf/confmodule + + # Generate config file, if it doesn't exist. + if [ ! -e $CONFIGFILE ]; then + tail -n +4 $TEMPLATECONFIG >$CONFIGFILE + fi + + rm -f $SEDSCRIPT + + subvar_yn auto-start START_DUMP1090 + subvar run-as-user DUMP1090_USER + subvar log-file LOGFILE + subvar rtlsdr-device DEVICE + subvar rtlsdr-gain GAIN + subvar rtlsdr-ppm PPM + subvar_yn decode-fixcrc FIX_CRC + subvar_yn decode-phase-enhance PHASE_ENHANCE + subvar_yn decode-aggressive AGGRESSIVE + subvar decode-lat LAT + subvar decode-lon LON + subvar net-http-port HTTP_PORT + subvar net-ri-port RAW_INPUT_PORT + subvar net-ro-port RAW_OUTPUT_PORT + subvar net-bi-port BEAST_INPUT_PORT + subvar net-bo-port BEAST_OUTPUT_PORT + subvar net-sbs-port SBS_OUTPUT_PORT + subvar net-fatsv-port FATSV_OUTPUT_PORT + subvar net-heartbeat NET_HEARTBEAT + subvar net-out-size NET_OUTPUT_SIZE + subvar net-out-rate NET_OUTPUT_RATE + subvar net-buffer NET_BUFFER + subvar net-bind-address NET_BIND_ADDRESS + subvar stats-interval STATS_INTERVAL + subvar extra-args EXTRA_ARGS + + cp -a -f $CONFIGFILE $CONFIGFILE.tmp + sed -f $SEDSCRIPT < $CONFIGFILE > $CONFIGFILE.tmp + mv -f $CONFIGFILE.tmp $CONFIGFILE + rm $SEDSCRIPT + + db_get $NAME/auto-start + if [ "$RET" = "true" ]; then + db_get $NAME/run-as-user + adduser --system --home /usr/share/$NAME --no-create-home --quiet "$RET" + fi ;; abort-upgrade|abort-remove|abort-deconfigure) @@ -37,4 +109,5 @@ esac #DEBHELPER# +if [ "$1" = "configure" ]; then db_stop; fi exit 0 diff --git a/debian/dump1090-flightaware.postrm b/debian/dump1090-flightaware.postrm new file mode 100644 index 0000000..a826c1e --- /dev/null +++ b/debian/dump1090-flightaware.postrm @@ -0,0 +1,41 @@ +#!/bin/sh +# postrm script for #PACKAGE# +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge) + rm -f /etc/default/dump1090-flightaware + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/dump1090-flightaware.templates b/debian/dump1090-flightaware.templates new file mode 100644 index 0000000..ea7e30a --- /dev/null +++ b/debian/dump1090-flightaware.templates @@ -0,0 +1,249 @@ +Template: dump1090-flightaware/auto-start +Description: Start dump1090 automatically? + dump1090 can be started automatically via an init-script. + Otherwise, the init-script does nothing; you must run dump1090 by hand. + . + You can modify the options used when automatically starting + dump1090 by running "dpkg-reconfigure dump1090-flightaware" as root, + or by editing /etc/default/dump1090-flightaware. +Type: boolean +Default: true + +Template: dump1090-flightaware/run-as-user +Description: User to run dump1090 as: + When started automatically, dump1090 runs as an unprivileged system user. + This user will be created if it does not yet exist. +Type: string +Default: dump1090 + +Template: dump1090-flightaware/log-file +Description: Path to log to: + When started automatically, dump1090 will log its output somewhere. This + log will contain any startup errors, and periodic statistics reports. +Type: string +Default: /var/log/dump1090-flightaware.log + +Template: dump1090-flightaware/rtlsdr-device +Description: RTL-SDR dongle to use: + If you have only one dongle connected, you can leave this blank. + . + Otherwise, you can provide the serial number (more reliable) or device + index (first device = 0, but the ordering is unpredictable) to choose + a particular dongle to use. + . + To run dump1090 in "net only" mode, specify the literal word "none". +Type: string +Default: + +Template: dump1090-flightaware/rtlsdr-gain +Description: RTL-SDR gain, in dB: + The tuner gain used by dump1090 can be provided as a value in dB, or + "max" to use the maximum gain available, or "agc" to use the tuner's AGC to + control the gain. If unsure, choose "max". +Type: string +Default: max + +Template: dump1090-flightaware/rtlsdr-ppm +Description: RTL-SDR frequency correction, in PPM: + The oscillator in each RTL-SDL dongle is not perfectly accurate. You can + choose a correction factor, in parts-per-million, to correct for this. The + correction factor varies from dongle to dongle, and also varies with operating + temperature. You can find a suitable value with "rtl_test -p" or "kalibrate". + If you don't know the value for your dongle, choose 0. +Type: string +Default: 0 + +Template: dump1090-flightaware/decode-fixcrc +Description: Fix detected CRC errors? + dump1090 can fix unambiguous single-bit CRC errors detected in received + messages. This allows weaker messages to be decoded. It can slightly increase + the rate of undetected errors, but this is not usually significant. +Type: boolean +Default: true + +Template: dump1090-flightaware/decode-phase-enhance +Description: Apply phase enhancement? + dump1090 can attempt to correct for messages that are received + out-of-phase from the sampling rate, at the expense of taking more CPU. +Type: boolean +Default: true + +Template: dump1090-flightaware/decode-aggressive +Description: Aggressively fix more errors? + dump1090 can apply more aggressive corrections to received messages, + primarily correcting two-bit CRC errors. + . + Use with caution! This can significantly increase the rate of undetected + message errors (i.e. increase the rate of garbled decoded messages) +Type: boolean +Default: false + +Template: dump1090-flightaware/decode-lat +Description: Latitude of receiver, in decimal degrees: + If the location of the receiver is provided, dump1090 can do + local position decoding in cases where insufficient position messages are + received for unambiguous global position decoding. +Type: string +Default: + +Template: dump1090-flightaware/decode-lon +Description: Longitude of receiver, in decimal degrees: + If the location of the receiver is provided, dump1090 can do + local position decoding in cases where insufficient position messages are + received for unambiguous global position decoding. +Type: string +Default: + +Template: dump1090-flightaware/net-http-port +Description: Port for internal webserver (0 disables): + dump1090 can provide an internal webserver that serves a basic "virtual + radar" map. + . + It is generally a better idea to use an external webserver, but if you + really want to use the internal one, you can select a port to listen + on here. +Type: string +Default: 0 + +Template: dump1090-flightaware/net-ri-port +Description: Port for AVR-format input connections (0 disables): + dump1090 can accept connections to receive data from other sources in + several formats. This setting controls the port dump1090 will listen + on for AVR ("raw") format input connections. +Type: string +Default: 30001 + +Template: dump1090-flightaware/net-ro-port +Description: Port for AVR-format output connections (0 disables): + dump1090 can forward ADS-B messages to other software in several formats. + This setting controls the port dump1090 will listen on for AVR ("raw") + format output connections. +Type: string +Default: 30002 + +Template: dump1090-flightaware/net-bi-port +Description: Port for Beast-format input connections (0 disables): + dump1090 can accept connections to receive data from other sources in + several formats. This setting controls the port dump1090 will listen + on for Beast ("binary") format input connections. +Type: string +Default: 30004 + +Template: dump1090-flightaware/net-bo-port +Description: Port for Beast-format output connections (0 disables): + dump1090 can forward ADS-B messages to other software in several formats. + This setting controls the port dump1090 will listen on for Beast ("binary") + format output connections. +Type: string +Default: 30005 + +Template: dump1090-flightaware/net-sbs-port +Description: Port for SBS-format output connections (0 disables): + dump1090 can forward ADS-B messages to other software in several formats. + This setting controls the port dump1090 will listen on for SBS BaseStation + format output connections. +Type: string +Default: 30003 + +Template: dump1090-flightaware/net-fatsv-port +Description: Port for FATSV-format output connections (0 disables): + dump1090 can forward ADS-B messages to other software in several formats. + This setting controls the port dump1090 will listen on for FlightAware TSV + format output connections. +Type: string +Default: 10001 + +Template: dump1090-flightaware/net-heartbeat +Description: Seconds between heartbeat messages (0 disables): + If there is no other data sent on a network connection, dump1090 can + periodically send an empty heartbeat message to ensure that the + connection stays established. This setting controls the interval + betweeen heartbeat messages. +Type: string +Default: 60 + +Template: dump1090-flightaware/net-out-size +Description: Minimum output message size: + To avoid sending many small network messages, output connections will + accumulate data waiting to be sent until either a minimum size is reached + or a maximum delay is reached. This setting controls the minimum size, + in bytes. +Type: string +Default: 500 + +Template: dump1090-flightaware/net-out-rate +Description: Maximum output buffering time: + To avoid sending many small network messages, output connections will + buffer data waiting to be sent until either a minimum size is reached + or a maximum delay is reached. This setting controls the maximum delay. + The units are multiples of approximately 64ms, for unhelpful + implementation reasons. The default value of 15 is about 1 second. +Type: string +Default: 15 + +Template: dump1090-flightaware/net-buffer +Description: SO_SNDBUF size: + Here you can specify the TCP send buffer size to use on network connections. +Type: select +Choices: 65536, 131072, 262144 +Default: 262144 + +Template: dump1090-flightaware/net-bind-address +Description: Interface address to bind to (blank for all interfaces): + If you want to limit incoming connections to a particular interface, + specify the interface address here. A blank value will bind to the wildcard + address, allowing connections on all interfaces. + . + The default value of 127.0.0.1 will allow connections only on localhost, + i.e. only connections that originate on the same machine. +Type: string +Default: 127.0.0.1 + +Template: dump1090-flightaware/stats-interval +Description: Interval between logging stats, in seconds: + dump1090 will periodically log message reception stats to its logfile. + This setting controls how often that is done. +Type: string +Default: 3600 + +Template: dump1090-flightaware/extra-args +Description: Extra arguments to pass to dump1090: + Here you can add any extra arguments you want to pass to dump1090. +Type: string +Default: + +Template: dump1090-flightaware/invalid-is_unsigned_int +Description: Value must be an unsigned integer. +Type: error + +Template: dump1090-flightaware/invalid-is_unsigned_int_or_empty +Description: Value must be an unsigned integer, or blank. +Type: error + +Template: dump1090-flightaware/invalid-is_signed_int +Description: Value must be an integer. +Type: error + +Template: dump1090-flightaware/invalid-is_signed_int_or_empty +Description: Value must be an integer, or blank. +Type: error + +Template: dump1090-flightaware/invalid-is_not_empty +Description: Value cannot be empty. +Type: error + +Template: dump1090-flightaware/invalid-is_port_number +Description: Value must be a valid port number (1024-65535), or zero to disable. +Type: error + +Template: dump1090-flightaware/invalid-is_ipaddrish_or_empty +Description: Value must be an IP address or empty. +Type: error + +Template: dump1090-flightaware/invalid-is_number_or_empty +Description: Value must be a decimal number or empty. +Type: error + +Template: dump1090-flightaware/invalid-is_valid_gain +Description: Value must be a numeric gain value, or "max", or "agc". +Type: error diff --git a/debian/rules b/debian/rules index 84ec655..88632cd 100755 --- a/debian/rules +++ b/debian/rules @@ -15,8 +15,8 @@ DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk override_dh_auto_build: - dh_auto_build -- 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/dump1090-flightaware\"' - dh_auto_build -- -f makefaup1090 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/dump1090-flightaware\"' faup1090 + dh_auto_build -- 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/dump1090-flightaware/html\"' + dh_auto_build -- -f makefaup1090 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/dump1090-flightaware/html\"' faup1090 override_dh_auto_install: # we don't want to use the Makefile auto-install here, we handle it in dh_install