diff --git a/debian/control b/debian/control index 8c146e4..349c53d 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Vcs-Git: https://github.com/mutability/dump1090.git Package: dump1090-mutability Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, adduser -Recommends: python(>=2.5), cron | cron-daemon, curl, lighttpd +Recommends: python(>=2.5), lighttpd Provides: fatsv-data-source Description: ADS-B Ground Station System for RTL-SDR Networked Aviation Mode S / ADS-B decoder/translator with RTL-SDR software diff --git a/debian/cron-template b/debian/cron-template deleted file mode 100644 index 38b1210..0000000 --- a/debian/cron-template +++ /dev/null @@ -1,12 +0,0 @@ -## TEMPLATE FILE - This is used to create /etc/cron.d/dump1090-mutability ## -## The first three lines will be discarded ## - -# Checks for updates to the VRS aircraft database once a day at around 5am; -# when an update is available, downloads it and regenerates the JSON data -# used by the webmap. - -# NB: the minute value below is randomly generated on install, to avoid -# all installs hitting the server at the same time. - -# m h dom mon dow user command -@MIN@ 5 * * * @USER@ test -x /usr/share/dump1090-mutability/update-aircraft-database.sh && /usr/share/dump1090-mutability/update-aircraft-database.sh --log-to-file diff --git a/debian/dump1090-mutability.init b/debian/dump1090-mutability.init index 1bb4adb..4ccbc36 100644 --- a/debian/dump1090-mutability.init +++ b/debian/dump1090-mutability.init @@ -126,7 +126,6 @@ do_start() fi # create logfile with the appropriate permissions if not already there - # (the cronjob running as DUMP1090_USER wants to append to it) touch $LOGFILE chown "$DUMP1090_USER":root $LOGFILE diff --git a/debian/dump1090-mutability.postinst b/debian/dump1090-mutability.postinst index 5038c52..30151d2 100644 --- a/debian/dump1090-mutability.postinst +++ b/debian/dump1090-mutability.postinst @@ -21,8 +21,6 @@ NAME=dump1090-mutability CONFIGFILE=/etc/default/$NAME SRCCONFIGFILE=$CONFIGFILE TEMPLATECONFIG=/usr/share/$NAME/config-template -CRONFILE=/etc/cron.d/$NAME -TEMPLATECRON=/usr/share/$NAME/cron-template SEDSCRIPT=$CONFIGFILE.sed.tmp subvar_raw() { @@ -111,7 +109,7 @@ case "$1" in adduser --system --home /usr/share/$NAME --no-create-home --quiet "$RUNAS" fi - # create log if missing; change ownership if needed so the cronjob works + # create log if missing; change ownership if needed db_get $NAME/log-file touch $RET chown $RUNAS $RET diff --git a/debian/dump1090-mutability.postrm b/debian/dump1090-mutability.postrm index 6251a8f..625de17 100644 --- a/debian/dump1090-mutability.postrm +++ b/debian/dump1090-mutability.postrm @@ -22,8 +22,6 @@ set -e case "$1" in purge) rm -f /etc/default/dump1090-mutability - rm -f /etc/cron.d/dump1090-mutability - rm -rf /var/cache/dump1090-mutability ;; remove) diff --git a/tools/update-aircraft-database.sh b/tools/update-aircraft-database.sh deleted file mode 100755 index af1c502..0000000 --- a/tools/update-aircraft-database.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -# This script checks for a new version of BasicAircraftLookup from -# the VRS website and, if one is available, downloads it and updates -# the dump1090 webmap json files. - -set -e - -# defaults that can be overridden: -VRS_URL=${VRS_URL:-http://www.virtualradarserver.co.uk/Files/BasicAircraftLookup.sqb.gz} -CACHEDIR=${CACHEDIR:-/var/cache/dump1090-mutability} -JSONDIR=${JSONDIR:-$CACHEDIR/db} -SQBDIR=${SQBDIR:-$CACHEDIR/sqb} -LOGFILE=${LOGFILE:-/var/log/dump1090-mutability.log} -UPDATESCRIPT=${UPDATESCRIPT:-/usr/share/dump1090-mutability/vrs-basicaircraft-to-json.py} - -if [ -f /etc/default/dump1090-mutability ] -then - . /etc/default/dump1090-mutability -fi - -ETAGFILE=$SQBDIR/BasicAircraftLookup.sqb.etag -SQBFILE=$SQBDIR/BasicAircraftLookup.sqb - -CHECKMODIFIED=true -LOGTOFILE=false -while [ "$#" -gt 0 ] -do - case "$1" in - -f|--force) CHECKMODIFIED=false ;; - -l|--log-to-file) LOGTOFILE=true ;; - *) echo "unrecognized option: $1" >&2; exit 1 ;; - esac - shift -done - -if $LOGTOFILE; then exec >>$LOGFILE 2>&1; fi - -log() { - date "+%c $*" >&2 -} - -mkdir -p $CACHEDIR $JSONDIR $SQBDIR -rm -f $ETAGFILE.new $SQBFILE.new - -log "Checking VRS server for an updated database.." - -# get ETag -curl --silent --fail --include --head $VRS_URL | grep ETag >$ETAGFILE.new - -# check for existing file -RETRIEVE=true -ARGS="" -if $CHECKMODIFIED && [ -f $SQBFILE ] -then - if [ -s $ETAGFILE -a -s $ETAGFILE.new ] - then - if cmp -s $ETAGFILE $ETAGFILE.new - then - log "Database not modified." - RETRIEVE=false - else - log "Database modified, will retrieve a new copy." - fi - else - # do an if-modified-since - log "Database possibly modified, will try to retrieve a new copy." - ARGS="-z $SQBFILE" - fi -fi - -if $RETRIEVE -then - log "Retrieving database.." - curl --silent --fail --remote-time --retry 2 $ARGS -o $SQBFILE.new $VRS_URL - mv $ETAGFILE.new $ETAGFILE - if [ -f $SQBFILE.new ] - then - log "Decompressing database.." - zcat $SQBFILE.new >$SQBFILE - touch -r $SQBFILE.new $SQBFILE - rm $SQBFILE.new - else - log "Database not modified." - fi -fi - -UPDATE=true -if $CHECKMODIFIED -then - if test -f $JSONDIR/last_update; then - if ! test $SQBFILE -nt $JSONDIR/last_update; then UPDATE=false; fi - fi -fi - -if $UPDATE -then - log "Updating JSON files from database.." - mkdir -p $JSONDIR/new - $UPDATESCRIPT $SQBFILE $JSONDIR/new - rm -f $JSONDIR/*.json - mv $JSONDIR/new/*.json $JSONDIR/ - touch -r $SQBFILE $JSONDIR/last_update - rmdir $JSONDIR/new - log "Done." -else - log "No update to JSON files needed." -fi -