From 37bb1992d398d26010dccc317d9368500462b7f8 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 28 Dec 2014 11:55:29 +0000 Subject: [PATCH] Merge lots of package configuration / script changes from dump1090-mutability. --- debian/changelog | 1 + .../{dump1090-mr.default => config-template} | 74 +++--- debian/dump1090-mr.config | 201 +++++++++++++++ debian/dump1090-mr.init | 77 +++--- debian/dump1090-mr.install | 3 +- debian/dump1090-mr.postinst | 74 +++++- debian/dump1090-mr.postrm | 41 +++ debian/dump1090-mr.templates | 238 ++++++++++++++++++ debian/rules | 2 +- 9 files changed, 627 insertions(+), 84 deletions(-) rename debian/{dump1090-mr.default => config-template} (63%) create mode 100644 debian/dump1090-mr.config create mode 100644 debian/dump1090-mr.postrm create mode 100644 debian/dump1090-mr.templates diff --git a/debian/changelog b/debian/changelog index 678055d..1835e7c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ dump1090-mr (1.08.2302.14+1-3) UNRELEASED; urgency=medium * Remove spurious dependencies on net-tools * Update Build-Depends based on glitches found building under pbuilder. + * Update package configuration and support scripts based on those from dump1090-mutability. -- Oliver Jowett Sun, 07 Dec 2014 12:21:18 +0000 diff --git a/debian/dump1090-mr.default b/debian/config-template similarity index 63% rename from debian/dump1090-mr.default rename to debian/config-template index c5a4cce..7f6a766 100644 --- a/debian/dump1090-mr.default +++ b/debian/config-template @@ -1,99 +1,99 @@ -# Defaults for dump1090-mr -# This is a POSIX shell fragment +## TEMPLATE FILE - This is used to create /etc/default/dump1090-mr ## +## The first three lines will be discarded ## + +# dump1090-mr configuration file +# This is a POSIX shell fragment. +# You can edit this file directly, or use +# "dpkg-reconfigure dump1090-mr" # Set to "yes" to start dump1090 on boot. -START_DUMP1090="no" +START_DUMP1090= # User to run dump1090 as. -DUMP1090_USER="dump1090" +DUMP1090_USER= # Logfile to log to -#LOGFILE="/var/log/dump1090-mr.log" - -# -# The following options are all optional - defaults if not provided are -# shown below. -# +LOGFILE= # # Receiver options # -# RTLSDR device index to use +# RTLSDR device index or serial number to use # If set to "none", dump1090 will be started in --net-only mode -#DEVICE=0 +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, enables phase-enhancement of messages +PHASE_ENHANCE= # # Decoding options # # If yes, fixes messages with correctable CRC errors. -# Otherwise, discards messages with errors. -#FIX_CRC=no - -# If yes, enables phase-enhancement of messages that fail to decode -# the first time around. -#PHASE_ENHANCE=no +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. -#LAT=decimal.latitude.value -#LON=decimal.longitude.value +LAT= +LON= # # Networking options # # Port to listen on for HTTP connections. 0 disables. -#HTTP_PORT=8080 +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= # TCP heartbeat interval in seconds. 0 disables. -#NET_HEARTBEAT=60 +NET_HEARTBEAT= # Minimum output buffer size per write, in bytes. -#NET_OUTPUT_SIZE=5 +NET_OUTPUT_SIZE= # Maximum buffering time before writing. In units of approx 64ms (don't ask..). -#NET_OUTPUT_RATE=5 +NET_OUTPUT_RATE= -# TCP buffer size order. Power-of-two based - buffer size is 2^(n+16). -#NET_BUFFER=0 +# TCP buffer size, in bytes +NET_BUFFER= # Bind ports on a particular address. If unset, binds to all interfaces. -#BIND_ADDRESS= +# 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=3600 +STATS_INTERVAL= # Additional options that are passed to the Daemon. -#EXTRA_ARGS="" +EXTRA_ARGS= diff --git a/debian/dump1090-mr.config b/debian/dump1090-mr.config new file mode 100644 index 0000000..b757bad --- /dev/null +++ b/debian/dump1090-mr.config @@ -0,0 +1,201 @@ +#!/bin/sh + +NAME=dump1090-mr +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-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-mr/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 + 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-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-mr.init b/debian/dump1090-mr.init index 77e70fc..f2f9c4c 100644 --- a/debian/dump1090-mr.init +++ b/debian/dump1090-mr.init @@ -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-mr daemon" NAME=dump1090-mr -DAEMON=/usr/bin/$NAME +DESC="$NAME daemon" +DAEMON=/usr/bin/dump1090-mr ARGS="--quiet" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME @@ -25,37 +25,22 @@ 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 -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 -BIND_ADDRESS= -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 "$NET_BUFFER" ] && NET_BUFFER=0 + # receiver: case "x$DEVICE" in x|x0) ARGS="$ARGS --net" ;; @@ -67,7 +52,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 +62,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$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 -if [ -n "$BIND_ADDRESS" ]; then ARGS="$ARGS --net-bind-address $BIND_ADDRESS"; 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" +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 +104,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 +123,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-mr.install b/debian/dump1090-mr.install index 8feea8a..237afcc 100644 --- a/debian/dump1090-mr.install +++ b/debian/dump1090-mr.install @@ -1 +1,2 @@ -public_html/* usr/share/dump1090-mr +public_html/* usr/share/dump1090-mr/html +debian/config-template usr/share/dump1090-mr diff --git a/debian/dump1090-mr.postinst b/debian/dump1090-mr.postinst index e727c02..0de6296 100644 --- a/debian/dump1090-mr.postinst +++ b/debian/dump1090-mr.postinst @@ -17,10 +17,81 @@ set -e # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package +NAME=dump1090-mr +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-mr --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-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 +108,5 @@ esac #DEBHELPER# +if [ "$1" = "configure" ]; then db_stop; fi exit 0 diff --git a/debian/dump1090-mr.postrm b/debian/dump1090-mr.postrm new file mode 100644 index 0000000..c88a279 --- /dev/null +++ b/debian/dump1090-mr.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-mr + ;; + + 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-mr.templates b/debian/dump1090-mr.templates new file mode 100644 index 0000000..d6589d7 --- /dev/null +++ b/debian/dump1090-mr.templates @@ -0,0 +1,238 @@ +Template: dump1090-mr/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-mr" as root, + or by editing /etc/default/dump1090-mr. +Type: boolean +Default: true + +Template: dump1090-mr/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-mr/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-mr.log + +Template: dump1090-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/net-http-port +Description: Port for internal webserver (0 disables): + dump1090 can provide an internal webserver that serves a basic "virtual + radar" map. You can select a port to listen on here. +Type: string +Default: 0 + +Template: dump1090-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/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-mr/invalid-is_unsigned_int +Description: Value must be an unsigned integer. +Type: error + +Template: dump1090-mr/invalid-is_unsigned_int_or_empty +Description: Value must be an unsigned integer, or blank. +Type: error + +Template: dump1090-mr/invalid-is_signed_int +Description: Value must be an integer. +Type: error + +Template: dump1090-mr/invalid-is_signed_int_or_empty +Description: Value must be an integer, or blank. +Type: error + +Template: dump1090-mr/invalid-is_not_empty +Description: Value cannot be empty. +Type: error + +Template: dump1090-mr/invalid-is_port_number +Description: Value must be a valid port number (1024-65535), or zero to disable. +Type: error + +Template: dump1090-mr/invalid-is_ipaddrish_or_empty +Description: Value must be an IP address or empty. +Type: error + +Template: dump1090-mr/invalid-is_number_or_empty +Description: Value must be a decimal number or empty. +Type: error + +Template: dump1090-mr/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 38f129b..5f5e1e4 100755 --- a/debian/rules +++ b/debian/rules @@ -15,7 +15,7 @@ DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk override_dh_auto_build: - dh_auto_build -- 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/dump1090-mr\"' + dh_auto_build -- 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/dump1090-mr/html\"' override_dh_install: dh_install