Merge branch 'mr-pi-package'

Conflicts:
	Makefile
This commit is contained in:
Oliver Jowett 2014-12-06 19:39:48 +00:00
commit b7562c302a
12 changed files with 440 additions and 4 deletions

View file

@ -10,18 +10,19 @@ SHAREDIR=$(PREFIX)/share/$(PROGNAME)
EXTRACFLAGS=-DHTMLPATH=\"$(SHAREDIR)\"
endif
CFLAGS=-O2 -g -Wall -W `pkg-config --cflags librtlsdr`
LIBS=`pkg-config --libs librtlsdr` -lpthread -lm -lrt
CFLAGS+=-O2 -g -Wall -W `pkg-config --cflags librtlsdr`
LIBS=-lpthread -lm -lrt
LIBS_RTL=`pkg-config --libs librtlsdr`
CC=gcc
all: dump1090 view1090
%.o: %.c
$(CC) $(CFLAGS) $(EXTRACFLAGS) -c $<
$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRACFLAGS) -c $<
dump1090: dump1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o
$(CC) -g -o dump1090 dump1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o $(LIBS) $(LDFLAGS)
$(CC) -g -o dump1090 dump1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o $(LIBS) $(LIBS_RTL) $(LDFLAGS)
view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o
$(CC) -g -o view1090 view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o $(LIBS) $(LDFLAGS)

14
debian/changelog vendored Normal file
View file

@ -0,0 +1,14 @@
dump1090-mr (1.08.2302.14+1-2) unstable; urgency=medium
* Pass --name / --user to start-stop-daemon when starting
* Log to /var/log/dump1090-mr.log (configurable via LOGFILE)
* Log stats once an hour by default (configurable via STATS_INTERVAL)
* Include a logrotate configuration
-- Oliver Jowett <oliver@mutability.co.uk> Sat, 06 Dec 2014 18:37:12 +0000
dump1090-mr (1.08.2302.14+1-1) unstable; urgency=medium
* Initial package release.
-- Oliver Jowett <oliver@mutability.co.uk> Fri, 05 Dec 2014 22:55:41 +0000

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
8

20
debian/control vendored Normal file
View file

@ -0,0 +1,20 @@
Source: dump1090-mr
Section: embedded
Priority: extra
Maintainer: Oliver Jowett <oliver@mutability.co.uk>
Build-Depends: debhelper(>=8), net-tools, librtlsdr-dev
Standards-Version: 3.9.3
Homepage: https://github.com/MalcolmRobb/dump1090
Vcs-Git: https://github.com/mutability/dump1090.git -b mr-pi-package
Package: dump1090-mr
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, net-tools, adduser
Description: ADS-B Ground Station System for RTL-SDR
Networked Aviation Mode S / ADS-B decoder/translator with RTL-SDR software
defined radio USB device support.
.
Includes a mini-webserver that you can access to see aircraft in the vicinity
of your receiver.
.
This is a packaging of MalcomRobb's fork of the original dump1090 version.

37
debian/copyright vendored Normal file
View file

