kopia lustrzana https://github.com/jprochazka/adsb-receiver
				
				
				
			Merge pull request #599 from jprochazka/acars
v2.8.6 (ACARS support and portal installer fix.)pull/600/head
						commit
						0c3e238274
					
				| 
						 | 
				
			
			@ -1,14 +1,18 @@
 | 
			
		|||
EXTRAS_CHOICES
 | 
			
		||||
FEEDER_CHOICES
 | 
			
		||||
build/acarsdec
 | 
			
		||||
build/acarsserv
 | 
			
		||||
build/adsbexchange
 | 
			
		||||
build/airplaneslive
 | 
			
		||||
build/beast-splitter
 | 
			
		||||
build/duckdns
 | 
			
		||||
build/dump1090*
 | 
			
		||||
build/dump978*
 | 
			
		||||
build/dump1090-fa
 | 
			
		||||
build/dump978-fa
 | 
			
		||||
build/flightradar24
 | 
			
		||||
build/flyitalyadsb
 | 
			
		||||
build/libacars
 | 
			
		||||
build/piaware_builder
 | 
			
		||||
build/planefinder
 | 
			
		||||
build/package-archive
 | 
			
		||||
build/portal/graphs/__pycache__/
 | 
			
		||||
logs
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,15 @@
 | 
			
		|||
 | 
			
		||||
The following is a history of the changes made to this project.
 | 
			
		||||
 | 
			
		||||
## v2.8.6 *(August 13th, 2024)*
 | 
			
		||||
 | 
			
		||||
* The option to install ACARSDEC and ACARSSERV is now available as a decoder option.
 | 
			
		||||
* ACARS data stored by ACARSSERV can be viewed via the existing PHP portal.
 | 
			
		||||
* Added the ability to reconfigure, rebuild, and reinstall both dump1090-fa and dump978.fa.
 | 
			
		||||
* Decoder scripts now ask for device assignments when additional decoders are being installed.
 | 
			
		||||
* Added "Contributors" to the copyright notice in the software license.
 | 
			
		||||
* Had to remove logging of check_package output due to whiptail issue encountered with pipe.
 | 
			
		||||
 | 
			
		||||
## v2.8.5 *(July 23rd, 2024)*
 | 
			
		||||
 | 
			
		||||
* The PiAware installation script now supports Ubuntu Noble Numbat. *(unofficial fix)*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,9 +32,9 @@ the project directly. Their time and effort is greatly appreciated by myself as
 | 
			
		|||
I would like to thank the members and contributors to the following forums for all the time and effort
 | 
			
		||||
they have put in in order to create useful and informative places to discuss aircraft tracking.
 | 
			
		||||
 | 
			
		||||
* The FlightAware Forums:             https://discussions.flightaware.com
 | 
			
		||||
* The PlaneFinder Forums:             https://forum.planefinder.net
 | 
			
		||||
* The ADS-B Exchange Forums:          https://adsbx.discourse.group
 | 
			
		||||
* The FlightAware Forums:     https://discussions.flightaware.com
 | 
			
		||||
* The PlaneFinder Forums:     https://forum.planefinder.net
 | 
			
		||||
* The ADS-B Exchange Forums:  https://adsbx.discourse.group
 | 
			
		||||
 | 
			
		||||
The performance graphs were created thanks in part to the great contributions made by members of both
 | 
			
		||||
the FlightAware and PlaneFinder communities. Through their examples and help posted to the following
 | 
			
		||||
| 
						 | 
				
			
			@ -48,6 +48,8 @@ threads myself along with other contributors to the cause were able to add these
 | 
			
		|||
I would like to thank the maintainers and contributors of the following projects. Without their
 | 
			
		||||
hard work and dedication to their respective projects this project would not have been possible.
 | 
			
		||||
 | 
			
		||||
* ACARSDEC Decoder:        https://github.com/TLeconte/acarsdec
 | 
			
		||||
* ACARSSERV:               https://github.com/TLeconte/acarsserv
 | 
			
		||||
* ADS-B Exchange Client:   https://github.com/adsbexchange/feedclient
 | 
			
		||||
* Airplanes.live Client:   https://github.com/airplanes-live/feed
 | 
			
		||||
* Beast-Splitter:          https://github.com/flightaware/beast-splitter
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2015 Joseph A. Prochazka
 | 
			
		||||
Copyright (c) 2015 Joseph A. Prochazka and Contributors
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								README.md
								
								
								
								
							
							
						
						
									
										20
									
								
								README.md
								
								
								
								
							| 
						 | 
				
			
			@ -1,10 +1,10 @@
 | 
			
		|||
# The ADS-B Receiver Project :airplane:
 | 
			
		||||
 | 
			
		||||
## Run ADS-B/UAT related applications without the overhead!
 | 
			
		||||
## Run ADS-B/UAT/ACARS related applications without the overhead!
 | 
			
		||||
 | 
			
		||||
This project continues to realize that for some, Docker and premade images are not the most optimal solution.
 | 
			
		||||
 | 
			
		||||
It would seem as of late the move towards premade as well as Docker and other PaaS images with preinstalled software has become popular within the community. Docker images require additional software and overhead in order to run and premade images lack installation options. Most of these solutions come with preinstalled software you may never use as part of the image as well. This project offers the ability to choose and install only what you want or need across a wide range of devices with minimal command line experience.
 | 
			
		||||
It would seem as of late the move towards premade as well as Docker and other PaaS images with preinstalled software has become popular within the community. Docker images require additional software and in some cases result in additional overhead when running. Most of these solutions also come with preinstalled software one may never use as part of the image as well. This project offers the ability to choose and install only what you want or need natively across a wide range of devices with minimal command line experience.
 | 
			
		||||
 | 
			
		||||
## Obtaining And Using This Software
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -33,16 +33,17 @@ The following software can be installed using these scripts.
 | 
			
		|||
Included is the option to install the ADS-B Portal which offers the following features.
 | 
			
		||||
 | 
			
		||||
* Saves all flights seen as well as displays a plot for the flight.
 | 
			
		||||
* Saves all ACARS messages received as well as the ability to view these messages.
 | 
			
		||||
* Control what is displayed online via a web based administration area.
 | 
			
		||||
* A more uniform website site layout that can be easily navigated.
 | 
			
		||||
* Web accessible dump1090 and system performance graphs.
 | 
			
		||||
* Easy access to live dump1090 and dump978 maps.
 | 
			
		||||
* A blog which can be used to share your plane tracking experiences with others.
 | 
			
		||||
* A blog which can be used to share your aircraft tracking experiences with others.
 | 
			
		||||
* Visitors can be informed when specific flights are being tracked.
 | 
			
		||||
* Administrators can be informed via email when specific flights are being tracked.
 | 
			
		||||
* Easily customize the look of your portal using the custom template system.
 | 
			
		||||
 | 
			
		||||
When setting up the portal you will have to choose between a lite or advanced installation. Advanced features adds flight logging and plotting and should only be chosen on devices running a more sturdy data storage solution.
 | 
			
		||||
When setting up the portal you will have to choose between a lite or advanced installation. Advanced features add flight logging and plotting and should only be chosen on devices running a sturdy data storage solution.
 | 
			
		||||
 | 
			
		||||
*It is highly recommended that anyone using a SD card as they storage medium not attempt to use the advanced features.*
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +51,7 @@ When setting up the portal you will have to choose between a lite or advanced in
 | 
			
		|||
 | 
			
		||||
* Dump1090 (FlightAware):  https://github.com/flightaware/dump1090
 | 
			
		||||
* Dump978 (FlightAware):   https://github.com/flightaware/dump978
 | 
			
		||||
* ACARSDEC:                https://github.com/TLeconte/acarsdec
 | 
			
		||||
 | 
			
		||||
### Feeders
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -71,11 +73,11 @@ When setting up the portal you will have to choose between a lite or advanced in
 | 
			
		|||
The project currently supports the following Linux distributions.
 | 
			
		||||
 | 
			
		||||
* Armbian _(Bookworm, Jammy and Noble)_
 | 
			
		||||
* Debian _(Bookworm, Bullseye and Trixie)_
 | 
			
		||||
* DietPi _(Bookworm aand Bullseye)_
 | 
			
		||||
* Rasbperry PI OS _(Bookworm and Bullseye)_
 | 
			
		||||
* Debian _(Bookworm and Bullseye)_
 | 
			
		||||
* DietPi _(Bookworm and Bullseye)_
 | 
			
		||||
* Raspberry PI OS _(Bookworm and Bullseye)_
 | 
			
		||||
* Ubuntu _(Jammy Jellyfish, Focal Fossa and Noble Numbat)_
 | 
			
		||||
 | 
			
		||||
_Support is available via this repository through the use of the issue tracker or discussions._
 | 
			
		||||
Support is available via this repository through the use of the issue tracker or discussions.
 | 
			
		||||
 | 
			
		||||
_At this time support for PiAware on distributions based on Debian Trixie and Ubuntu Noble Numbat employ an unofficial fix._
 | 
			
		||||
_Please Note that Ubuntu Noble Numbat support employs an unofficial fix for PiAware._
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,473 @@
 | 
			
		|||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
## PRE INSTALLATION OPERATIONS
 | 
			
		||||
 | 
			
		||||
source $RECEIVER_BASH_DIRECTORY/variables.sh
 | 
			
		||||
source $RECEIVER_BASH_DIRECTORY/functions.sh
 | 
			
		||||
 | 
			
		||||
clear
 | 
			
		||||
log_project_title
 | 
			
		||||
log_title_heading "Setting up the ACARSDEC decoder"
 | 
			
		||||
log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
              --title "ACARSDEC decoder Setup" \
 | 
			
		||||
              --yesno "ACARSDEC is a multi-channels acars decoder with built-in rtl_sdr, airspy front end or sdrplay device. Since 3.0, It comes with a database backend : acarsserv to store received acars messages.\n\nWould you like to begin the setup process now?" \
 | 
			
		||||
              11 78; then
 | 
			
		||||
    echo ""
 | 
			
		||||
    log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
    log_alert_message "Setup has been halted at the request of the user"
 | 
			
		||||
    echo ""
 | 
			
		||||
    log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
    log_title_heading "ACARSDEC decoder setup halted"
 | 
			
		||||
    echo ""
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## GATHER REQUIRED INFORMATION FROM THE USER
 | 
			
		||||
 | 
			
		||||
log_heading "Determine the device type to build ACARSDEC for"
 | 
			
		||||
 | 
			
		||||
log_message "Asking which type of device will be used by ACARSDEC"
 | 
			
		||||
device=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
                  --title "Device Type" \
 | 
			
		||||
                  --menu "Please choose the RTL-SDR device type which is to be used by ACARSDEC." \
 | 
			
		||||
                  11 78 3 \
 | 
			
		||||
                  "RTL-SDR" "" \
 | 
			
		||||
                  "AirSpy" "" \
 | 
			
		||||
                  "SDRPlay" "" \
 | 
			
		||||
                  3>&1 1>&2 2>&3)
 | 
			
		||||
exit_status=$?
 | 
			
		||||
if [[ $exit_status != 0 ]]; then
 | 
			
		||||
    echo ""
 | 
			
		||||
    log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
    log_alert_message "Setup has been halted at the request of the user"
 | 
			
		||||
    echo ""
 | 
			
		||||
    log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
    log_title_heading "ACARSDEC decoder setup halted"
 | 
			
		||||
    echo ""
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
log_heading "Gather information required to configure the decoder(s)"
 | 
			
		||||
 | 
			
		||||
log_message "Checking if an ADS-B decoder is installed"
 | 
			
		||||
adsb_decoder_installed="false"
 | 
			
		||||
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
 | 
			
		||||
    log_message "An ADS-B decoder appears to be installed"
 | 
			
		||||
    adsb_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
log_message "Checking if a UAT decoder is installed"
 | 
			
		||||
uat_decoder_installed="false"
 | 
			
		||||
if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
 | 
			
		||||
    log_message "An ADS-B decoder appears to be installed"
 | 
			
		||||
    uat_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
