From c46799b448694db649f3043431c9e1b2014b2d3b Mon Sep 17 00:00:00 2001 From: jprochazka Date: Mon, 17 Jun 2024 17:38:17 -0400 Subject: [PATCH] Replaced dump978-mutability with dump978-fa --- CHANGELOG.md | 3 + bash/decoders/dump978-fa.sh | 212 ++++++++++++++++++++++ bash/decoders/dump978.sh | 342 ------------------------------------ bash/main.sh | 56 +++--- bash/variables.sh | 8 +- 5 files changed, 249 insertions(+), 372 deletions(-) create mode 100755 bash/decoders/dump978-fa.sh delete mode 100755 bash/decoders/dump978.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dbddec..84b719e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The following is a history of the changes made to this project. * Removed option to install dump1090-mutability. * The dump1090-fa and piaware_builder install process has been updated. +* The dump978 has been rewritten in order to use FlightAwares version of dump978. +* Version check for dump1090-fa has been fixed. +* Fix bug where PiAware was installed every run even if already installed. ## v2.7.2 *(prerelease)* diff --git a/bash/decoders/dump978-fa.sh b/bash/decoders/dump978-fa.sh new file mode 100755 index 0000000..54dd8f2 --- /dev/null +++ b/bash/decoders/dump978-fa.sh @@ -0,0 +1,212 @@ +#!/bin/bash + +##################################################################################### +# ADS-B RECEIVER # +##################################################################################### +# # +# This script is not meant to be executed directly. # +# Instead execute install.sh to begin the installation process. # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # +# Copyright (c) 2015-2024 Joseph A. Prochazka # +# # +# Permission is hereby granted, free of charge, to any person obtaining a copy # +# of this software and associated documentation files (the "Software"), to deal # +# in the Software without restriction, including without limitation the rights # +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # +# copies of the Software, and to permit persons to whom the Software is # +# furnished to do so, subject to the following conditions: # +# # +# The above copyright notice and this permission notice shall be included in all # +# copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # +# SOFTWARE. # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +### INCLUDE EXTERNAL SCRIPTS + +source ${RECEIVER_BASH_DIRECTORY}/variables.sh +source ${RECEIVER_BASH_DIRECTORY}/functions.sh + +### BEGIN SETUP + +if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then + clear + echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}" +fi +echo "" +echo -e "\e[92m Setting up dump978-fa..." +echo "" +echo -e "\e[93m ------------------------------------------------------------------------------\e[96m" +echo "" +if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then + whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978-fa Setup" --yesno "This is the FlightAware 978MHz UAT decoder. It is a reimplementation in C++, loosely based on the demodulator from https://github.com/mutability/dump978.\n\n https://github.com/flightaware/dump978\n\nContinue setup by installing dump978-fa?" 14 78 + if [[ $? -eq 1 ]] ; then + # Setup has been halted by the user. + echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m" + echo -e " Setup has been halted at the request of the user." + echo "" + echo -e "\e[93m ------------------------------------------------------------------------------" + echo -e "\e[92m Dump978-fa setup halted.\e[39m" + echo "" + read -p "Press enter to continue..." CONTINUE + exit 1 + fi +fi + +## CHECK FOR PREREQUISITE PACKAGES + +echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m" +echo "" +CheckPackage build-essential +CheckPackage debhelper +CheckPackage libboost-system-dev +CheckPackage libboost-program-options-dev +CheckPackage libboost-regex-dev +CheckPackage libboost-filesystem-dev +CheckPackage libsoapysdr-dev +CheckPackage soapysdr-module-rtlsdr + +## DOWNLOAD OR UPDATE THE DUMP978-FA SOURCE + +echo -e "\e[95m Preparing the dump978-fa Git repository...\e[97m" +echo "" +if [[ -d "${RECEIVER_BUILD_DIRECTORY}/dump978-fa/dump978" ]] && [[ -d "${RECEIVER_BUILD_DIRECTORY}/dump978-fa/dump978/.git" ]] ; then + # A directory with a git repository containing the source code already exists. + echo -e "\e[94m Entering the dump978-fa git repository directory...\e[97m" + cd ${RECEIVER_BUILD_DIRECTORY}/dump978-fa/dump978 2>&1 + echo -e "\e[94m Updating the local dump978-fa git repository...\e[97m" + echo "" + git pull +else + # A directory containing the source code does not exist in the build directory. + echo -e "\e[94m Creating the ADS-B Receiver Project build directory...\e[97m" + echo "" + mkdir -vp ${RECEIVER_BUILD_DIRECTORY}/dump978-fa + echo "" + echo -e "\e[94m Entering the dump978-fa build directory...\e[97m" + cd ${RECEIVER_BUILD_DIRECTORY}/dump978-fa 2>&1 + echo -e "\e[94m Cloning the dump978-fa git repository locally...\e[97m" + echo "" + git clone https://github.com/flightaware/dump978.git +fi + +## BUILD AND INSTALL THE DUMP978-FA PACKAGE + +echo "" +echo -e "\e[95m Building and installing the dump978-fa package...\e[97m" +echo "" +if [[ ! "${PWD}" = "${RECEIVER_BUILD_DIRECTORY}/dump978-fa/dump978" ]] ; then + echo -e "\e[94m Entering the dump978-fa git repository directory...\e[97m" + cd ${RECEIVER_BUILD_DIRECTORY}/dump978-fa/dump978 2>&1 +fi +echo -e "\e[94m Building the dump978-fa package...\e[97m" +echo "" +dpkg-buildpackage -b +echo "" +echo -e "\e[94m Entering the dump978-fa build directory...\e[97m" +cd ${RECEIVER_BUILD_DIRECTORY}/dump978-fa 2>&1 +echo -e "\e[94m Installing the dump978-fa package...\e[97m" +echo "" +sudo dpkg -i ${RECEIVER_BUILD_DIRECTORY}/dump978-fa/dump978-fa_${DUMP978_FA_VERSION}_*.deb +echo "" +echo -e "\e[94m Installing the skyaware978 package...\e[97m" +echo "" +sudo dpkg -i ${RECEIVER_BUILD_DIRECTORY}/dump978-fa/skyaware978_${DUMP978_FA_VERSION}_*.deb + +# Check that the package was installed. +echo "" +echo -e "\e[94m Checking that the dump978-fa package was installed properly...\e[97m" +if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then + # If the dump978-fa package could not be installed halt setup. + echo "" + echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m" + echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE." + echo -e " SETUP HAS BEEN TERMINATED!" + echo "" + echo -e "\e[93mThe package \"dump978-fa\" could not be installed.\e[39m" + echo "" + echo -e "\e[93m ------------------------------------------------------------------------------" + echo -e "\e[92m Dump978-fa setup halted.\e[39m" + echo "" + read -p "Press enter to continue..." CONTINUE + exit 1 +fi + +# Create binary package archive directory. +if [[ ! -d "${RECEIVER_BUILD_DIRECTORY}/package-archive" ]] ; then + echo -e "\e[94m Creating package archive directory...\e[97m" + echo -e "" + mkdir -vp ${RECEIVER_BUILD_DIRECTORY}/package-archive 2>&1 + echo -e "" +fi + +# Archive binary package. +echo -e "\e[94m Moving the dump978-fa binary package into the archive directory...\e[97m" +echo "" +cp -vf ${RECEIVER_BUILD_DIRECTORY}/dump978-fa/*.deb ${RECEIVER_BUILD_DIRECTORY}/package-archive/ 2>&1 +echo "" + +### CONFIGURATION + +# Check if the dump1090-fa package is installed. +echo -e "\e[94m Checking if the dump1090-fa package is installed...\e[97m" +if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] || [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then + # Check if dump978-fa has already been configured. + echo -e "\e[94m Checking if the dump978-fa package has been configured...\e[97m" + if grep -wq "driver=rtlsdr,serial=" /etc/default/dump978-fa; then + echo -e "\e[94m This dump978-fa installation appears to have been configured...\e[97m" + else + if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then + whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR Dongle Assignments" --msgbox "It appears one of the dump1090 packages has been installed on this device. In order to run dump978 in tandem with dump1090 you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run both decoders on a single device you will need to have two separate RTL-SDR devices connected to your device." 12 78 + # Ask the user which USB device is to be used for dump1090. + DUMP1090_DEVICE_SERIAL=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the serial number for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) + while [[ -z "${DUMP1090_DEVICE_SERIAL}" ]] ; do + DUMP1090_DEVICE_SERIAL=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the serial number for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) + done + # Ask the user which USB device is to be use for dump978. + DUMP978_DEVICE_SERIAL=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the serial number for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) + while [[ -z "${DUMP978_DEVICE_SERIAL}" ]] ; do + DUMP978_DEVICE_SERIAL=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the serial number for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) + done + fi + + # Assign the specified RTL-SDR dongle to dump978-fa. + echo -e "\e[94m Assigning RTL-SDR dongle \"${DUMP978_DEVICE_SERIAL}\" to dump978-fa...\e[97m" + sudo sed -i -e "s/driver=rtlsdr/driver=rtlsdr,serial=${DUMP978_DEVICE_SERIAL}/g" /etc/default/dump978-fa + echo -e "\e[94m Restarting dump978-fa...\e[97m" + sudo service dump978-fa force-reload + + # Assign the specified RTL-SDR dongle to dump1090-fa. + if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then + echo -e "\e[94m Assigning RTL-SDR dongle \"${DUMP1090_DEVICE_SERIAL}\" to dump1090-fa...\e[97m" + ChangeConfig "RECEIVER_SERIAL" ${DUMP1090_DEVICE_SERIAL} "/etc/default/dump1090-fa" + echo -e "\e[94m Restarting dump1090-fa...\e[97m" + sudo service dump1090-fa force-reload + fi + fi +fi + +### SETUP COMPLETE + +# Return to the project root directory. +echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m" +cd ${RECEIVER_ROOT_DIRECTORY} 2>&1 + +echo "" +echo -e "\e[93m ------------------------------------------------------------------------------" +echo -e "\e[92m Dump978-fa setup is complete.\e[39m" +echo "" +if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then + read -p "Press enter to continue..." CONTINUE +fi + +exit 0 diff --git a/bash/decoders/dump978.sh b/bash/decoders/dump978.sh deleted file mode 100755 index 90c2ca4..0000000 --- a/bash/decoders/dump978.sh +++ /dev/null @@ -1,342 +0,0 @@ -#!/bin/bash - -##################################################################################### -# ADS-B RECEIVER # -##################################################################################### -# # -# This script is not meant to be executed directly. # -# Instead execute install.sh to begin the installation process. # -# # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# # -# Copyright (c) 2015-2019 Joseph A. Prochazka # -# # -# Permission is hereby granted, free of charge, to any person obtaining a copy # -# of this software and associated documentation files (the "Software"), to deal # -# in the Software without restriction, including without limitation the rights # -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # -# copies of the Software, and to permit persons to whom the Software is # -# furnished to do so, subject to the following conditions: # -# # -# The above copyright notice and this permission notice shall be included in all # -# copies or substantial portions of the Software. # -# # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # -# SOFTWARE. # -# # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - -### VARIABLES - -RECEIVER_ROOT_DIRECTORY="${PWD}" -RECEIVER_BASH_DIRECTORY="${RECEIVER_ROOT_DIRECTORY}/bash" -RECEIVER_BUILD_DIRECTORY="${RECEIVER_ROOT_DIRECTORY}/build" - -### INCLUDE EXTERNAL SCRIPTS - -source ${RECEIVER_BASH_DIRECTORY}/variables.sh -source ${RECEIVER_BASH_DIRECTORY}/functions.sh - -## SET INSTALLATION VARIABLES - -# Source the automated install configuration file if this is an automated installation. -if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "true" ]] && [[ -s "${RECEIVER_CONFIGURATION_FILE}" ]] ; then - source ${RECEIVER_CONFIGURATION_FILE} -fi - -### BEGIN SETUP - -if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then - clear - echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}" -fi -echo -e "" -echo -e "\e[92m Setting up dump978..." -echo -e "" -echo -e "\e[93m ------------------------------------------------------------------------------\e[96m" -echo -e "" -if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then - whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090-mutability Setup" --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals.\n\n https://github.com/mutability/dump978\n\nWould you like to continue setup by installing dump978?" 9 78 - if [[ $? -eq 1 ]] ; then - # Setup has been halted by the user. - echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m" - echo -e " Setup has been halted at the request of the user." - echo -e "" - echo -e "\e[93m ------------------------------------------------------------------------------" - echo -e "\e[92m Dump978 setup halted.\e[39m" - echo -e "" - read -p "Press enter to continue..." CONTINUE - exit 1 - fi -fi - -## CHECK FOR PREREQUISITE PACKAGES - -echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m" -echo -e "" -CheckPackage git -CheckPackage make -CheckPackage rtl-sdr -CheckPackage librtlsdr-dev -CheckPackage libusb-1.0-0-dev -CheckPackage gcc -CheckPackage netcat -CheckPackage lighttpd - -## ENABLE THE USE OF /ETC/RC.LOCAL IF THE FILE DOES NOT EXIST - -if [ ! -f /etc/rc.local ]; then - echo "" - echo -e "\e[95m Enabling the use of the /etc/rc.local file...\e[97m" - echo "" - - # In Debian Stretch /etc/rc.local has been removed. - # However at this time we can bring this file back into play. - # As to if in future releases this will work remains to be seen... - - echo -e "\e[94m Creating the file /etc/rc.local...\e[97m" - sudo tee /etc/rc.local > /dev/null <&1 -echo -e "\e[94m Cloning the dump978 Git repository locally...\e[97m" -echo -e "" -git clone https://github.com/mutability/dump978.git - -## BUILD THE DUMP978 BINARIES - -echo -e "" -echo -e "\e[95m Building the dump978 binaries...\e[97m" -echo -e "" -# Enter the dump978 repository if we are not already in it. -if [[ ! "${PWD}" = "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978" ]] ; then - echo -e "\e[94m Entering the dump978 Git repository directory...\e[97m" - cd ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978 2>&1 -fi -# Build the dump978 binaries from source. -echo -e "\e[94m Building the dump978 binaries...\e[97m" -echo -e "" -make all -echo -e "" - -# Check that the dump978 binaries were built. -echo -e "\e[94m Checking that the dump978 binaries were built...\e[97m" -if [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978/dump978" ]] || [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978/uat2esnt" ]] || [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978/uat2json" ]] || [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978/uat2text" ]] ; then - # If the dump978 binaries could not be found halt setup. - echo -e "" - echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m" - echo -e " UNABLE TO LOCATE THE DUMP978 BINARIES." - echo -e " SETUP HAS BEEN TERMINATED!" - echo -e "" - echo -e "\e[93mThe dump978 binaries appear to have not been built successfully..\e[39m" - echo -e "" - echo -e "\e[93m ------------------------------------------------------------------------------" - echo -e "\e[92m Dump978 setup halted.\e[39m" - echo -e "" - read -p "Press enter to continue..." CONTINUE - exit 1 -fi - -## SETUP AND CONFIGURE THE DEVICE TO UTILIZE THE DDUMP978 BINARIES - -echo -e "" -echo -e "\e[95m Configuring the device to utilize the dump978 binaries...\e[97m" -echo -e "" - -### BLACKLIST UNWANTED RTL-SDR MODULES - -# Create an RTL-SDR blacklist file so the device does not claim SDR's for other purposes. -BlacklistModules - -# Remove the dvb_usb_rtl28xxu kernel module. -echo -e "\e[94m Checking if the kernel module dvb_usb_rtl28xxu is loaded...\e[97m" -if lsmod | grep "dvb_usb_rtl28xxu" &> /dev/null ; then - echo -e "\e[94m Removing the kernel module dvb_usb_rtl28xxu...\e[97m" - echo "" - sudo rmmod dvb_usb_rtl28xxu - echo "" -fi - -# Check if the dump1090-mutability package is installed. -echo -e "\e[94m Checking if the dump1090-mutability package is installed...\e[97m" -if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] || [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then - # The dump1090-mutability package appear to be installed. - if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then - whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR Dongle Assignments" --msgbox "It appears one of the dump1090 packages has been installed on this device. In order to run dump978 in tandem with dump1090 you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run both decoders on a single device you will need to have two separate RTL-SDR devices connected to your device." 12 78 - # Ask the user which USB device is to be used for dump1090. - DUMP1090_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) - while [[ -z "${DUMP1090_DEVICE_ID}" ]] ; do - DUMP1090_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) - done - # Ask the user which USB device is to be use for dump978. - DUMP978_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) - while [[ -z "${DUMP978_DEVICE_ID}" ]] ; do - DUMP978_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3) - done - fi - - # Assign the specified RTL-SDR dongle to dump1090-mutability. - if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then - echo -e "\e[94m Assigning RTL-SDR dongle \"${DUMP1090_DEVICE_ID}\" to dump1090-mutability...\e[97m" - ChangeConfig "DEVICE" ${DUMP1090_DEVICE_ID} "/etc/default/dump1090-mutability" - echo -e "\e[94m Restarting dump1090-mutability...\e[97m" - echo -e "" - sudo service dump1090-mutability force-reload - echo -e "" - fi - - # Assign the specified RTL-SDR dongle to dump1090-fa. - if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then - echo -e "\e[94m Assigning RTL-SDR dongle \"${DUMP1090_DEVICE_ID}\" to dump1090-fa...\e[97m" - ChangeSwitch "--device-index" "${DUMP1090_DEVICE_ID}" "/etc/default/dump1090-fa" - echo -e "\e[94m Restarting dump1090-fa...\e[97m" - echo -e "" - sudo service dump1090-fa force-reload - echo -e "" - fi - - # Get the latitude and longitude set in the dump1090-mutability configuration file to be used later. - echo -e "\e[94m Retrieving the receiver's latitude from /etc/default/dump1090-mutability...\e[97m" - RECEIVER_LATITUDE=`GetConfig "LAT" "/etc/default/dump1090-mutability"` - echo -e "\e[94m Retrieving the receiver's longitude from /etc/default/dump1090-mutability...\e[97m" - RECEIVER_LONGITUDE=`GetConfig "LON" "/etc/default/dump1090-mutability"` -fi - -# If a device has not yet been assigned to dump978 assign the first available. -if [[ -z "${DUMP978_DEVICE_ID}" ]] ; then - echo -e "\e[94m Assigning RTL-SDR dongle \"0\" to dump978...\e[97m" - DUMP978_DEVICE_ID="0" -fi - -# Declare the LIGHTTPD_DOCUMENT_ROOT_DIRECTORY variable. -echo -e "\e[94m Getting the path to Lighttpd's document root...\e[97m" -LIGHTTPD_DOCUMENT_ROOT_SETTING=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root` -LIGHTTPD_DOCUMENT_ROOT_DIRECTORY=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< ${LIGHTTPD_DOCUMENT_ROOT_SETTING}` - -# Set the receivers latitude and longitude. -if [[ -z "${RECEIVER_LATITUDE}" ]] && [[ -z "${RECEIVER_LONGITUDE}" ]] && [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then - # If the receiver's' latitude has not yet been set ask for it. - RECEIVER_LATITUDE_TITLE="Receiver Latitude" - while [[ -z "${RECEIVER_LATITUDE}" ]] ; do - RECEIVER_LATITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${RECEIVER_LATITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3) - RECEIVER_LATITUDE_TITLE="Receiver Latitude (REQUIRED)" - done - # If the receiver's' longitude has not yet been set ask for it. - RECEIVER_LONGITUDE_TITLE="Receiver Longitude" - while [[ -z "${RECEIVER_LONGITUDE}" ]] ; do - RECEIVER_LONGITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${RECEIVER_LONGITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3) - RECEIVER_LONGITUDE_TITLE="Receiver Latitude (REQUIRED)" - done -fi -# Finally set the reciver's latitude and longitude if these variables were supplied. -if [[ -n "${RECEIVER_LATITUDE}" ]] && [[ -n "${RECEIVER_LONGITUDE}" ]] ; then - if [ -f ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/config.js ]; then - echo -e "\e[94m Setting the receiver's latitude in ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/config.js to ${RECEIVER_LATITUDE}...\e[97m" - ChangeConfig "SiteLat" "${RECEIVER_LATITUDE}" "${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/config.js" - echo -e "\e[94m Setting the receiver's longitude in ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/config.js to ${RECEIVER_LONGITUDE}...\e[97m" - ChangeConfig "SiteLon" "${RECEIVER_LONGITUDE}" "${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/config.js" - fi - echo -e "\e[94m Setting the receiver's latitude in ${RECEIVER_BUILD_DIRECTORY}/portal/html/dump978/config.js to ${RECEIVER_LATITUDE}...\e[97m" - ChangeConfig "SiteLat" "${RECEIVER_LATITUDE}" "${RECEIVER_BUILD_DIRECTORY}/portal/html/dump978/config.js" - echo -e "\e[94m Setting the receiver's longitude in ${RECEIVER_BUILD_DIRECTORY}/portal/html/dump978/config.js to ${RECEIVER_LONGITUDE}...\e[97m" - ChangeConfig "SiteLon" "${RECEIVER_LONGITUDE}" "${RECEIVER_BUILD_DIRECTORY}/portal/html/dump978/config.js" -fi - -# Create the dump978 JSON directory in Lighttpd's document root. -if [[ ! -d ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/data ]]; then - echo -e "\e[94m Creating the dump978 JSON data directory within Lighttpd's document root...\e[97m" - echo "" - sudo mkdir -vp ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/data - echo "" - echo -e "\e[94m Setting permissions for the dump978 JSON data directory within Lighttpd's document root...\e[97m" - sudo chmod +w ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/data -fi - -# Create the dump978 maintenance script. -echo -e "\e[94m Creating the dump978 maintenance script...\e[97m" -tee ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh > /dev/null <(${RECEIVER_BUILD_DIRECTORY}/dump978/dump978/uat2json ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/data) | ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978/uat2esnt | /bin/nc -q1 127.0.0.1 30001 - sleep 15 -done -EOF -echo -e "\e[94m Setting permissions on the dump978 maintenance script...\e[97m" -chmod +x ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh - -# Add the dump978 maintenance script to /etc/rc.local. -echo -e "\e[94m Checking if the file /etc/rc.local is already set to execute the dump978 maintenance script...\e[97m" -if [[ `grep -cFx "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh &" /etc/rc.local` -eq 0 ]] ; then - echo -e "\e[94m Adding a line to execute the dump978 maintenance script to the file /etc/rc.local...\e[97m" - LINENUMBER=($(sed -n '/exit 0/=' /etc/rc.local)) - ((LINENUMBER>0)) && sudo sed -i "${LINENUMBER[$((${#LINENUMBER[@]}-1))]}i ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh &\n" /etc/rc.local -fi - -## EXECUTE THE MAINTAINANCE SCRIPT TO START DUMP978 - -echo -e "" -echo -e "\e[95m Starting dump978...\e[97m" -echo -e "" -echo -e "\e[94m Starting dump978 by executing the dump978 maintenance script...\e[97m" -sudo nohup ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh > /dev/null 2>&1 & - -### SETUP COMPLETE - -# Return to the project root directory. -echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m" -cd ${RECEIVER_ROOT_DIRECTORY} 2>&1 - -echo -e "" -echo -e "\e[93m ------------------------------------------------------------------------------" -echo -e "\e[92m Dump978 setup is complete.\e[39m" -echo -e "" -if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then - read -p "Press enter to continue..." CONTINUE -fi - -exit 0 diff --git a/bash/main.sh b/bash/main.sh index 53d129c..b1b98b8 100755 --- a/bash/main.sh +++ b/bash/main.sh @@ -74,9 +74,9 @@ function InstallDump1090Hptoa() { } # Execute the dump978 setup script. -function InstallDump978() { - chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/dump978.sh - ${RECEIVER_BASH_DIRECTORY}/decoders/dump978.sh +function InstallDump978Fa() { + chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/dump978-fa.sh + ${RECEIVER_BASH_DIRECTORY}/decoders/dump978-fa.sh if [[ $? -ne 0 ]] ; then exit 1 fi @@ -197,7 +197,7 @@ if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok insta DUMP1090_FORK="fa" DUMP1090_IS_INSTALLED="true" # Check if a newer version can be installed. - if [[ $(sudo dpkg -s dump1090-fa 2>/dev/null | grep -c "Version: ${PIAWARE_VERSION}") -eq 0 ]] ; then + if [[ $(sudo dpkg -s dump1090-fa 2>/dev/null | grep -c "Version: ${DUMP1090_FA_VERSION}") -eq 0 ]] ; then # Skip over this dialog if this installation is set to be automated. if [[ ! "${RECEIVER_AUTOMATED_INSTALL}" = "true" ]] ; then whiptail --backtitle "RECEIVER_PROJECT_TITLE" --title "Dump1090-fa Upgrade Available" --defaultno --yesno "An updated version of dump1090-fa is available.\n\nWould you like to download, build, then install the new version?" 16 65 @@ -282,27 +282,30 @@ if [[ "${DUMP1090_FORK}" = "fa" ]] ; then fi fi -# Check if the dump978 binaries exist. -if [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2text" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2esnt" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2json" ]] ; then - # Dump978 appears to have been built already. +# Check if the dump978-fa package is installed. +if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then + DUMP978_FORK="fa" DUMP978_IS_INSTALLED="true" - # Prompt user to confirm if a rebuild is required. - if [[ ! "${RECEIVER_AUTOMATED_INSTALL}" = "true" ]] ; then - whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 Installed" --defaultno --yesno "Dump978 appears to be installed on your device, however...\n\nThe dump978 source code may have been updated since it was built last. To ensure you are running the latest version of dump978 you may opt to rebuild the binaries making up dump978.\n\nDownload and rebuild the dump978 binaries?" 14 65 - case $? in - 0) - DUMP978_DO_UPGRADE="true" - ;; - 1) - DUMP978_DO_UPGRADE="false" - ;; - esac - else - # Refer to the installation configuration to decide if dump978 is to be rebuilt from source or not. - if [[ "${DUMP978_UPGRADE}" = "true" ]] ; then - DUMP978_DO_UPGRADE="true" + # Check if a newer version can be installed. + if [[ $(sudo dpkg -s dump978-fa 2>/dev/null | grep -c "Version: ${DUMP978_FA_VERSION}") -eq 0 ]] ; then + # Skip over this dialog if this installation is set to be automated. + if [[ ! "${RECEIVER_AUTOMATED_INSTALL}" = "true" ]] ; then + whiptail --backtitle "RECEIVER_PROJECT_TITLE" --title "Dump978-fa Upgrade Available" --defaultno --yesno "An updated version of dump978-fa is available.\n\nWould you like to download, build, then install the new version?" 16 65 + case $? in + 0) + DUMP978_DO_UPGRADE="true" + ;; + 1) + DUMP978_DO_UPGRADE="false" + ;; + esac else - DUMP978_DO_UPGRADE="false" + # If a newer version of dump978-fa is available refer to the installation configuration to decide if it should be upgraded or not. + if [[ "${DUMP978_UPGRADE}" = "true" ]] ; then + DUMP978_DO_UPGRADE="true" + else + DUMP978_DO_UPGRADE="false" + fi fi fi else @@ -310,7 +313,7 @@ else DUMP978_IS_INSTALLED="false" # Prompt user to confirm if installation is required. if [[ ! "${RECEIVER_AUTOMATED_INSTALL}" = "true" ]] ; then - whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 Not Installed" --defaultno --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals. These scripts can setup dump978 for you. However keep in mind a second RTL-SDR device will be required to feed data to it.\n\nDo you wish to install dump978?" 10 65 + whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978-fa Not Installed" --defaultno --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals. These scripts can setup dump978 for you. However keep in mind a second RTL-SDR device will be required to feed data to it.\n\nDo you wish to install dump978?" 10 65 case $? in 0) DUMP978_DO_INSTALL="true" @@ -326,7 +329,6 @@ else else DUMP978_DO_INSTALL="false" fi - fi fi @@ -739,7 +741,7 @@ else fi # If PiAware is required add it to the list. - if [[ "${DUMP1090_FORK}" = "fa" ]] ; then + if [[ "${DUMP1090_FORK}" = "fa" && $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed") -eq 0 || "${PIAWARE_INSTALL}" = "true" ]] ; then CONFIRMATION="${CONFIRMATION}\n * FlightAware PiAware" fi @@ -841,7 +843,7 @@ if [[ "${DUMP1090_DO_INSTALL}" = "true" ]] || [[ "${DUMP1090_DO_UPGRADE}" = "tru fi if [[ "${DUMP978_DO_INSTALL}" = "true" ]] || [[ "${DUMP978_DO_UPGRADE}" = "true" ]] ; then - InstallDump978 + InstallDump978Fa fi if [[ "${RTLSDROGN_DO_INSTALL}" = "true" ]] || [[ "${RTLSDROGN_DO_UPGRADE}" = "true" ]] ; then diff --git a/bash/variables.sh b/bash/variables.sh index 6ab684d..506fb99 100644 --- a/bash/variables.sh +++ b/bash/variables.sh @@ -34,14 +34,16 @@ ## SOFTWARE VERSIONS # The ADS-B Receiver Project -PROJECT_VERSION="2.7.2" +PROJECT_VERSION="2.8/0" # RTL-SDR OGN RTLSDROGN_VERSION="0.2.5" -# FlightAware PiAware +# FlightAware DUMP1090_FA_VERSION="9.0" -PIAWARE_VERSION="9.0.1" +DUMP978_FA_VERSION="9.0" +PIAWARE_VERSION="9.0.1~bpo11+1" +SKYAWARE978_VERSION="9.0" # PlaneFinder Client PLANEFINDER_CLIENT_VERSION_ARM="4.1.1"