@ -0,0 +1,37 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: dump1090
Upstream-Contact: https://github.com/MalcolmRobb
Source: https://github.com/MalcolmRobb/dump1090
Files: *
Copyright: Salvatore Sanfilippo, Malcom Robb and other contributors.
License: BSD-3-Clause
Files: debian/*
Copyright: 2014 Oliver Jowett
License: BSD-3-Clause
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

99
debian/dump1090-mr.default vendored Normal file
View file

@ -0,0 +1,99 @@
# Defaults for dump1090-mr
# This is a POSIX shell fragment
# Set to "yes" to start dump1090 on boot.
START_DUMP1090="no"
# User to run dump1090 as.
DUMP1090_USER="dump1090"
# Logfile to log to
#LOGFILE="/var/log/dump1090-mr.log"
#
# The following options are all optional - defaults if not provided are
# shown below.
#
#
# Receiver options
#
# RTLSDR device index to use
# If set to "none", dump1090 will be started in --net-only mode
#DEVICE=0
# 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
# RTLSDR frequency correction in PPM
#PPM=0
#
# 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
# If yes, enables aggressive fixes to damaged messages.
# Use with caution - it can increase the rate of undetected errors.
#AGGRESSIVE=no
# If set, supplies a reference location for local position decoding.
#LAT=decimal.latitude.value
#LON=decimal.longitude.value
#
# Networking options
#
# Port to listen on for HTTP connections. 0 disables.
#HTTP_PORT=8080
# Port to listen on for raw (AVR-format) input connections. 0 disables.
#RAW_INPUT_PORT=30001
# Port to listen on for raw (AVR-format) output connections. 0 disables.
#RAW_OUTPUT_PORT=30002
# Port to listen on for SBS-format output connections. 0 disables.
#SBS_OUTPUT_PORT=30003
# Port to listen on for Beast-format input connections. 0 disables.
#BEAST_INPUT_PORT=30004
# Port to listen on for Beast-format output connections. 0 disables.
#BEAST_OUTPUT_PORT=30005
# TCP heartbeat interval in seconds. 0 disables.
#NET_HEARTBEAT=60
# Minimum output buffer size per write, in bytes.
#NET_OUTPUT_SIZE=5
# Maximum buffering time before writing. In units of approx 64ms (don't ask..).
#NET_OUTPUT_RATE=5
# TCP buffer size order. Power-of-two based - buffer size is 2^(n+16).
#NET_BUFFER=0
# Bind ports on a particular address. If unset, binds to all interfaces.
#BIND_ADDRESS=
#
# Misc options
#
# Interval (in seconds) between logging stats to the logfile. 0 disables.
#STATS_INTERVAL=3600
# Additional options that are passed to the Daemon.
#EXTRA_ARGS=""

190
debian/dump1090-mr.init vendored Normal file
View file

@ -0,0 +1,190 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: dump1090-mr
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: dump1090 daemon (MalcolmRobb variant)
# Description: Receives ADS-B messages from a RTLSDR dongle
# and makes them available to other applications via
# a variety of network protocols.
### END INIT INFO
# Do NOT "set -e"
# 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
ARGS="--quiet"
PIDFILE=/var/run/$NAME.pid
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
# receiver:
case "x$DEVICE" in
x|x0) ARGS="$ARGS --net" ;;
xnone) ARGS="$ARGS --net-only" ;;
*) ARGS="$ARGS --net --device-index $DEVICE" ;;
esac
case "x$GAIN" in
x|xmax) ;;
xagc) ARGS="$ARGS --gain -10" ;;
*) ARGS="$ARGS --gain $GAIN" ;;
esac
if [ "x$PPM" != "x0" ]; then ARGS="$ARGS --ppm $PPM"; fi
# decoder:
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
# 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
# misc:
if [ "x$STATS_INTERVAL" != "x0" ]; 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
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
if [ "x$START_DUMP1090" != "xyes" ]; then
log_warning_msg "Not starting $NAME daemon, disabled via /etc/default/$NAME"
return 2
fi
start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME --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 -- \
$ARGS >>$LOGFILE 2>&1 \
|| return 2
sleep 1
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 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
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
sleep 1
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

1
debian/dump1090-mr.install vendored Normal file
View file

@ -0,0 +1 @@
public_html/* usr/share/dump1090-mr

5
debian/dump1090-mr.logrotate vendored Normal file
View file

@ -0,0 +1,5 @@
/var/log/dump1090-mr.log {
weekly
rotate 4
copytruncate
}

40
debian/dump1090-mr.postinst vendored Normal file
View file

@ -0,0 +1,40 @@
#!/bin/sh
# postinst script for dump1090
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
adduser --system --home /usr/share/dump1090-mr --no-create-home --quiet dump1090
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst 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

27
debian/rules vendored Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
override_dh_auto_build:
dh_auto_build -- 'EXTRACFLAGS=-DHTMLPATH=\"/usr/share/dump1090-mr\"'
override_dh_install:
dh_install
install -d debian/dump1090-mr/usr/bin
cp -a dump1090 debian/dump1090-mr/usr/bin/dump1090-mr
cp -a view1090 debian/dump1090-mr/usr/bin/view1090-mr
%:
dh $@

1
debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (native)