log_message "Checking if an ACARS decoder is installed"
 | 
			
		||||
acars_decoder_installed="false"
 | 
			
		||||
if [[ -f /usr/local/bin/acarsdec ]]; then
 | 
			
		||||
    log_message "An ACARS decoder appears to be installed"
 | 
			
		||||
    acars_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${adsb_decoder_installed}" == "true" || "${uat_decoder_installed}" == "true" ]]; then
 | 
			
		||||
    log_message "Informing the user that existing decoder(s) appears to be installed"
 | 
			
		||||
    whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
             --title "RTL-SDR Dongle Assignments" \
 | 
			
		||||
             --msgbox "It appears that existing decoder(s) have been installed on this device. In order to run ACARSDEC in tandem with other decoders you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run multiple decoders on a single device you will need to have multiple RTL-SDR devices connected to your device." \
 | 
			
		||||
             12 78
 | 
			
		||||
 | 
			
		||||
    if [[ "${adsb_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the ADS-B decoder"
 | 
			
		||||
        current_adsb_device_number=`get_config "RECEIVER_SERIAL" "/etc/default/dump1090-fa"`
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device number to the ADS-B decoder"
 | 
			
		||||
        adsb_device_number_title="Enter the ADS-B Decoder RTL-SDR Device Number"
 | 
			
		||||
        while [[ -z $adsb_device_number ]] ; do
 | 
			
		||||
            adsb_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                          --title "${adsb_device_number_title}" \
 | 
			
		||||
                                          --inputbox "Enter the RTL-SDR device number to assign your ADS-B decoder." \
 | 
			
		||||
                                          8 78 \
 | 
			
		||||
                                          "${current_adsb_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
            exit_status=$?
 | 
			
		||||
            if [[ $exit_status != 0 ]]; then
 | 
			
		||||
                log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
                log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
                echo ""
 | 
			
		||||
                log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
                log_title_heading "ACARSDEC decoder setup halted"
 | 
			
		||||
                exit 1
 | 
			
		||||
            fi
 | 
			
		||||
            adsb_device_number_title="Enter the ADS-B Decoder RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
        done
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [[ "${uat_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the UAT decoder"
 | 
			
		||||
        receiver_options=`get_config "RECEIVER_OPTIONS" "/etc/default/dump978-fa"`
 | 
			
		||||
        current_uat_device_number=$receiver_options | grep -o -P '(?<=serial=).*(?= --)'
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device number to the UAT decoder"
 | 
			
		||||
        uat_device_number_title="Enter the UAT Decoder RTL-SDR Device Number"
 | 
			
		||||
        while [[ -z $uat_device_number ]] ; do
 | 
			
		||||
            uat_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                         --title "${uat_device_number_title}" \
 | 
			
		||||
                                         --inputbox "Enter the RTL-SDR device number to assign your UAT decoder." \
 | 
			
		||||
                                         8 78 \
 | 
			
		||||
                                         "${current_uat_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
            exit_status=$?
 | 
			
		||||
            if [[ $exit_status != 0 ]]; then
 | 
			
		||||
                log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
                log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
                echo ""
 | 
			
		||||
                log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
                log_title_heading "ACARSDEC decoder setup halted"
 | 
			
		||||
                exit 1
 | 
			
		||||
            fi
 | 
			
		||||
            uat_device_number_title="Enter the UAT Decoder RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
        done
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    current_acars_device_number=""
 | 
			
		||||
    if [[ "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the UAT decoder"
 | 
			
		||||
        exec_start=`get_config "ExecStart" "/etc/systemd/system/acarsdec.service"`
 | 
			
		||||
        current_acars_device_number=`echo $exec_start | grep -o -P '(?<=-r ).*(?= -A)'`
 | 
			
		||||
    fi
 | 
			
		||||
    log_message "Asking the user to assign a RTL-SDR device number to ACARSDEC"
 | 
			
		||||
    acars_device_number_title="Enter the ACARSDEC RTL-SDR Device Number"
 | 
			
		||||
    while [[ -z $acars_device_number ]]; do
 | 
			
		||||
        acars_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                       --title "${acars_device_number_title}" \
 | 
			
		||||
                                       --inputbox "Enter the RTL-SDR device number to assign your ACARSDEC decoder." \
 | 
			
		||||
                                       8 78 \
 | 
			
		||||
                                       "${current_acars_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
        exit_status=$?
 | 
			
		||||
        if [[ $exit_status != 0 ]]; then
 | 
			
		||||
            log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
            log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
            echo ""
 | 
			
		||||
            log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
            log_title_heading "ACARSDEC decoder setup halted"
 | 
			
		||||
            exit 1
 | 
			
		||||
        fi
 | 
			
		||||
        acars_device_number_title="Enter the ACARSDEC RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
    done
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ -z $acars_device_number ]]; then
 | 
			
		||||
    acars_device_number="0"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
current_acars_frequencies="130.025 130.425 130.450 131.125 131.550"
 | 
			
		||||
if [[ "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
    log_message "Determining which frequencies are currently assigned"
 | 
			
		||||
    exec_start=`get_config "ExecStart" "/etc/systemd/system/acarsdec.service"`
 | 
			
		||||
    current_acars_frequencies=`sed -e "s#.*-r ${acars_device_number} \(\)#\1#" <<< "${exec_start}"`
 | 
			
		||||
fi
 | 
			
		||||
log_message "Asking the user for ACARS frequencies to monitor"
 | 
			
		||||
acars_fequencies_title="Enter ACARS Frequencies"
 | 
			
		||||
while [[ -z $acars_fequencies ]] ; do
 | 
			
		||||
    acars_fequencies=$(whiptail --backtitle "ACARS Frequencies" \
 | 
			
		||||
                                --title "${acars_fequencies_title}" \
 | 
			
		||||
                                --inputbox "\nEnter the ACARS frequencies you would like to monitor." \
 | 
			
		||||
                                8 78 \
 | 
			
		||||
                                "${current_acars_frequencies}" 3>&1 1>&2 2>&3)
 | 
			
		||||
    exit_status=$?
 | 
			
		||||
    if [[ $exit_status != 0 ]]; then
 | 
			
		||||
        log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
        log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
        echo ""
 | 
			
		||||
        log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
        log_title_heading "ACARSDEC decoder setup halted"
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
    acars_fequencies_title="Enter ACARS Frequencies (REQUIRED)"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CHECK FOR PREREQUISITE PACKAGES
 | 
			
		||||
 | 
			
		||||
log_heading "Installing packages needed to fulfill dependencies for FlightAware PiAware client"
 | 
			
		||||
 | 
			
		||||
check_package cmake
 | 
			
		||||
check_package libjansson-dev
 | 
			
		||||
check_package libpaho-mqtt-dev
 | 
			
		||||
check_package libsndfile1-dev
 | 
			
		||||
check_package libsqlite3-dev
 | 
			
		||||
check_package libusb-1.0-0-dev
 | 
			
		||||
check_package libxml2-dev
 | 
			
		||||
check_package pkg-config
 | 
			
		||||
check_package zlib1g-dev
 | 
			
		||||
 | 
			
		||||
case $RECEIVER_OS_DISTRIBUTION in
 | 
			
		||||
    ubuntu)
 | 
			
		||||
        distro_php_version=""
 | 
			
		||||
        ;;
 | 
			
		||||
    debian)
 | 
			
		||||
        if [[ "${RECEIVER_OS_CODE_NAME}" == "bookworm" ]]; then distro_php_version="8.2"; fi
 | 
			
		||||
        if [[ "${RECEIVER_OS_CODE_NAME}" == "bullseye" ]]; then distro_php_version="7.4"; fi
 | 
			
		||||
        ;;
 | 
			
		||||
esac
 | 
			
		||||
check_package sqlite3
 | 
			
		||||
check_package php${distro_php_version}-sqlite3
 | 
			
		||||
 | 
			
		||||
case "${device}" in
 | 
			
		||||
    "RTL-SDR")
 | 
			
		||||
        check_package librtlsdr-dev
 | 
			
		||||
        ;;
 | 
			
		||||
    "AirSpy")
 | 
			
		||||
        check_package libairspy-dev
 | 
			
		||||
        ;;
 | 
			
		||||
    "SDRPlay")
 | 
			
		||||
        check_package libmirisdr-dev
 | 
			
		||||
        ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## BLACKLIST UNWANTED RTL-SDR MODULES
 | 
			
		||||
 | 
			
		||||
log_heading "Blacklist unwanted RTL-SDR kernel modules"
 | 
			
		||||
 | 
			
		||||
blacklist_modules
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CLONE OR PULL THE LIBACARS GIT REPOSITORY
 | 
			
		||||
 | 
			
		||||
log_heading "Preparing the libacars Git repository"
 | 
			
		||||
 | 
			
		||||
if [[ -d $RECEIVER_BUILD_DIRECTORY/libacars && -d $RECEIVER_BUILD_DIRECTORY/libacars/.git ]]; then
 | 
			
		||||
    log_message "Entering the libacars git repository directory"
 | 
			
		||||
    cd $RECEIVER_BUILD_DIRECTORY/libacars
 | 
			
		||||
    log_message "Updating the local libacars git repository"
 | 
			
		||||
    echo ""
 | 
			
		||||
    git pull
 | 
			
		||||
else
 | 
			
		||||
    log_message "Entering the libacars build directory"
 | 
			
		||||
    cd $RECEIVER_BUILD_DIRECTORY
 | 
			
		||||
    log_message "Cloning the libacars git repository locally"
 | 
			
		||||
    echo ""
 | 
			
		||||
    git clone https://github.com/szpajder/libacars.git
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## BUILD AND INSTALL THE LIBACARS LIBRARY
 | 
			
		||||
 | 
			
		||||
log_heading "Building the libacars library"
 | 
			
		||||
 | 
			
		||||
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/libacars/build ]]; then
 | 
			
		||||
    log_message "Creating the libacars build directory"
 | 
			
		||||
    echo ""
 | 
			
		||||
        mkdir -vp $RECEIVER_BUILD_DIRECTORY/libacars/build
 | 
			
		||||
    echo ""
 | 
			
		||||
fi
 | 
			
		||||
if [[ -n "$(ls -A $RECEIVER_BUILD_DIRECTORY/libacars/build 2>/dev/null)" ]]; then
 | 
			
		||||
    log_message "Deleting all files currently residing in the libacars build directory"
 | 
			
		||||
    rm -rf $RECEIVER_BUILD_DIRECTORY/libacars/build/*
 | 
			
		||||
fi
 | 
			
		||||
log_message "Entering the libacars build directory"
 | 
			
		||||
cd $RECEIVER_BUILD_DIRECTORY/libacars/build
 | 
			
		||||
log_message "Executing cmake"
 | 
			
		||||
echo ""
 | 
			
		||||
cmake ../
 | 
			
		||||
echo ""
 | 
			
		||||
log_message "Executing make"
 | 
			
		||||
echo ""
 | 
			
		||||
make
 | 
			
		||||
echo ""
 | 
			
		||||
log_message "Executing make install"
 | 
			
		||||
echo ""
 | 
			
		||||
sudo make install
 | 
			
		||||
echo ""
 | 
			
		||||
log_message "Running ldconfig"
 | 
			
		||||
sudo ldconfig
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CLONE OR PULL THE ACARSDEC GIT REPOSITORY
 | 
			
		||||
 | 
			
		||||
log_heading "Preparing the ACARSDEC Git repository"
 | 
			
		||||
 | 
			
		||||
if [[ -d $RECEIVER_BUILD_DIRECTORY/acarsdec && -d $RECEIVER_BUILD_DIRECTORY/acarsdec/.git ]]; then
 | 
			
		||||
    log_message "Entering the ACARSDEC git repository directory"
 | 
			
		||||
    cd $RECEIVER_BUILD_DIRECTORY/acarsdec
 | 
			
		||||
    log_message "Updating the local ACARSDEC git repository"
 | 
			
		||||
    echo ""
 | 
			
		||||
    git pull
 | 
			
		||||
else
 | 
			
		||||
    log_message "Entering the build directory"
 | 
			
		||||
    cd $RECEIVER_BUILD_DIRECTORY
 | 
			
		||||
    log_message "Cloning the ACARSDEC git repository locally"
 | 
			
		||||
    echo ""
 | 
			
		||||
    git clone https://github.com/TLeconte/acarsdec.git
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## BUILD AND INSTALL THE ACARSDEC BINARY
 | 
			
		||||
 | 
			
		||||
log_heading "Building the ACARSDEC binary"
 | 
			
		||||
 | 
			
		||||
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/acarsdec/build ]]; then
 | 
			
		||||
    log_message "Creating the ACARSDEC build directory"
 | 
			
		||||
    echo ""
 | 
			
		||||
        mkdir -vp $RECEIVER_BUILD_DIRECTORY/acarsdec/build
 | 
			
		||||
    echo ""
 | 
			
		||||
fi
 | 
			
		||||
if [[ -n "$(ls -A $RECEIVER_BUILD_DIRECTORY/acarsdec/build 2>/dev/null)" ]]; then
 | 
			
		||||
    log_message "Deleting all files currently residing in the ACARSDEC build directory"
 | 
			
		||||
    rm -rf $RECEIVER_BUILD_DIRECTORY/acarsdec/build/*
 | 
			
		||||
fi
 | 
			
		||||
log_message "Entering the ACARSDEC build directory"
 | 
			
		||||
cd $RECEIVER_BUILD_DIRECTORY/acarsdec/build
 | 
			
		||||
 | 
			
		||||
log_message "Executing cmake"
 | 
			
		||||
echo ""
 | 
			
		||||
case "${device}" in
 | 
			
		||||
    "RTL-SDR")
 | 
			
		||||
        cmake .. -Drtl=ON
 | 
			
		||||
        ;;
 | 
			
		||||
    "AirSpy")
 | 
			
		||||
        cmake .. -Dairspy=ON
 | 
			
		||||
        ;;
 | 
			
		||||
    "SDRPlay")
 | 
			
		||||
        cmake .. -Dsdrplay=ON
 | 
			
		||||
        ;;
 | 
			
		||||
esac
 | 
			
		||||
echo ""
 | 
			
		||||
 | 
			
		||||
log_message "Executing make"
 | 
			
		||||
echo ""
 | 
			
		||||
make
 | 
			
		||||
echo ""
 | 
			
		||||
log_message "Executing make install"
 | 
			
		||||
echo ""
 | 
			
		||||
sudo make install
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CLONE OR PULL THE ACARSSERV GIT REPOSITORY
 | 
			
		||||
 | 
			
		||||
log_heading "Preparing the acarsserv Git repository"
 | 
			
		||||
 | 
			
		||||
if [[ -d $RECEIVER_BUILD_DIRECTORY/acarsserv && -d $RECEIVER_BUILD_DIRECTORY/acarsserv/.git ]]; then
 | 
			
		||||
    log_message "Entering the acarsserv git repository directory"
 | 
			
		||||
    cd $RECEIVER_BUILD_DIRECTORY/acarsserv
 | 
			
		||||
    log_message "Updating the local acarsserv git repository"
 | 
			
		||||
    echo ""
 | 
			
		||||
    git pull
 | 
			
		||||
else
 | 
			
		||||
    log_message "Entering the build directory"
 | 
			
		||||
    cd $RECEIVER_BUILD_DIRECTORY
 | 
			
		||||
    log_message "Cloning the acarsserv git repository locally"
 | 
			
		||||
    echo ""
 | 
			
		||||
    git clone https://github.com/TLeconte/acarsserv.git
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## BUILD AND INSTALL THE ACARSDEC BINARY
 | 
			
		||||
 | 
			
		||||
log_heading "Building the ACARSDEC binary"
 | 
			
		||||
 | 
			
		||||
log_message "Entering the acarsserv build directory"
 | 
			
		||||
cd $RECEIVER_BUILD_DIRECTORY/acarsserv
 | 
			
		||||
log_message "Executing make"
 | 
			
		||||
echo ""
 | 
			
		||||
make -f Makefile
 | 
			
		||||
echo ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## RUN ACARSDECO AND ACARSSERV
 | 
			
		||||
 | 
			
		||||
log_message "Creating the ACARSDEC systemd service script"
 | 
			
		||||
sudo tee /etc/systemd/system/acarsdec.service > /dev/null <<EOF
 | 
			
		||||
[Unit]
 | 
			
		||||
Description=ARCARSDEC multi-channel acars decoder.
 | 
			
		||||
After=network.target
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
ExecStart=/usr/local/bin/acarsdec -j 127.0.0.1:5555 -o2 -g280 -r 0 130.025 130.425 130.450 131.125 131.550
 | 
			
		||||
WorkingDirectory=/usr/local/bin
 | 
			
		||||
StandardOutput=null
 | 
			
		||||
TimeoutSec=30
 | 
			
		||||
Restart=on-failure
 | 
			
		||||
RestartSec=30
 | 
			
		||||
StartLimitInterval=350
 | 
			
		||||
StartLimitBurst=10
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=multi-user.target
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
log_message "Creating the ACARSSERV systemd service script"
 | 
			
		||||
sudo tee /etc/systemd/system/acarsserv.service > /dev/null <<EOF
 | 
			
		||||
[Unit]
 | 
			
		||||
Description=ARCARSSERV saves acars data to SQLite.
 | 
			
		||||
After=network.target
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
ExecStart=${RECEIVER_BUILD_DIRECTORY}/acarsserv/acarsserv -j 127.0.0.1:5555
 | 
			
		||||
WorkingDirectory=${RECEIVER_BUILD_DIRECTORY}/acarsserv
 | 
			
		||||
StandardOutput=null
 | 
			
		||||
TimeoutSec=30
 | 
			
		||||
Restart=on-failure
 | 
			
		||||
RestartSec=30
 | 
			
		||||
StartLimitInterval=350
 | 
			
		||||
StartLimitBurst=10
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=multi-user.target
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
log_message "Enabling then starting the ACARSDEC service"
 | 
			
		||||
sudo systemctl enable --now acarsdec.service
 | 
			
		||||
log_message "Enabling then starting the acarsserv service"
 | 
			
		||||
sudo systemctl enable --now acarsserv.service
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CONFIGURATION
 | 
			
		||||
 | 
			
		||||
if [[ "${adsb_decoder_installed}" == "true" || "${uat_decoder_installed}" == "true" ]]; then
 | 
			
		||||
 | 
			
		||||
    log_heading "Configuring the decoders so they can work in tandem"
 | 
			
		||||
 | 
			
		||||
    if [[ "${adsb_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Assigning RTL-SDR device number ${adsb_device_number} to the FlightAware Dump1090 decoder"
 | 
			
		||||
        change_config "RECEIVER_SERIAL" $adsb_device_number "/etc/default/dump1090-fa"
 | 
			
		||||
        log_message "Restarting dump1090-fa"
 | 
			
		||||
        sudo systemctl restart dump1090-fa
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [[ "${uat_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Assigning RTL-SDR device number ${uat_device_number} to the FlightAware Dump978 decoder"
 | 
			
		||||
        sudo sed -i -e "s|driver=rtlsdr|driver=rtlsdr,serial=${uat_device_number}|g" /etc/default/dump978-fa
 | 
			
		||||
        log_message "Restarting dump978-fa"
 | 
			
		||||
        sudo systemctl restart dump978-fa
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    log_message "Assigning RTL-SDR device number ${acars_device_number} to ACARSDEC"
 | 
			
		||||
    sudo sed -i -e "s|\(.*-r \)\([0-9]\+\)\( .*\)|\1${acars_device_number}\3|g" /etc/systemd/system/acarsdec.service
 | 
			
		||||
    log_message "Reloading systemd units"
 | 
			
		||||
    sudo systemctl daemon-reload
 | 
			
		||||
    log_message "Restarting ACARSDEC"
 | 
			
		||||
    sudo systemctl restart acarsdec
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## POST INSTALLATION OPERATIONS
 | 
			
		||||
 | 
			
		||||
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
         --title "ACARSDEC Decoder Setup Complete" \
 | 
			
		||||
         --msgbox "The setup process currently sets basic parameters needed to feed acarsserv. You can fine tune your installation by modifying the startup command found in the file /etc/systemd/system/acarsdec.service. Usage information for ACARSDEC can be found in the projects README at https://github.com/TLeconte/acarsdec." \
 | 
			
		||||
         12 78
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## SETUP COMPLETE
 | 
			
		||||
 | 
			
		||||
log_message "Returning to ${RECEIVER_PROJECT_TITLE} root directory"
 | 
			
		||||
cd $RECEIVER_ROOT_DIRECTORY
 | 
			
		||||
 | 
			
		||||
echo ""
 | 
			
		||||
log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
log_title_heading "ACARSDEC decoder setup is complete"
 | 
			
		||||
echo ""
 | 
			
		||||
read -p "Press enter to continue..." discard
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
| 
						 | 
				
			
			@ -5,9 +5,6 @@
 | 
			
		|||
source $RECEIVER_BASH_DIRECTORY/variables.sh
 | 
			
		||||
source $RECEIVER_BASH_DIRECTORY/functions.sh
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## BEGIN SETUP
 | 
			
		||||
 | 
			
		||||
clear
 | 
			
		||||
log_project_title
 | 
			
		||||
log_title_heading "Setting up the FlightAware Dump1090 decoder"
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +23,116 @@ if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		|||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## GATHER REQUIRED INFORMATION FROM THE USER
 | 
			
		||||
 | 
			
		||||
log_heading "Gather information required to configure the decoder(s)"
 | 
			
		||||
 | 
			
		||||
log_message "Checking if an ADS-B decoder is installed"
 | 
			
		||||
adsb_decoder_installed="false"
 | 
			
		||||
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
 | 
			
		||||
    log_message "An ADS-B decoder appears to be installed"
 | 
			
		||||
    adsb_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
log_message "Checking if a UAT decoder is installed"
 | 
			
		||||
uat_decoder_installed="false"
 | 
			
		||||
if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
 | 
			
		||||
    log_message "A UAT decoder appears to be installed"
 | 
			
		||||
    uat_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
log_message "Checking if an ACARS decoder is installed"
 | 
			
		||||
acars_decoder_installed="false"
 | 
			
		||||
if [[ -f /usr/local/bin/acarsdec ]]; then
 | 
			
		||||
    log_message "An ACARS decoder appears to be installed"
 | 
			
		||||
    acars_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${uat_decoder_installed}" == "true" || "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
    log_message "Informing the user that existing decoder(s) appears to be installed"
 | 
			
		||||
    whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
             --title "RTL-SDR Dongle Assignments" \
 | 
			
		||||
             --msgbox "It appears that existing decoder(s) have been installed on this device. In order to run ACARSDEC in tandem with other decoders you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run multiple decoders on a single device you will need to have multiple RTL-SDR devices connected to your device." \
 | 
			
		||||
             12 78
 | 
			
		||||
 | 
			
		||||
    if [[ "${uat_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the UAT decoder"
 | 
			
		||||
        receiver_options=`get_config "RECEIVER_OPTIONS" "/etc/default/dump978-fa"`
 | 
			
		||||
        current_uat_device_number=$receiver_options | grep -o -P '(?<=serial=).*(?= --)'
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device number to the UAT decoder"
 | 
			
		||||
        uat_device_number_title="Enter the UAT Decoder RTL-SDR Device Number"
 | 
			
		||||
        while [[ -z $uat_device_number ]] ; do
 | 
			
		||||
            uat_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                         --title "${uat_device_number_title}" \
 | 
			
		||||
                                         --inputbox "\nEnter the RTL-SDR device number to assign your UAT decoder." \
 | 
			
		||||
                                         8 78 \
 | 
			
		||||
                                         "${current_uat_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
            exit_status=$?
 | 
			
		||||
            if [[ $exit_status != 0 ]]; then
 | 
			
		||||
                log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
                log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
                echo ""
 | 
			
		||||
                log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
                log_title_heading "FlightAware Dump1090 decoder setup halted"
 | 
			
		||||
                exit 1
 | 
			
		||||
            fi
 | 
			
		||||
            uat_device_number_title="Enter the UAT Decoder RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
        done
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [[ "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the UAT decoder"
 | 
			
		||||
        exec_start=`get_config "ExecStart" "/etc/systemd/system/acarsdec.service"`
 | 
			
		||||
        current_acars_device_number=`echo $exec_start | grep -o -P '(?<=-r ).*(?= -A)'`
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device number to ACARSDEC"
 | 
			
		||||
        acars_device_number_title="Enter the ACARSDEC RTL-SDR Device Number"
 | 
			
		||||
        while [[ -z $acars_device_number ]] ; do
 | 
			
		||||
            acars_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                           --title "${acars_device_number_title}" \
 | 
			
		||||
                                           --inputbox "\nEnter the RTL-SDR device number to assign your ACARSDEC decoder." \
 | 
			
		||||
                                           8 78 \
 | 
			
		||||
                                           "${current_acars_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
            exit_status=$?
 | 
			
		||||
            if [[ $exit_status != 0 ]]; then
 | 
			
		||||
                log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
                log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
                echo ""
 | 
			
		||||
                log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
                log_title_heading "FlightAware Dump1090 decoder setup halted"
 | 
			
		||||
                exit 1
 | 
			
		||||
            fi
 | 
			
		||||
            acars_device_number_title="Enter the ACARSDEC RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
        done
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    current_adsb_device_number=""
 | 
			
		||||
    if [[ "${absb_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the ADS-B decoder"
 | 
			
		||||
        current_adsb_device_number=`get_config "RECEIVER_SERIAL" "/etc/default/dump1090-fa"`
 | 
			
		||||
    fi
 | 
			
		||||
    log_message "Asking the user to assign a RTL-SDR device number to the ADS-B decoder"
 | 
			
		||||
    adsb_device_number_title="Enter the ADS-B Decoder RTL-SDR Device Number"
 | 
			
		||||
    while [[ -z $adsb_device_number ]] ; do
 | 
			
		||||
        adsb_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                      --title "${adsb_device_number_title}" \
 | 
			
		||||
                                      --inputbox "\nEnter the RTL-SDR device number to assign your ADS-B decoder." \
 | 
			
		||||
                                      8 78 \
 | 
			
		||||
                                      "${current_adsb_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
        exit_status=$?
 | 
			
		||||
        if [[ $exit_status != 0 ]]; then
 | 
			
		||||
            log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
            log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
            echo ""
 | 
			
		||||
            log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
            log_title_heading "FlightAware Dump1090 decoder setup halted"
 | 
			
		||||
            exit 1
 | 
			
		||||
        fi
 | 
			
		||||
        adsb_device_number_title="Enter the ADS-B Decoder RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
    done
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CHECK FOR PREREQUISITE PACKAGES
 | 
			
		||||
 | 
			
		||||
log_heading "Installing packages needed to fulfill FlightAware Dump1090 decoder dependencies"
 | 
			
		||||
| 
						 | 
				
			
			@ -131,6 +238,35 @@ echo ""
 | 
			
		|||
cp -vf $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## CONFIGURATION
 | 
			
		||||
 | 
			
		||||
if [[ "${uat_decoder_installed}" == "true" || "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
 | 
			
		||||
    log_heading "Configuring the decoders so they can work in tandem"
 | 
			
		||||
 | 
			
		||||
    if [[ "${uat_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Assigning RTL-SDR device number ${uat_device_number} to the FlightAware Dump978 decoder"
 | 
			
		||||
        sudo sed -i -e "s/driver=rtlsdr/driver=rtlsdr,serial=${uat_device_number}/g" /etc/default/dump978-fa
 | 
			
		||||
        log_message "Restarting dump978-fa"
 | 
			
		||||
        sudo systemctl restart dump978-fa
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [[ "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Assigning RTL-SDR device number ${acars_device_number} to ACARSDEC"
 | 
			
		||||
        sudo sed -i -e "s/\(.*-r \)\([0-9]\+\)\( .*\)/\1${acars_device_number}\3/g" /etc/systemd/system/acarsdec.service
 | 
			
		||||
        log_message "Reloading systemd units"
 | 
			
		||||
        sudo systemctl daemon-reload
 | 
			
		||||
        log_message "Restarting ACARSDEC"
 | 
			
		||||
        sudo systemctl restart acarsdec
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    log_message "Assigning RTL-SDR device number ${adsb_device_number} to the FlightAware Dump1090 decoder"
 | 
			
		||||
    change_config "RECEIVER_SERIAL" $adsb_device_number "/etc/default/dump1090-fa"
 | 
			
		||||
    log_message "Restarting dump1090-fa"
 | 
			
		||||
    sudo systemctl restart dump1090-fa
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## POST INSTALLATION OPERATIONS
 | 
			
		||||
 | 
			
		||||
log_heading "Performing post installation operations"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,9 +5,6 @@
 | 
			
		|||
source $RECEIVER_BASH_DIRECTORY/variables.sh
 | 
			
		||||
source $RECEIVER_BASH_DIRECTORY/functions.sh
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## BEGIN SETUP
 | 
			
		||||
 | 
			
		||||
clear
 | 
			
		||||
log_project_title
 | 
			
		||||
log_title_heading "Setting up the FlightAware Dump978 decoder"
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +26,7 @@ fi
 | 
			
		|||
 | 
			
		||||
## GATHER REQUIRED INFORMATION FROM THE USER
 | 
			
		||||
 | 
			
		||||
log_heading "Gather information required to configure the ADS-B decoder and dump978-fa if needed"
 | 
			
		||||
log_heading "Gather information required to configure the decoder(s)"
 | 
			
		||||
 | 
			
		||||
log_message "Checking if an ADS-B decoder is installed"
 | 
			
		||||
adsb_decoder_installed="false"
 | 
			
		||||
| 
						 | 
				
			
			@ -38,25 +35,40 @@ if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok insta
 | 
			
		|||
    adsb_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${adsb_decoder_installed}" == "true" ]]; then
 | 
			
		||||
    log_message "Checking if dump978-fa has been configured"
 | 
			
		||||
    if [[ -f /etc/default/dump978-fa ]]; then
 | 
			
		||||
        log_message "A dump978-fa configuration file exists"
 | 
			
		||||
    else
 | 
			
		||||
        log_message "Informing the user an ADS-B decoder appears to be installed"
 | 
			
		||||
        whiptail --backtitle "FlightAware Dump978 Configuration" \
 | 
			
		||||
                 --title "RTL-SDR Dongle Assignments" \
 | 
			
		||||
                 --msgbox "It appears one of the dump1090 decoder 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
 | 
			
		||||
log_message "Checking if a UAT decoder is installed"
 | 
			
		||||
uat_decoder_installed="false"
 | 
			
		||||
if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
 | 
			
		||||
    log_message "An ADS-B decoder appears to be installed"
 | 
			
		||||
    uat_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device serial number to the ADS-B decoder"
 | 
			
		||||
        dump1090_device_serial_title="Enter the Dump1090 RTL-SDR Device Serial"
 | 
			
		||||
        while [[ -z $dump1090_device_serial ]] ; do
 | 
			
		||||
            dump1090_device_serial=$(whiptail --backtitle "FlightAware Dump978 Configuration" \
 | 
			
		||||
                                              --title "${dump1090_device_serial_title}" \
 | 
			
		||||
                                              --inputbox "\nEnter the serial number for your dump1090 RTL-SDR device." \
 | 
			
		||||
                                              8 78 3>&1 1>&2 2>&3)
 | 
			
		||||
            if [[ $dump1090_device_serial == 0 ]]; then
 | 
			
		||||
log_message "Checking if an ACARS decoder is installed"
 | 
			
		||||
acars_decoder_installed="false"
 | 
			
		||||
if [[ -f /usr/local/bin/acarsdec ]]; then
 | 
			
		||||
    log_message "An ACARS decoder appears to be installed"
 | 
			
		||||
    acars_decoder_installed="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${adsb_decoder_installed}" == "true" || "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
    log_message "Informing the user that existing decoder(s) appears to be installed"
 | 
			
		||||
    whiptail --backtitle "FlightAware Dump978 Decoder Configuration" \
 | 
			
		||||
             --title "RTL-SDR Dongle Assignments" \
 | 
			
		||||
             --msgbox "It appears that existing decoder(s) have been installed on this device. In order to run FlightAware Dump978 in tandem with other decoders you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run multiple decoders on a single device you will need to have multiple RTL-SDR devices connected to your device." \
 | 
			
		||||
             12 78
 | 
			
		||||
 | 
			
		||||
    if [[ "${adsb_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the ADS-B decoder"
 | 
			
		||||
        current_adsb_device_number=`get_config "RECEIVER_SERIAL" "/etc/default/dump1090-fa"`
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device number to the ADS-B decoder"
 | 
			
		||||
        adsb_device_number_title="Enter the ADS-B Decoder RTL-SDR Device Number"
 | 
			
		||||
        while [[ -z $adsb_device_number ]] ; do
 | 
			
		||||
            adsb_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                          --title "${adsb_device_number_title}" \
 | 
			
		||||
                                          --inputbox "\nEnter the RTL-SDR device number to assign your ADS-B decoder." \
 | 
			
		||||
                                          8 78 \
 | 
			
		||||
                                          "${current_adsb_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
            exit_status=$?
 | 
			
		||||
            if [[ $exit_status != 0 ]]; then
 | 
			
		||||
                log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
                log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
                echo ""
 | 
			
		||||
| 
						 | 
				
			
			@ -64,27 +76,60 @@ if [[ "${adsb_decoder_installed}" == "true" ]]; then
 | 
			
		|||
                log_title_heading "FlightAware Dump978 decoder setup halted"
 | 
			
		||||
                exit 1
 | 
			
		||||
            fi
 | 
			
		||||
            dump1090_device_serial_title="Enter the Dump1090 RTL-SDR Device Serial (REQUIRED)"
 | 
			
		||||
        done
 | 
			
		||||
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device serial number to dump978-fa"
 | 
			
		||||
        dump978_device_serial_title="Enter the Dump978 RTL-SDR Device Serial"
 | 
			
		||||
        while [[ -z $dump978_device_serial ]] ; do
 | 
			
		||||
            dump978_device_serial=$(whiptail --backtitle "FlightAware Dump978 Configuration" \
 | 
			
		||||
                                             --title "${dump978_device_serial_title}" \
 | 
			
		||||
                                             --inputbox "\nEnter the serial number for your dump978 RTL-SDR device." \
 | 
			
		||||
                                             8 78 3>&1 1>&2 2>&3)
 | 
			
		||||
            if [[ $dump978_device_serial == 0 ]]; then
 | 
			
		||||
                log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
                log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
                echo ""
 | 
			
		||||
                log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
                log_title_heading "FlightAware Dump978 decoder setup halted"
 | 
			
		||||
                exit 1
 | 
			
		||||
            fi
 | 
			
		||||
            dump978_device_serial_title="Enter the Dump1090 RTL-SDR Device Serial (REQUIRED)"
 | 
			
		||||
            adsb_device_number_title="Enter the ADS-B Decoder RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
        done
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [[ "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the UAT decoder"
 | 
			
		||||
        exec_start=`get_config "ExecStart" "/etc/systemd/system/acarsdec.service"`
 | 
			
		||||
        current_acars_device_number=`echo $exec_start | grep -o -P '(?<=-r ).*(?= -A)'`
 | 
			
		||||
        log_message "Asking the user to assign a RTL-SDR device number to ACARSDEC"
 | 
			
		||||
        acars_device_number_title="Enter the ACARSDEC RTL-SDR Device Number"
 | 
			
		||||
        while [[ -z $acars_device_number ]] ; do
 | 
			
		||||
            acars_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                           --title "${acars_device_number_title}" \
 | 
			
		||||
                                           --inputbox "\nEnter the RTL-SDR device number to assign your ACARSDEC decoder." \
 | 
			
		||||
                                           8 78 \
 | 
			
		||||
                                           "${current_acars_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
            exit_status=$?
 | 
			
		||||
            if [[ $exit_status != 0 ]]; then
 | 
			
		||||
                log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
                log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
                echo ""
 | 
			
		||||
                log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
                log_title_heading "FlightAware Dump978 decoder setup halted"
 | 
			
		||||
                exit 1
 | 
			
		||||
            fi
 | 
			
		||||
            acars_device_number_title="Enter the ACARSDEC RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
        done
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    current_uat_device_number=""
 | 
			
		||||
    if [[ "${uat_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Determining which device is currently assigned to the UAT decoder"
 | 
			
		||||
        receiver_options=`get_config "RECEIVER_OPTIONS" "/etc/default/dump978-fa"`
 | 
			
		||||
        current_uat_device_number=$receiver_options | grep -o -P '(?<=serial=).*(?= --)'
 | 
			
		||||
    fi
 | 
			
		||||
    log_message "Asking the user to assign a RTL-SDR device number to the UAT decoder"
 | 
			
		||||
    uat_device_number_title="Enter the UAT Decoder RTL-SDR Device Number"
 | 
			
		||||
    while [[ -z $uat_device_number ]] ; do
 | 
			
		||||
        uat_device_number=$(whiptail --backtitle "ACARSDEC Decoder Configuration" \
 | 
			
		||||
                                     --title "${uat_device_number_title}" \
 | 
			
		||||
                                     --inputbox "\nEnter the RTL-SDR device number to assign your UAT decoder." \
 | 
			
		||||
                                     8 78 \
 | 
			
		||||
                                     "${current_uat_device_number}" 3>&1 1>&2 2>&3)
 | 
			
		||||
        exit_status=$?
 | 
			
		||||
        if [[ $exit_status != 0 ]]; then
 | 
			
		||||
            log_alert_heading "INSTALLATION HALTED"
 | 
			
		||||
            log_alert_message "Setup has been halted due to lack of required information"
 | 
			
		||||
            echo ""
 | 
			
		||||
            log_title_message "------------------------------------------------------------------------------"
 | 
			
		||||
            log_title_heading "FlightAware Dump978 decoder setup halted"
 | 
			
		||||
            exit 1
 | 
			
		||||
        fi
 | 
			
		||||
        uat_device_number_title="Enter the UAT Decoder RTL-SDR Device Number (REQUIRED)"
 | 
			
		||||
    done
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -146,11 +191,11 @@ echo ""
 | 
			
		|||
 | 
			
		||||
log_message "Installing the dump978-fa Debian package"
 | 
			
		||||
echo ""
 | 
			
		||||
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump978-fa/dump978-fa_${DUMP978_FA_VERSION}_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
 | 
			
		||||
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump978-fa/dump978-fa_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
 | 
			
		||||
echo ""
 | 
			
		||||
log_message "Installing the skyaware978 Debian package"
 | 
			
		||||
echo ""
 | 
			
		||||
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump978-fa/skyaware978_${DUMP978_FA_VERSION}_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
 | 
			
		||||
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump978-fa/skyaware978_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
 | 
			
		||||
echo ""
 | 
			
		||||
 | 
			
		||||
log_message "Checking that the dump978-fa Debian package was installed"
 | 
			
		||||
| 
						 | 
				
			
			@ -200,21 +245,30 @@ cp -vf $RECEIVER_BUILD_DIRECTORY/dump978-fa/skyaware978_*.deb $RECEIVER_BUILD_DI
 | 
			
		|||
 | 
			
		||||
## CONFIGURATION
 | 
			
		||||
 | 
			
		||||
if [[ "${adsb_decoder_installed}" == "true" ]]; then
 | 
			
		||||
if [[ "${adsb_decoder_installed}" == "true" || "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
 | 
			
		||||
    log_heading "Configuring the ADS-B decoder and dump978-fa so they can work in tandem"
 | 
			
		||||
    log_heading "Configuring the decoders so they can work in tandem"
 | 
			
		||||
 | 
			
		||||
    log_message "Assigning RTL-SDR device with serial ${dump978_device_serial} to dump978-fa"
 | 
			
		||||
    sudo sed -i -e "s/driver=rtlsdr/driver=rtlsdr,serial=${dump978_device_serial}/g" /etc/default/dump978-fa
 | 
			
		||||
    log_message "Restarting dump978-fa...\e[97m"
 | 
			
		||||
    sudo systemctl restart dump978-fa
 | 
			
		||||
 | 
			
		||||
    if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
 | 
			
		||||
        log_message "Assigning RTL-SDR device with serial ${dump1090_device_serial} to the FlightAware Dump1090 decoder"
 | 
			
		||||
        change_config "RECEIVER_SERIAL" $dump1090_device_serial "/etc/default/dump1090-fa"
 | 
			
		||||
    if [[ "${adsb_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Assigning RTL-SDR device number ${adsb_device_number} to the FlightAware Dump1090 decoder"
 | 
			
		||||
        change_config "RECEIVER_SERIAL" $adsb_device_number "/etc/default/dump1090-fa"
 | 
			
		||||
        log_message "Restarting dump1090-fa"
 | 
			
		||||
        sudo systemctl restart dump1090-fa
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [[ "${acars_decoder_installed}" == "true" ]]; then
 | 
			
		||||
        log_message "Assigning RTL-SDR device number ${acars_device_number} to ACARSDEC"
 | 
			
		||||
        sudo sed -i -e "s/\(.*-r \)\([0-9]\+\)\( .*\)/\1${acars_device_number}\3/g" /etc/systemd/system/acarsdec.service
 | 
			
		||||
        log_message "Reload systemd units"
 | 
			
		||||
        sudo systemctl daemon-reload
 | 
			
		||||
        log_message "Restarting ACARSDEC"
 | 
			
		||||
        sudo systemctl restart acarsdec
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    log_message "Assigning RTL-SDR device number ${uat_device_number} to the FlightAware Dump978 decoder"
 | 
			
		||||
    sudo sed -i -e "s/driver=rtlsdr/driver=rtlsdr,serial=${uat_device_number}/g" /etc/default/dump978-fa
 | 
			
		||||
    log_message "Restarting dump978-fa"
 | 
			
		||||
    sudo systemctl restart dump978-fa
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,7 +118,7 @@ function check_package() {
 | 
			
		|||
            fi
 | 
			
		||||
            echo ""
 | 
			
		||||
            attempt=$((attempt+1))
 | 
			
		||||
            sudo apt-get install -y $1 2>&1 | tee -a $RECEIVER_LOG_FILE
 | 
			
		||||
            sudo apt-get install -y $1 #2>&1 | tee -a $RECEIVER_LOG_FILE
 | 
			
		||||
            echo ""
 | 
			
		||||
        else
 | 
			
		||||
            log_true_inline "[OK]"
 | 
			
		||||
| 
						 | 
				
			
			@ -161,5 +161,9 @@ function change_config() {
 | 
			
		|||
# Use sed to locate the "KEY" then read the "VALUE", the portion after the equals sign, in the specified "FILE"
 | 
			
		||||
# This function should work with any configuration file with settings formated as KEY="VALUE"
 | 
			
		||||
function get_config() {
 | 
			
		||||
    echo `sed -n "/^$1 *= *\"\(.*\)\"$/s//\1/p" $2`
 | 
			
		||||
}
 | 
			
		||||
    setting=`sed -n "/^$1 *= *\"\(.*\)\"$/s//\1/p" $2`
 | 
			
		||||
    if [[ "${setting}" == "" ]]; then
 | 
			
		||||
        setting=`sed -n "/^$1 *= *\(.*\)$/s//\1/p" $2`
 | 
			
		||||
    fi
 | 
			
		||||
    echo $setting
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										159
									
								
								bash/main.sh
								
								
								
								
							
							
						
						
									
										159
									
								
								bash/main.sh
								
								
								
								
							| 
						 | 
				
			
			@ -6,12 +6,12 @@ source ${RECEIVER_BASH_DIRECTORY}/variables.sh
 | 
			
		|||
source ${RECEIVER_BASH_DIRECTORY}/functions.sh
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 1090MHZ DECODERS
 | 
			
		||||
## ADS-B DECODERS
 | 
			
		||||
 | 
			
		||||
# FlightAware dump1090
 | 
			
		||||
install_1090mhz_decoder="false"
 | 
			
		||||
install_adsb_decoder="false"
 | 
			
		||||
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") == 1 ]] ; then
 | 
			
		||||
    chosen_1090mhz_decoder="dump1090-fa"
 | 
			
		||||
    chosen_adsb_decoder="dump1090-fa"
 | 
			
		||||
    if [[ $(sudo dpkg -s dump1090-fa 2>/dev/null | grep -c "Version: ${dump1090_fa_current_version}") == 0 ]] ; then
 | 
			
		||||
        whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
                 --title "FlightAware Dump1090 Upgrade Available" \
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,15 @@ if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok insta
 | 
			
		|||
                 --yesno "An updated version of FlightAware dump1090 is available.\n\nWould you like to install the new version?" \
 | 
			
		||||
                 16 65
 | 
			
		||||
        if [[ $? == 0 ]]; then
 | 
			
		||||
            install_1090mhz_decoder="true"
 | 
			
		||||
            install_adsb_decoder="true"
 | 
			
		||||
        fi
 | 
			
		||||
    else
 | 
			
		||||
        whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
                 --title "Reinstall FlightAware dump1090" \
 | 
			
		||||
                 --defaultno --yesno "The option to rebuild and reinstall FlightAware dump1090 is available.\n\nWould you like to rebuild and reinstall FlightAware dump1090?" \
 | 
			
		||||
                 9 65
 | 
			
		||||
        if [[ $? == 0 ]]; then
 | 
			
		||||
            install_adsb_decoder="true"
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
else
 | 
			
		||||
| 
						 | 
				
			
			@ -29,11 +37,13 @@ else
 | 
			
		|||
             --yesno "FlightAware dump1090 is capable of demodulating ADS-B, Mode S, Mode 3A/3C signals received by an SDR device.\n\nGitHub Repository: https://github.com/flightaware/dump1090\n\nWould you like to install FlightAware dump1090?" \
 | 
			
		||||
             10 65
 | 
			
		||||
    if [[ $? == 0 ]]; then
 | 
			
		||||
        install_978mhz_decoder="true"
 | 
			
		||||
        install_adsb_decoder="true"
 | 
			
		||||
        chosen_adsb_decoder="dump1090-fa"
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
function install_dump1090-fa() {
 | 
			
		||||
function install_dump1090_fa() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/dump1090-fa.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/decoders/dump1090-fa.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -41,19 +51,27 @@ function install_dump1090-fa() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 978MHZ DECODERS
 | 
			
		||||
## UAT DECODERS
 | 
			
		||||
 | 
			
		||||
# Flightaware dump978
 | 
			
		||||
install_978mhz_decoder="false"
 | 
			
		||||
install_uat_decoder="false"
 | 
			
		||||
if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") == 1 ]]; then
 | 
			
		||||
    chosen_978mhz_decoder="dump978-fa"
 | 
			
		||||
    chosen_uat_decoder="dump978-fa"
 | 
			
		||||
    if [[ $(sudo dpkg -s dump978-fa 2>/dev/null | grep -c "Version: ${dump978_fa_current_version}") == 0 ]]; then
 | 
			
		||||
        whiptail  --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
                  --title "FlightAware dump978 Upgrade Available" \
 | 
			
		||||
                  --defaultno --yesno "An updated version of FlightAware dump978 is available.\n\nWould you like to install the new version?" \
 | 
			
		||||
                  16 65
 | 
			
		||||
        whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
                 --title "FlightAware dump978 Upgrade Available" \
 | 
			
		||||
                 --defaultno --yesno "An updated version of FlightAware dump978 is available.\n\nWould you like to install the new version?" \
 | 
			
		||||
                 16 65
 | 
			
		||||
        if [[ $? == 0 ]]; then
 | 
			
		||||
            install_978mhz_decoder="true"
 | 
			
		||||
            install_uat_decoder="true"
 | 
			
		||||
        fi
 | 
			
		||||
    else
 | 
			
		||||
        whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
                 --title "Reinstall FlightAware dump978" \
 | 
			
		||||
                 --defaultno --yesno "The option to rebuild and reinstall FlightAware dump978 is available.\n\nWould you like to rebuild and reinstall FlightAware dump978?" \
 | 
			
		||||
                 9 65
 | 
			
		||||
        if [[ $? == 0 ]]; then
 | 
			
		||||
            install_uat_decoder="true"
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
else
 | 
			
		||||
| 
						 | 
				
			
			@ -63,17 +81,53 @@ else
 | 
			
		|||
             --yesno "FlightAware dump978 is capable of demodulating UAT received by an SDR device.\n\nGitHub Repository: https://github.com/flightaware/dump978\n\nWould you like to install FlightAware dump978?" \
 | 
			
		||||
             10 65
 | 
			
		||||
    if [[ $? == 0 ]]; then
 | 
			
		||||
        install_978mhz_decoder="true"
 | 
			
		||||
        install_uat_decoder="true"
 | 
			
		||||
        chosen_uat_decoder="dump978-fa"
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
function install_dump978-fa() {
 | 
			
		||||
function install_dump978_fa() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/dump978-fa.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/decoders/dump978-fa.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## ACARS DECODERS
 | 
			
		||||
 | 
			
		||||
# ACARSDEC
 | 
			
		||||
install_acars_decoder="false"
 | 
			
		||||
if [[ -f /etc/systemd/system/acarsdec.service ]]; then
 | 
			
		||||
    chosen_acars_decoder="acarsdec"
 | 
			
		||||
    whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
             --title "Reinstall ACARSDEC Decoder" \
 | 
			
		||||
             --defaultno \
 | 
			
		||||
             --yesno "The option to rebuild and reinstall ACARSDEC is available.\n\nWould you like to rebuild and reinstall ACARSDEC?" \
 | 
			
		||||
             9 65
 | 
			
		||||
    if [[ $? == 0 ]]; then
 | 
			
		||||
        install_acars_decoder="true"
 | 
			
		||||
    fi
 | 
			
		||||
else
 | 
			
		||||
    whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
             --title "ACARSDEC Decoder" \
 | 
			
		||||
             --defaultno \
 | 
			
		||||
             --yesno "ACARSDEC is a multi-channels acars decoder with built-in rtl_sdr, airspy front end or sdrplay device.\n\nGitHub Repository: https://github.com/TLeconte/acarsdec\n\nWould you like to install ACARSDEC?" \
 | 
			
		||||
             10 65
 | 
			
		||||
    if [[ $? == 0 ]]; then
 | 
			
		||||
        install_acars_decoder="true"
 | 
			
		||||
        chosen_acars_decoder="acarsdec"
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
function install_acarsdec() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/acarsdec.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/decoders/acarsdec.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## AGGREGATE SITE CLIENTS
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -89,6 +143,7 @@ else
 | 
			
		|||
    feeder_list=("${feeder_list[@]}" 'ADS-B Exchange Feed Client' '' OFF)
 | 
			
		||||
fi
 | 
			
		||||
function install_adsbexchange_client() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/adsbexchange.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/feeders/adsbexchange.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -105,6 +160,7 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
function install_airplaneslive_client() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/airplaneslive.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/feeders/airplaneslive.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -123,6 +179,7 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
function install_flightaware_client() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/piaware.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/feeders/piaware.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -141,6 +198,7 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
function install_flightradar24_client() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/flightradar24.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/feeders/flightradar24.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -157,6 +215,7 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
function install_flyitalyadsb_client() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/flyitalyadsb.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/feeders/flyitalyadsb.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -173,6 +232,7 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
function install_openskynetwork_client() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/openskynetwork.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/feeders/openskynetwork.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -219,6 +279,7 @@ else
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
function install_planefinder_client() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/planefinder.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/feeders/planefinder.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -241,12 +302,13 @@ whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		|||
         --title "Install The ADS-B Portal" \
 | 
			
		||||
         --defaultno \
 | 
			
		||||
         --yesno "The ADS-B Portal is a web interface for your receiver. More information can be found in the ADS-B Receiver Project GitHub repository.\n\nhttps://github.com/jprochazka/adsb-receiver\n\nWould you like to install the ADS-B Portal?" \
 | 
			
		||||
         14 78
 | 
			
		||||
         12 78
 | 
			
		||||
if [[ $? == 0 ]]; then
 | 
			
		||||
    install_portal="true"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
function install_adsb-portal() {
 | 
			
		||||
function install_adsb_portal() {
 | 
			
		||||
    chmod +x ${RECEIVER_BASH_DIRECTORY}/portal/install.sh
 | 
			
		||||
    ${RECEIVER_BASH_DIRECTORY}/portal/install.sh
 | 
			
		||||
    if [[ $? != 0 ]] ; then
 | 
			
		||||
        exit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -296,19 +358,18 @@ whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		|||
         --checklist \
 | 
			
		||||
         --nocancel \
 | 
			
		||||
         --separate-output "The following extras are available for installation, please select any which you wish to install." \
 | 
			
		||||
         13 65 4 "${extras_list[@]}" 2>${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
 | 
			
		||||
 | 
			
		||||
         11 65 4 "${extras_list[@]}" 2>${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Setup Confirmation
 | 
			
		||||
 | 
			
		||||
declare confirmation_message
 | 
			
		||||
 | 
			
		||||
if [[ "${install_1090mhz_decoder}" == "false" && "${install_1090mhz_decoder}" == "false" && "${install_portal}" == "false" && ! -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" && ! -s "${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES" ]]; then
 | 
			
		||||
if [[ "${install_adsb_decoder}" == "false" && "${install_uat_decoder}" == "false" && "${install_acars_decoder}" == "false" && "${install_portal}" == "false" && ! -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" && ! -s "${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES" ]]; then
 | 
			
		||||
    whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
 | 
			
		||||
             --title "Nothing to be done" \
 | 
			
		||||
             --msgbox "Nothing has been selected to be installed so the script will exit now." \
 | 
			
		||||
             10 65
 | 
			
		||||
             8 65
 | 
			
		||||
    echo ""
 | 
			
		||||
    log_alert_heading "Nothing was selected to do or be installed"
 | 
			
		||||
    echo ""
 | 
			
		||||
| 
						 | 
				
			
			@ -316,24 +377,33 @@ if [[ "${install_1090mhz_decoder}" == "false" && "${install_1090mhz_decoder}" ==
 | 
			
		|||
else
 | 
			
		||||
    confirmation_message="The following software will be installed:\n"
 | 
			
		||||
 | 
			
		||||
    # 1090MHz decoders
 | 
			
		||||
    if [[ "${install_1090mhz_decoder}" == "true" ]]; then
 | 
			
		||||
        case ${chosen_1090mhz_decoder} in
 | 
			
		||||
    # ADS-B decoders
 | 
			
		||||
    if [[ "${install_adsb_decoder}" == "true" ]]; then
 | 
			
		||||
        case ${chosen_adsb_decoder} in
 | 
			
		||||
            "dump1090-fa")
 | 
			
		||||
                confirmation_message="${confirmation_message}\n  * FlightAware dump1090"
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # 978MHz decoders
 | 
			
		||||
    if [[ "${install_978mhz_decoder}" = "true" ]]; then
 | 
			
		||||
        case ${chosen_978mhz_decoder} in
 | 
			
		||||
    # UAT decoders
 | 
			
		||||
    if [[ "${install_uat_decoder}" = "true" ]]; then
 | 
			
		||||
        case ${chosen_uat_decoder} in
 | 
			
		||||
            "dump978-fa")
 | 
			
		||||
                confirmation_message="${confirmation_message}\n  * FlightAware dump978"
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # ACARS decoders
 | 
			
		||||
    if [[ "${install_acars_decoder}" = "true" ]]; then
 | 
			
		||||
        case ${chosen_acars_decoder} in
 | 
			
		||||
            "acarsdec")
 | 
			
		||||
                confirmation_message="${confirmation_message}\n  * ACARSDEC"
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Aggragate site clients
 | 
			
		||||
    if [[ -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" ]]; then
 | 
			
		||||
        while read feeder_choice
 | 
			
		||||
| 
						 | 
				
			
			@ -343,7 +413,7 @@ else
 | 
			
		|||
    fi
 | 
			
		||||
 | 
			
		||||
    # Portals
 | 
			
		||||
    if [[ "${WEBPORTAL_DO_INSTALL}" == "true" ]]; then
 | 
			
		||||
    if [[ "${install_portal}" == "true" ]]; then
 | 
			
		||||
        confirmation_message="${confirmation_message}\n  * ADS-B Receiver Project Web Portal"
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -369,24 +439,34 @@ fi
 | 
			
		|||
 | 
			
		||||
## BEGIN SETUP
 | 
			
		||||
 | 
			
		||||
# 1090MHz Decoders
 | 
			
		||||
if [[ "${install_1090mhz_decoder}" == "true" ]]; then
 | 
			
		||||
    case ${chosen_1090mhz_decoder} in
 | 
			
		||||
# ADS-B Decoders
 | 
			
		||||
if [[ "${install_adsb_decoder}" == "true" ]]; then
 | 
			
		||||
    case ${chosen_adsb_decoder} in
 | 
			
		||||
        "dump1090-fa")
 | 
			
		||||
             install_dump1090-fa
 | 
			
		||||
             install_dump1090_fa
 | 
			
		||||
             ;;
 | 
			
		||||
    esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# 978MHz Decoders
 | 
			
		||||
if [[ "${install_978mhz_decoder}" == "true" ]]; then
 | 
			
		||||
    case ${chosen_978mhz_decoder} in
 | 
			
		||||
# UAT Decoders
 | 
			
		||||
if [[ "${install_uat_decoder}" == "true" ]]; then
 | 
			
		||||
    case ${chosen_uat_decoder} in
 | 
			
		||||
        "dump978-fa")
 | 
			
		||||
             install_dump978-fa
 | 
			
		||||
             install_dump978_fa
 | 
			
		||||
             ;;
 | 
			
		||||
    esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# ACARS Decoders
 | 
			
		||||
if [[ "${install_acars_decoder}" == "true" ]]; then
 | 
			
		||||
    case ${chosen_acars_decoder} in
 | 
			
		||||
        "acarsdec")
 | 
			
		||||
             install_acarsdec
 | 
			
		||||
             ;;
 | 
			
		||||
    esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Aggragate site clients
 | 
			
		||||
run_adsbexchange_script="false"
 | 
			
		||||
run_airplaneslive_script="false"
 | 
			
		||||
run_flightaware_script="false"
 | 
			
		||||
| 
						 | 
				
			
			@ -395,7 +475,6 @@ run_flyitalyadsb_script="false"
 | 
			
		|||
run_openskynetwork_script="false"
 | 
			
		||||
run_planefinder_script="false"
 | 
			
		||||
 | 
			
		||||
# Aggragate site clients
 | 
			
		||||
if [[ -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" ]]; then
 | 
			
		||||
    while read feeder_choice
 | 
			
		||||
    do
 | 
			
		||||
| 
						 | 
				
			
			@ -455,7 +534,7 @@ fi
 | 
			
		|||
 | 
			
		||||
# Portals
 | 
			
		||||
if [[ "${install_portal}" == "true" ]]; then
 | 
			
		||||
    install_adsb-portal
 | 
			
		||||
    install_adsb_portal
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Extras
 | 
			
		||||
| 
						 | 
				
			
			@ -477,7 +556,7 @@ if [[ -s "${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES" ]]; then
 | 
			
		|||
    done < ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ "${run_adsbexchange_script}" == "true" ]]; then
 | 
			
		||||
if [[ "${run_beastsplitter_script}" == "true" ]]; then
 | 
			
		||||
    install_beastsplitter
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,79 +1,41 @@
 | 
			
		|||
#!/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.                                                                         #
 | 
			
		||||
#                                                                                   #
 | 
			
		||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
			
		||||
 | 
			
		||||
## VARIABLES
 | 
			
		||||
 | 
			
		||||
PORTAL_BUILD_DIRECTORY="${RECEIVER_BUILD_DIRECTORY}/portal"
 | 
			
		||||
PORTAL_PYTHON_DIRECTORY="${PORTAL_BUILD_DIRECTORY}/python"
 | 
			
		||||
 | 
			
		||||
DATABASEENGINE=${ADSB_DATABASEENGINE}
 | 
			
		||||
DATABASEHOSTNAME=${ADSB_DATABASEHOSTNAME}
 | 
			
		||||
DATABASEUSER=${ADSB_DATABASEUSER}
 | 
			
		||||
DATABASEPASSWORD1=${ADSB_DATABASEPASSWORD1}
 | 
			
		||||
DATABASENAME=${ADSB_DATABASENAME}
 | 
			
		||||
 | 
			
		||||
## SETUP FLIGHT LOGGING
 | 
			
		||||
 | 
			
		||||
echo -e ""
 | 
			
		||||
echo -e "\e[95m  Setting up core advanced portal features...\e[97m"
 | 
			
		||||
echo -e ""
 | 
			
		||||
log_heading "Setting up core advanced portal features"
 | 
			
		||||
 | 
			
		||||
case ${DATABASEENGINE} in
 | 
			
		||||
case $ADSB_PORTAL_DATABASE_ENGINE in
 | 
			
		||||
    "MySQL")
 | 
			
		||||
        echo -e "\e[94m  Creating the flight Python configuration file for MySQL...\e[97m"
 | 
			
		||||
        log_message "Creating the flight Python configuration file for MySQL"
 | 
			
		||||
        tee ${PORTAL_PYTHON_DIRECTORY}/config.json > /dev/null <<EOF
 | 
			
		||||
{
 | 
			
		||||
    "database":{"type":"mysql",
 | 
			
		||||
                "host":"${DATABASEHOSTNAME}",
 | 
			
		||||
                "user":"${DATABASEUSER}",
 | 
			
		||||
                "passwd":"${DATABASEPASSWORD1}",
 | 
			
		||||
                "db":"${DATABASENAME}"}
 | 
			
		||||
                "host":"${ADSB_PORTAL_DATABASE_HOSTNAME}",
 | 
			
		||||
                "user":"${ADSB_PORTAL_DATABASE_USER}",
 | 
			
		||||
                "passwd":"${ADSB_PORTAL_DATABASE_PASSWORD1}",
 | 
			
		||||
                "db":"${ADSB_PORTAL_DATABASE_NAME}"}
 | 
			
		||||
}
 | 
			
		||||
EOF
 | 
			
		||||
            ;;
 | 
			
		||||
    "SQLite")
 | 
			
		||||
        echo -e "\e[94m  Creating the Python configuration file for SQLite...\e[97m"
 | 
			
		||||
        log_message "Creating the Python configuration file for SQLite"
 | 
			
		||||
        tee ${PORTAL_PYTHON_DIRECTORY}/config.json > /dev/null <<EOF
 | 
			
		||||
{
 | 
			
		||||
    "database":{"type":"sqlite",
 | 
			
		||||
                "host":"${DATABASEHOSTNAME}",
 | 
			
		||||
                "user":"${DATABASEUSER}",
 | 
			
		||||
                "passwd":"${DATABASEPASSWORD1}",
 | 
			
		||||
                "db":"${DATABASENAME}"}
 | 
			
		||||
                "host":"${ADSB_PORTAL_DATABASE_HOSTNAME}",
 | 
			
		||||
                "user":"${ADSB_PORTAL_DATABASE_USER}",
 | 
			
		||||
                "passwd":"${ADSB_PORTAL_DATABASE_PASSWORD1}",
 | 
			
		||||
                "db":"${ADSB_PORTAL_DATABASE_NAME}"}
 | 
			
		||||
}
 | 
			
		||||
EOF
 | 
			
		||||
        ;;
 | 
			
		||||
    *)
 | 
			
		||||
        echo -e "\e[94m  No core setup required...\e[97m"
 | 
			
		||||
        log_message "No core setup required"
 | 
			
		||||
        ;;
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,36 +1,5 @@
 | 
			
		|||
#!/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.                                                                         #
 | 
			
		||||
#                                                                                   #
 | 
			
		||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
			
		||||
 | 
			
		||||
### VARIABLES
 | 
			
		||||
 | 
			
		||||
PORTAL_BUILD_DIRECTORY="${RECEIVER_BUILD_DIRECTORY}/portal"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												Plik diff jest za duży
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -4,14 +4,13 @@
 | 
			
		|||
 | 
			
		||||
python_path=`which python3`
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## SETUP FLIGHT LOGGING
 | 
			
		||||
 | 
			
		||||
echo -e ""
 | 
			
		||||
echo -e "\e[95m  Setting up portal flight logging and maintenance...\e[97m"
 | 
			
		||||
echo -e ""
 | 
			
		||||
log_heading "Setting up portal flight logging and maintenance"
 | 
			
		||||
 | 
			
		||||
# Create the cron jobs responsible for logging and maintenance.
 | 
			
		||||
echo -e "\e[94m  Creating the portal script cron file...\e[97m"
 | 
			
		||||
log_message "Creating the portal script cron file"
 | 
			
		||||
sudo tee /etc/cron.d/adsb-receiver-flight-logging > /dev/null <<EOF
 | 
			
		||||
* * * * * root ${python_path} ${RECEIVER_BUILD_DIRECTORY}/portal/python/flights.py
 | 
			
		||||
0 0 * * * root ${python_path} ${RECEIVER_BUILD_DIRECTORY}/portal/python/maintenance.py
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
<?php
 | 
			
		||||
    // Start session
 | 
			
		||||
    session_start();
 | 
			
		||||
 | 
			
		||||
    // Load the common PHP classes.
 | 
			
		||||
    require_once('classes/common.class.php');
 | 
			
		||||
    require_once('classes/template.class.php');
 | 
			
		||||
    require_once('classes/acars.class.php');
 | 
			
		||||
 | 
			
		||||
    $common = new common();
 | 
			
		||||
    $template = new template();
 | 
			
		||||
    $acars = new acars();
 | 
			
		||||
 | 
			
		||||
    $pageData = array();
 | 
			
		||||
 | 
			
		||||
    // The title of this page.
 | 
			
		||||
    $pageData['title'] = "ACARS Messages";
 | 
			
		||||
 | 
			
		||||
    // Pagination.
 | 
			
		||||
    $items_per_page = 15;
 | 
			
		||||
    $page = (isset($_GET['page']) ? $_GET['page'] : 1);
 | 
			
		||||
    $message_count = $acars->getAcarsMessageCount();
 | 
			
		||||
 | 
			
		||||
    // Get most recent ACARS messages.
 | 
			
		||||
    $messages = $acars->getAcarsMessages($items_per_page, ($items_per_page * $page));
 | 
			
		||||
    $pageData['acarsMessages'] = $messages;
 | 
			
		||||
 | 
			
		||||
    // Calculate the number of pagination links to show.
 | 
			
		||||
    $pageData['pageLinks'] = ceil($message_count / $items_per_page);
 | 
			
		||||
 | 
			
		||||
    $template->display($pageData);
 | 
			
		||||
?>
 | 
			
		||||
| 
						 | 
				
			
			@ -106,6 +106,10 @@
 | 
			
		|||
        if (isset($_POST['enableBlog']) && $_POST['enableBlog'] == "TRUE")
 | 
			
		||||
            $enableBlog = TRUE;
 | 
			
		||||
 | 
			
		||||
        $enableAcars = FALSE;
 | 
			
		||||
        if (isset($_POST['enableAcars']) && $_POST['enableAcars'] == "TRUE")
 | 
			
		||||
            $enableAcars = TRUE;
 | 
			
		||||
 | 
			
		||||
        $enableInfo = FALSE;
 | 
			
		||||
        if (isset($_POST['enableInfo']) && $_POST['enableInfo'] == "TRUE")
 | 
			
		||||
            $enableInfo = TRUE;
 | 
			
		||||
| 
						 | 
				
			
			@ -165,6 +169,7 @@
 | 
			
		|||
        $common->updateSetting("dateFormat", $_POST['dateFormat']);
 | 
			
		||||
        $common->updateSetting("enableFlights", $enableFlights);
 | 
			
		||||
        $common->updateSetting("enableBlog", $enableBlog);
 | 
			
		||||
        $common->updateSetting("enableAcars", $enableAcars);
 | 
			
		||||
        $common->updateSetting("enableInfo", $enableInfo);
 | 
			
		||||
        $common->updateSetting("enableGraphs", $enableGraphs);
 | 
			
		||||
        $common->updateSetting("enableLinks", $enableLinks);
 | 
			
		||||
| 
						 | 
				
			
			@ -189,6 +194,7 @@
 | 
			
		|||
        $common->updateSetting("hideNavbarAndFooter", $hideNavbarAndFooter);
 | 
			
		||||
        $common->updateSetting("purge_older_data", $purgeOlderData);
 | 
			
		||||
        $common->updateSetting("days_to_save", $_POST['daysToSave']);
 | 
			
		||||
        $common->updateSetting("acarsserv_database", $_POST['acarsservDatabase']);
 | 
			
		||||
 | 
			
		||||
        // Purge older flight positions.
 | 
			
		||||
        if (isset($_POST['purgepositions'])) {
 | 
			
		||||
| 
						 | 
				
			
			@ -240,6 +246,7 @@
 | 
			
		|||
    // Get navigation settings.
 | 
			
		||||
    $enableFlights = $common->getSetting("enableFlights");
 | 
			
		||||
    $enableBlog = $common->getSetting("enableBlog");
 | 
			
		||||
    $enableAcars = $common->getSetting("enableAcars");
 | 
			
		||||
    $enableInfo = $common->getSetting("enableInfo");
 | 
			
		||||
    $enableGraphs = $common->getSetting("enableGraphs");
 | 
			
		||||
    $enableLinks = $common->getSetting("enableLinks");
 | 
			
		||||
| 
						 | 
				
			
			@ -258,6 +265,9 @@
 | 
			
		|||
    $flightRadar24Id = $common->getSetting("flightRadar24Id");
 | 
			
		||||
    $enableAdsbExchangeLink = $common->getSetting("enableAdsbExchangeLink");
 | 
			
		||||
 | 
			
		||||
    // ACARS settings.
 | 
			
		||||
    $acarsservDatabase = $common->getSetting("acarsserv_database");
 | 
			
		||||
 | 
			
		||||
    // Get units of measurement settings.
 | 
			
		||||
    $measurementRange = $common->getSetting("measurementRange");
 | 
			
		||||
    $measurementTemperature = $common->getSetting("measurementTemperature");
 | 
			
		||||
| 
						 | 
				
			
			@ -410,7 +420,7 @@
 | 
			
		|||
                        <div class="panel-heading">Flight Notifications</div>
 | 
			
		||||
                        <div class="panel-body">
 | 
			
		||||
                            <div class="form-group">
 | 
			
		||||
                                <label for="flightNotifications"">Flight names. (coma delimited)</label>
 | 
			
		||||
                                <label for="flightNotifications">Flight names. (coma delimited)</label>
 | 
			
		||||
                                <input type="text" class="form-control" id="flightNotifications" name="flightNotifications" value="<?php echo $flightNotifications; ?>">
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="checkbox">
 | 
			
		||||
| 
						 | 
				
			
			@ -441,6 +451,11 @@
 | 
			
		|||
                                    <input type="checkbox" name="enableBlog" value="TRUE"<?php ($enableBlog == 1? print ' checked' : ''); ?>> Enable blog link.
 | 
			
		||||
                                </label>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="checkbox">
 | 
			
		||||
                                <label>
 | 
			
		||||
                                    <input type="checkbox" name="enableAcars" value="TRUE"<?php ($enableAcars == 1? print ' checked' : ''); ?>> Enable ACARS link.
 | 
			
		||||
                                </label>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="checkbox">
 | 
			
		||||
                                <label>
 | 
			
		||||
                                    <input type="checkbox" name="enableInfo" value="TRUE"<?php ($enableInfo == 1? print ' checked' : ''); ?>> Enable system information link.
 | 
			
		||||
| 
						 | 
				
			
			@ -517,6 +532,15 @@
 | 
			
		|||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="panel panel-default">
 | 
			
		||||
                        <div class="panel-heading">ACARS Settings</div>
 | 
			
		||||
                        <div class="panel-body">
 | 
			
		||||
                            <div class="form-group">
 | 
			
		||||
                                <label for="acarsservDatabase">ACARSSERV Database Path</label>
 | 
			
		||||
                                <input type="text" class="form-control" id="acarsservDatabase" name="acarsservDatabase" value="<?php echo $acarsservDatabase; ?>">
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div role="tabpanel" class="tab-pane fade" id="measurements">
 | 
			
		||||
                    <div class="panel panel-default">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
<?php
 | 
			
		||||
    class acars {
 | 
			
		||||
 | 
			
		||||
        function getAcarsMessages($limit = 100, $offset = 0) {
 | 
			
		||||
            require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
 | 
			
		||||
            $common = new common();
 | 
			
		||||
 | 
			
		||||
            $dsn = "sqlite:".$common->getSetting('acarsserv_database');
 | 
			
		||||
            $dbh = new PDO($dsn, null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY]);
 | 
			
		||||
            $sql = "SELECT * FROM Messages JOIN Flights USING(FlightID) JOIN Stations USING(StID) ORDER BY LastTime DESC LIMIT :limit OFFSET :offset";
 | 
			
		||||
            $sth = $dbh->prepare($sql);
 | 
			
		||||
            $sth->bindValue(':limit', $limit);
 | 
			
		||||
            $sth->bindValue(':offset', $offset);
 | 
			
		||||
            $sth->execute();
 | 
			
		||||
            $acarsMessages = $sth->fetchAll(PDO::FETCH_ASSOC);
 | 
			
		||||
            $sth = NULL;
 | 
			
		||||
            $dbh = NULL;
 | 
			
		||||
            $dsn = NULL;
 | 
			
		||||
 | 
			
		||||
            return $acarsMessages;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function getAcarsMessageCount() {
 | 
			
		||||
            require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
 | 
			
		||||
            $common = new common();
 | 
			
		||||
 | 
			
		||||
            $dsn = "sqlite:".$common->getSetting('acarsserv_database');
 | 
			
		||||
            $dbh = new PDO($dsn, null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY]);
 | 
			
		||||
            $sql = "SELECT COUNT(*) FROM Messages";
 | 
			
		||||
            $sth = $dbh->prepare($sql);
 | 
			
		||||
            $sth->execute();
 | 
			
		||||
            $number_of_rows = $sth->fetchColumn();
 | 
			
		||||
            $sth = NULL;
 | 
			
		||||
            $dbh = NULL;
 | 
			
		||||
            $dsn = NULL;
 | 
			
		||||
 | 
			
		||||
            return $number_of_rows;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
?>
 | 
			
		||||
| 
						 | 
				
			
			@ -9,7 +9,7 @@
 | 
			
		|||
 | 
			
		||||
            // Check if the portal is installed or needs upgraded.
 | 
			
		||||
 | 
			
		||||
            $thisVersion = "2.8.5";
 | 
			
		||||
            $thisVersion = "2.8.6";
 | 
			
		||||
 | 
			
		||||
            if (!file_exists($_SERVER['DOCUMENT_ROOT']."/classes/settings.class.php")) {
 | 
			
		||||
                header ("Location: /install/install.php");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@
 | 
			
		|||
    /////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
    // The most current stable release.
 | 
			
		||||
    $thisVersion = "2.8.5";
 | 
			
		||||
    $thisVersion = "2.8.6";
 | 
			
		||||
 | 
			
		||||
    // Begin the upgrade process if this release is newer than what is installed.
 | 
			
		||||
    if (file_exists($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php")) {
 | 
			
		||||
| 
						 | 
				
			
			@ -419,6 +419,7 @@ EOF;
 | 
			
		|||
            $common->addSetting('defaultPage', 'blog.php');
 | 
			
		||||
            $common->addSetting('dateFormat', 'F jS, Y g:i A');
 | 
			
		||||
            $common->addSetting('enableBlog', TRUE);
 | 
			
		||||
            $common->addSetting('enableAcars', FALSE);
 | 
			
		||||
            $common->addSetting('enableInfo', TRUE);
 | 
			
		||||
            $common->addSetting('enableLinks', FALSE);
 | 
			
		||||
            $common->addSetting('enableGraphs', TRUE);
 | 
			
		||||
| 
						 | 
				
			
			@ -447,6 +448,7 @@ EOF;
 | 
			
		|||
            $common->addSetting("days_to_save", "30");
 | 
			
		||||
            $common->addSetting("advancedMapCenterLatitude", "41.3683798");
 | 
			
		||||
            $common->addSetting("advancedMapCenterLongitude", "-82.1076486");
 | 
			
		||||
            $common->addSetting('acarsserv_database', "");
 | 
			
		||||
 | 
			
		||||
            if ($_POST['driver'] == "xml")
 | 
			
		||||
                $common->addSetting('enableFlights', FALSE);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,72 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
    /////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
    //                            ADS-B RECEIVER PORTAL                                //
 | 
			
		||||
    // =============================================================================== //
 | 
			
		||||
    // Copyright and Licensing Information:                                            //
 | 
			
		||||
    //                                                                                 //
 | 
			
		||||
    // The MIT License (MIT)                                                           //
 | 
			
		||||
    //                                                                                 //
 | 
			
		||||
    // Copyright (c) 2015 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.                                                                       //
 | 
			
		||||
    /////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
    ///////////////////////
 | 
			
		||||
    // UPGRADE TO V2.8.6
 | 
			
		||||
    ///////////////////////
 | 
			
		||||
 | 
			
		||||
    // --------------------------------------------------------
 | 
			
		||||
    // Updates the version setting to 2.8.6
 | 
			
		||||
    // --------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
    $results = upgrade();
 | 
			
		||||
    exit(json_encode($results));
 | 
			
		||||
 | 
			
		||||
    function upgrade() {
 | 
			
		||||
        require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
 | 
			
		||||
        require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");
 | 
			
		||||
 | 
			
		||||
        $common = new common();
 | 
			
		||||
        $settings = new settings();
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
 | 
			
		||||
            // Add enable ACARS setting
 | 
			
		||||
            $common->addSetting('enableAcars', FALSE);
 | 
			
		||||
            $common->addSetting('acarsserv_database', "");
 | 
			
		||||
 | 
			
		||||
            // Update the version and patch settings
 | 
			
		||||
            $common->updateSetting("version", "2.8.6");
 | 
			
		||||
            $common->updateSetting("patch", "");
 | 
			
		||||
 | 
			
		||||
            // The upgrade process completed successfully
 | 
			
		||||
            $results['success'] = TRUE;
 | 
			
		||||
            $results['message'] = "Upgrade to v2.8.6 successful.";
 | 
			
		||||
            return $results;
 | 
			
		||||
 | 
			
		||||
        } catch(Exception $e) {
 | 
			
		||||
            // Something went wrong during this upgrade process
 | 
			
		||||
            $results['success'] = FALSE;
 | 
			
		||||
            $results['message'] = $e->getMessage();
 | 
			
		||||
            return $results;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -231,6 +231,15 @@
 | 
			
		|||
        $version = "2.8.5";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // UPGRADE TO V2.8.6
 | 
			
		||||
    if ($common->getSetting("version") == "2.8.5" && $success) {
 | 
			
		||||
        $json = file_get_contents("http://localhost/install/upgrade-v2.8.6.php");
 | 
			
		||||
        $results = json_decode($json, TRUE);
 | 
			
		||||
        $success = $results['success'];
 | 
			
		||||
        $message = $results['message'];
 | 
			
		||||
        $version = "2.8.6";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."header.inc.php");
 | 
			
		||||
 | 
			
		||||
    // Display the instalation wizard.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
{area:head/}
 | 
			
		||||
{area:contents}
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <h1>ACARS Messages</h1>
 | 
			
		||||
                <hr />
 | 
			
		||||
                {foreach page:acarsMessages as message}
 | 
			
		||||
                    <h2>{message->FlightNumber}</h2>
 | 
			
		||||
                    <p>
 | 
			
		||||
                        Aircarft Registration: {message->Registration}<br/>
 | 
			
		||||
                        The first message was received on {message->StartTime} with the last seen {message->LastTime}.<br/>
 | 
			
		||||
                        A total of {message->NbMessages} messages have been received by this flight.
 | 
			
		||||
                    </p>
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <ul>
 | 
			
		||||
                            <li>Time: {message->Time}</li>
 | 
			
		||||
                            <li>Station ID: {message->IdStation}</li>
 | 
			
		||||
                            <li>Channel: {message->Channel}</li>
 | 
			
		||||
                            <li>Error: {message->Error}</li>
 | 
			
		||||
                            <li>Signal Level: {message->SignalLvl}</li>
 | 
			
		||||
                            <li>Mode: {message->Mode}</li>
 | 
			
		||||
                            <li>Ack: {message->Ack}</li>
 | 
			
		||||
                            <li>Label: {message->Label}</li>
 | 
			
		||||
                            <li>Block Number: {message->BlockNo}</li>
 | 
			
		||||
                            <li>Mesage Number: {message->MessNo}</li>
 | 
			
		||||
                            <li>Text: {message->Txt}</li>
 | 
			
		||||
                        </ul>
 | 
			
		||||
                    </div>
 | 
			
		||||
                {/foreach}
 | 
			
		||||
                <ul class="pagination">
 | 
			
		||||
                    {for pageNumber eq 1 to page:pageLinks}
 | 
			
		||||
                        <li><a href="acars.php?page={pageNumber}">{pageNumber}</a></li>
 | 
			
		||||
                    {/for}
 | 
			
		||||
                </ul>
 | 
			
		||||
            </div>
 | 
			
		||||
{/area}
 | 
			
		||||
{area:scripts}
 | 
			
		||||
        <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
 | 
			
		||||
{/area}
 | 
			
		||||
| 
						 | 
				
			
			@ -48,6 +48,7 @@
 | 
			
		|||
                    <div class="navbar-collapse collapse">
 | 
			
		||||
                        <ul class="nav navbar-nav">
 | 
			
		||||
                            {if setting:enableBlog eq TRUE}<li id="blog-link"><a href="/blog.php">Blog</a></li>{/if}
 | 
			
		||||
                            {if setting:enableAcars eq TRUE}<li id="acars-link"><a href="/acars.php">ACARS</a></li>{/if}
 | 
			
		||||
                            {if setting:enableFlights eq TRUE}<li id="flights-link"><a href="/flights.php">Flights</a></li>{/if}
 | 
			
		||||
                            <li class="dropdown">
 | 
			
		||||
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">System <span class="caret"></span></a>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@
 | 
			
		|||
#                                                                                   #
 | 
			
		||||
#  -------------------------------------------------------------------------------  #
 | 
			
		||||
#                                                                                   #
 | 
			
		||||
# Copyright (c) 2015 Joseph A. Prochazka                                            #
 | 
			
		||||
# Copyright (c) 2015 Joseph A. Prochazka and Contributors                           #
 | 
			
		||||
#                                                                                   #
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy      #
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to deal     #
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
 | 
			
		||||
## ASSIGN VARIABLE
 | 
			
		||||
 | 
			
		||||
project_version="2.8.5"
 | 
			
		||||
project_version="2.8.6"
 | 
			
		||||
 | 
			
		||||
printf -v date_time '%(%Y-%m-%d_%H-%M-%S)T' -1
 | 
			
		||||
log_file="adsb-installer_${date_time}.log"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue