2016-09-27 01:28:04 +00:00
#!/bin/bash
## INCLUDE EXTERNAL SCRIPTS
2017-10-02 19:36:29 +00:00
source ${ RECEIVER_BASH_DIRECTORY } /variables.sh
source ${ RECEIVER_BASH_DIRECTORY } /functions.sh
2016-09-27 15:27:51 +00:00
## Set the project title variable.
2017-10-02 19:36:29 +00:00
export RECEIVER_PROJECT_TITLE = " The ADS-B Receiver Project v ${ PROJECT_VERSION } Installer "
2016-09-27 15:27:51 +00:00
2016-09-27 01:28:04 +00:00
###############
## FUNCTIONS
## DECODERS
# Execute the dump1090-fa setup script.
function InstallDump1090Fa( ) {
2017-10-02 19:36:29 +00:00
chmod +x ${ RECEIVER_BASH_DIRECTORY } /decoders/dump1090-fa.sh
${ RECEIVER_BASH_DIRECTORY } /decoders/dump1090-fa.sh
if [ [ $? -ne 0 ] ] ; then
2016-09-27 01:28:04 +00:00
exit 1
fi
}
# Execute the dump978 setup script.
2024-06-17 21:38:17 +00:00
function InstallDump978Fa( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /decoders/dump978-fa.sh
${ RECEIVER_BASH_DIRECTORY } /decoders/dump978-fa.sh
2017-10-02 19:36:29 +00:00
if [ [ $? -ne 0 ] ] ; then
exit 1
fi
}
2016-09-27 01:28:04 +00:00
## FEEDERS
2017-10-02 19:36:29 +00:00
# Execute the ADS-B Exchange setup script.
function InstallAdsbExchange( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /feeders/adsbexchange.sh
${ RECEIVER_BASH_DIRECTORY } /feeders/adsbexchange.sh
if [ [ $? -ne 0 ] ] ; then
2016-09-27 01:28:04 +00:00
exit 1
fi
}
2018-06-26 13:06:46 +00:00
# Execute the Flightradar24 Feeder client setup script.
function InstallFlightradar24( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /feeders/flightradar24.sh
${ RECEIVER_BASH_DIRECTORY } /feeders/flightradar24.sh
2017-10-02 19:36:29 +00:00
if [ [ $? -ne 0 ] ] ; then
2016-09-27 01:28:04 +00:00
exit 1
fi
}
2024-07-07 19:36:38 +00:00
# Execute the Fly Italy ADS-B Feeder client setup script.
function InstallFlyItalyAdsb( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /feeders/flyitalyadsb.sh
${ RECEIVER_BASH_DIRECTORY } /feeders/flyitalyadsb.sh
if [ [ $? -ne 0 ] ] ; then
exit 1
fi
}
2018-06-26 13:06:46 +00:00
# Execute the OpenSky Network setup script.
function InstallOpenSkyNetwork( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /feeders/openskynetwork.sh
${ RECEIVER_BASH_DIRECTORY } /feeders/openskynetwork.sh
if [ [ $? -ne 0 ] ] ; then
exit 1
fi
}
# Execute the PiAware setup script
function InstallPiAware( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /feeders/piaware.sh
${ RECEIVER_BASH_DIRECTORY } /feeders/piaware.sh
2017-10-02 19:36:29 +00:00
if [ [ $? -ne 0 ] ] ; then
2016-09-27 01:28:04 +00:00
exit 1
fi
}
2017-10-02 19:36:29 +00:00
# Execute the Plane Finder Client setup script.
function InstallPlaneFinder( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /feeders/planefinder.sh
${ RECEIVER_BASH_DIRECTORY } /feeders/planefinder.sh
if [ [ $? -ne 0 ] ] ; then
2016-09-27 01:28:04 +00:00
exit 1
fi
}
## Portal
# Execute the ADS-B Receiver Project Web Portal setup script.
function InstallWebPortal( ) {
2017-10-02 19:36:29 +00:00
chmod +x ${ RECEIVER_BASH_DIRECTORY } /portal/install.sh
${ RECEIVER_BASH_DIRECTORY } /portal/install.sh
if [ [ $? -ne 0 ] ] ; then
exit 1
fi
}
## Extras
# Execute the beast-splitter setup script.
function InstallBeastSplitter( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /extras/beeastsplitter.sh
${ RECEIVER_BASH_DIRECTORY } /extras/beastsplitter.sh
if [ [ $? -ne 0 ] ] ; then
exit 1
fi
}
# Execute the Duck DNS setup script.
function InstallDuckDns( ) {
chmod +x ${ RECEIVER_BASH_DIRECTORY } /extras/duckdns.sh
${ RECEIVER_BASH_DIRECTORY } /extras/duckdns.sh
if [ [ $? -ne 0 ] ] ; then
2016-09-27 01:28:04 +00:00
exit 1
fi
}
#############
## DIALOGS
## Decoders
# Check if the dump1090-fa package is installed.
2017-10-02 19:36:29 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed" ) -eq 1 ] ] ; then
DUMP1090_FORK = "fa"
DUMP1090_IS_INSTALLED = "true"
2016-09-27 01:28:04 +00:00
# Check if a newer version can be installed.
2024-06-17 21:38:17 +00:00
if [ [ $( sudo dpkg -s dump1090-fa 2>/dev/null | grep -c " Version: ${ DUMP1090_FA_VERSION } " ) -eq 0 ] ] ; then
2024-06-20 17:03:21 +00:00
whiptail --backtitle "RECEIVER_PROJECT_TITLE" --title "Dump1090-fa Upgrade Available" --defaultno --yesno "An updated version of dump1090-fa is available.\n\nWould you like to download, build, then install the new version?" 16 65
case $? in
0)
2017-10-02 19:36:29 +00:00
DUMP1090_DO_UPGRADE = "true"
2024-06-20 17:03:21 +00:00
; ;
1)
2017-10-02 19:36:29 +00:00
DUMP1090_DO_UPGRADE = "false"
2024-06-20 17:03:21 +00:00
; ;
esac
2016-09-27 01:28:04 +00:00
fi
fi
2017-10-02 19:36:29 +00:00
# If no dump1090 fork is installed then attempt to install one.
if [ [ ! " ${ DUMP1090_IS_INSTALLED } " = "true" ] ] ; then
2024-06-20 17:03:21 +00:00
DUMP1090_OPTION = $( whiptail --nocancel --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "Choose Dump1090 Version To Install" --radiolist "Dump1090 does not appear to be present on this device. In order to continue setup dump1090 will need to exist on this device. Please select your prefered dump1090 version from the list below.\n\nPlease note that in order to run dump1090-fa PiAware will need to be installed as well." 16 65 2 "dump1090-fa" "(FlightAware)" ON 3>& 1 1>& 2 2>& 3)
case ${ DUMP1090_OPTION } in
"dump1090-fa" )
DUMP1090_FORK = "fa"
2017-10-02 19:36:29 +00:00
DUMP1090_DO_INSTALL = "true"
2024-06-20 17:03:21 +00:00
; ;
*)
2017-10-02 19:36:29 +00:00
DUMP1090_DO_INSTALL = "false"
2024-06-20 17:03:21 +00:00
; ;
esac
2016-09-27 01:28:04 +00:00
fi
2017-10-02 19:36:29 +00:00
# If the FlightAware fork of dump1090 is or has been chosen to be installed PiAware must be installed.
2024-06-20 17:03:21 +00:00
if [ [ " ${ DUMP1090_FORK } " = "fa" && " ${ DUMP1090_DO_INSTALL } " = "true" || " ${ DUMP1090_DO_UPGRADE } " = "true" ] ] ; then
FORCE_PIAWARE_INSTALL = "true"
2016-09-27 01:28:04 +00:00
fi
2024-06-17 21:38:17 +00:00
# Check if the dump978-fa package is installed.
2024-06-20 17:03:21 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed" ) -eq 1 ] ] ; then
# Dump978 appears to be present on this device.
2024-06-17 21:38:17 +00:00
DUMP978_FORK = "fa"
2017-10-02 19:36:29 +00:00
DUMP978_IS_INSTALLED = "true"
2024-06-20 17:03:21 +00:00
if [ [ $( sudo dpkg -s dump978-fa 2>/dev/null | grep -c " Version: ${ DUMP978_FA_VERSION } " ) -eq 0 ] ] ; then
whiptail --backtitle "RECEIVER_PROJECT_TITLE" --title "Dump978-fa Upgrade Available" --defaultno --yesno "An updated version of dump978-fa is available.\n\nWould you like to download, build, then install the new version?" 16 65
2017-10-02 19:36:29 +00:00
case $? in
0)
2024-06-20 17:03:21 +00:00
DUMP978_DO_UPGRADE = "true"
2017-10-02 19:36:29 +00:00
; ;
1)
2024-06-20 17:03:21 +00:00
DUMP978_DO_UPGRADE = "false"
2017-10-02 19:36:29 +00:00
; ;
esac
2024-06-20 17:03:21 +00:00
fi
else
# Dump978 does not appear to be present on this device.
DUMP978_IS_INSTALLED = "false"
whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "Dump978-fa Not Installed" --defaultno --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals. These scripts can setup dump978 for you. However keep in mind a second RTL-SDR device will be required to feed data to it.\n\nDo you wish to install dump978?" 10 65
case $? in
0)
2017-10-02 19:36:29 +00:00
DUMP978_DO_INSTALL = "true"
2024-06-20 17:03:21 +00:00
; ;
1)
2017-10-02 19:36:29 +00:00
DUMP978_DO_INSTALL = "false"
2024-06-20 17:03:21 +00:00
; ;
esac
2017-10-02 19:36:29 +00:00
fi
2016-09-27 01:28:04 +00:00
## Feeder Selection Menu
2017-10-02 19:36:29 +00:00
# Declare the FEEDER_LIST array and the FEEDER_CHOICES file which will store choices for feeders which are available for install.
declare array FEEDER_LIST
touch ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
2024-06-20 17:03:21 +00:00
# Check if the ADS-B Exchange feeder has been set up.
if [ [ -f /lib/systemd/system/adsbexchange-mlat.service && -f /lib/systemd/system/adsbexchange-feed.service ] ] ; then
# The feeder appears to be set up.
2024-07-11 02:34:59 +00:00
echo "ADS-B Exchange Feeder (reinstall)" >> ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'ADS-B Exchange Feeder (reinstall)' '' OFF)
2017-10-02 19:36:29 +00:00
else
2024-06-20 17:03:21 +00:00
# The feeder does not appear to be set up.
echo "ADS-B Exchange Feeder" >> ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'ADS-B Exchange Feeder' '' OFF)
2018-06-27 15:17:51 +00:00
fi
2024-07-07 19:36:38 +00:00
# Check if the Fly Italy ADS-B feeder has been set up.
if [ [ -f /lib/systemd/system/flyitalyadsb-mlat.service && -f /lib/systemd/system/flyitalyadsb-feed.service ] ] ; then
# The feeder appears to be set up.
echo "Fly Italy ADS-B Feeder (upgrade)" >> ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Fly Italy ADS-B Feeder (upgrade)' '' OFF)
else
# The feeder does not appear to be set up.
echo "Fly Italy ADS-B Feeder" >> ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Fly Italy ADS-B Feeder' '' OFF)
fi
2018-06-26 13:06:46 +00:00
# Check for the OpenSky Network package.
2024-06-20 17:03:21 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' opensky-feeder 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ] ; then
2018-06-26 13:06:46 +00:00
# The OpenSky Network feeder package appears to not be installed.
2024-06-20 17:03:21 +00:00
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'OpenSky Network Feeder' '' OFF)
2024-06-20 17:51:02 +00:00
else
# Check if a newer version can be installed if this is not a Raspberry Pi device.
if [ [ $( sudo dpkg -s opensky-feeder 2>/dev/null | grep -c " Version: ${ OPENSKY_NETWORK_CLIENT_VERSION } " ) -eq 0 ] ] ; then
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'OpenSky Network Feeder (upgrade)' '' OFF)
else
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'OpenSky Network Feeder (reinstall)' '' OFF)
fi
2018-06-26 13:06:46 +00:00
fi
2016-09-27 01:28:04 +00:00
# Check for the PiAware package.
2024-06-20 17:03:21 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' piaware 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ] ; then
2017-10-02 19:36:29 +00:00
# Do not show the PiAware install option if the FlightAware fork of dump1090 has been chosen.
if [ [ " ${ DUMP1090_FORK } " != "fa" ] ] ; then
2024-06-20 17:03:21 +00:00
if [ [ -z " ${ PIAWARE_INSTALL } " && " ${ PIAWARE_INSTALL } " = "true" ] ] ; then
echo "FlightAware PiAware" >> ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
2017-10-02 19:36:29 +00:00
fi
2016-09-27 01:28:04 +00:00
fi
else
# Check if a newer version can be installed.
2024-06-20 17:03:21 +00:00
if [ [ $( sudo dpkg -s piaware 2>/dev/null | grep -c " Version: ${ PIAWARE_VERSION } " ) -eq 0 ] ] ; then
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'FlightAware PiAware (upgrade)' '' OFF)
2024-06-20 17:51:02 +00:00
else
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'FlightAware PiAware (reinstall)' '' OFF)
2016-09-27 01:28:04 +00:00
fi
fi
2017-10-02 19:36:29 +00:00
# Check for the Flightradar24 Feeder Client package.
2024-06-20 17:03:21 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Flightradar24 Client' '' OFF)
2017-10-02 19:36:29 +00:00
else
# Check if a newer version can be installed if this is not a Raspberry Pi device.
2024-06-20 17:51:02 +00:00
if [ [ $( sudo dpkg -s fr24feed 2>/dev/null | grep -c " Version: ${ FLIGHTRADAR24_CLIENT_VERSION_I386 } " ) -eq 0 ] ] ; then
2024-06-20 17:03:21 +00:00
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Flightradar24 Client (upgrade)' '' OFF)
2024-06-20 17:51:02 +00:00
else
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Flightradar24 Client (reinstall)' '' OFF)
2016-09-27 01:28:04 +00:00
fi
fi
2017-10-02 19:36:29 +00:00
# Check for the Planefinder ADS-B Client package.
2024-06-20 17:03:21 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' pfclient 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ] ; then
2017-10-02 19:36:29 +00:00
# The Planefinder Client package does not appear to be installed.
2024-06-20 17:03:21 +00:00
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client' '' OFF)
2016-09-27 01:28:04 +00:00
else
2017-10-02 19:36:29 +00:00
# Check if a newer version can be installed.
2024-06-20 19:24:54 +00:00
PLANEFINDER_CLIENT_INSTALLED_VERSION = $( sudo dpkg -s pfclient | grep Version | awk '{print $2}' )
case " ${ CPU_ARCHITECTURE } " in
"armv7l" | "armv6l" )
if [ [ ! " $PLANEFINDER_CLIENT_INSTALLED_VERSION " = " ${ PLANEFINDER_CLIENT_VERSION_ARMHF } " ] ] ; then
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (upgrade)' '' OFF)
else
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (reinstall)' '' OFF)
fi
; ;
"aarch64" )
if [ [ ! " $PLANEFINDER_CLIENT_INSTALLED_VERSION " = " ${ PLANEFINDER_CLIENT_VERSION_ARM64 } " ] ] ; then
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (upgrade)' '' OFF)
else
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (reinstall)' '' OFF)
fi
; ;
"x86_64" )
if [ [ ! " $PLANEFINDER_CLIENT_INSTALLED_VERSION " = " ${ PLANEFINDER_CLIENT_VERSION_AMD64 } " ] ] ; then
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (upgrade)' '' OFF)
else
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (reinstall)' '' OFF)
fi
; ;
"i386" )
if [ [ ! " $PLANEFINDER_CLIENT_INSTALLED_VERSION " = " ${ PLANEFINDER_CLIENT_VERSION_I386 } " ] ] ; then
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (upgrade)' '' OFF)
else
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (reinstall)' '' OFF)
fi
; ;
*)
FEEDER_LIST = ( " ${ FEEDER_LIST [@] } " 'Plane Finder Client (reinstall)' '' OFF)
esac
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
if [ [ -n " ${ FEEDER_LIST } " ] ] ; then
# Display a checklist containing feeders that are not installed if any.
whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "Feeder Installation Options" --checklist --nocancel --separate-output "The following feeders are available for installation.\nChoose the feeders you wish to install." 13 65 6 " ${ FEEDER_LIST [@] } " 2>${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
else
# Since all available feeders appear to be installed inform the user of the fact.
whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "All Feeders Installed" --msgbox "It appears that all the optional feeders available for installation by this script have been installed already." 8 65
2016-09-27 01:28:04 +00:00
fi
2017-10-02 19:36:29 +00:00
## ADS-B Receiver Project Web Portal
2016-09-27 01:28:04 +00:00
2024-06-20 17:03:21 +00:00
# Ask if the web portal should be installed.
whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "Install The ADS-B Receiver Project Web Portal" --yesno "The ADS-B Receiver Project Web Portal is a lightweight web interface for dump-1090 installations.\n\nCurrent features include the following:\n Unified navigation between all web pages.\n System and dump1090 performance graphs.\n\nWould you like to install the ADS-B Receiver Project web portal?" 14 78
case $? in
0)
WEBPORTAL_DO_INSTALL = "true"
; ;
1)
WEBPORTAL_DO_INSTALL = "false"
; ;
esac
2017-10-02 19:36:29 +00:00
## Extras
# Declare the EXTRAS_LIST array and the EXTRAS_CHOICES file which will store choices for extras which are available for install.
declare array EXTRAS_LIST
touch ${ RECEIVER_ROOT_DIRECTORY } /EXTRAS_CHOICES
# Check if the beast-splitter package is installed.
2024-06-20 17:03:21 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' beast-splitter 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ] ; then
2017-10-02 19:36:29 +00:00
# The beast-splitter package appears to not be installed.
2024-06-20 17:03:21 +00:00
EXTRAS_LIST = ( " ${ EXTRAS_LIST [@] } " 'beast-splitter' '' OFF)
2017-10-02 19:36:29 +00:00
else
# Offer the option to build then reinstall the beast-splitter package.
2024-06-20 17:03:21 +00:00
EXTRAS_LIST = ( " ${ EXTRAS_LIST [@] } " 'beast-splitter (reinstall)' '' OFF)
2017-10-02 19:36:29 +00:00
fi
2016-09-27 01:28:04 +00:00
2017-10-02 19:36:29 +00:00
# Check if the Duck DNS update script exists.
2024-06-20 17:03:21 +00:00
if [ [ ! -f " ${ RECEIVER_BUILD_DIRECTORY } /duckdns/duck.sh " ] ] ; then
2017-10-02 19:36:29 +00:00
# Duck DNS does not appear to be set up on this device.
2024-06-20 17:03:21 +00:00
EXTRAS_LIST = ( " ${ EXTRAS_LIST [@] } " 'Duck DNS Free Dynamic DNS Hosting' '' OFF)
2017-10-02 19:36:29 +00:00
else
# Offer the option to install/setup Duck DNS once more.
2024-06-20 17:03:21 +00:00
EXTRAS_LIST = ( " ${ EXTRAS_LIST [@] } " 'Duck DNS Free Dynamic DNS Hosting (reinstall)' '' OFF)
2017-10-02 19:36:29 +00:00
fi
2016-09-27 01:28:04 +00:00
2024-06-20 17:03:21 +00:00
# Display a menu the user can use to pick extras to be installed.
if [ [ -n " ${ EXTRAS_LIST } " ] ] ; then
# Display a checklist containing feeders that are not installed if any.
whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "Feeder Installation Options" --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
else
# Since all available extras appear to be installed inform the user of the fact.
whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "All Extras Installed" --msgbox "It appears that all the optional extras available for installation by this script have been installed already." 8 65
2016-09-27 01:28:04 +00:00
fi
2017-10-02 19:36:29 +00:00
## Setup Confirmation
2016-09-27 01:28:04 +00:00
2017-10-02 19:36:29 +00:00
declare CONFIRMATION
2016-09-27 01:28:04 +00:00
2017-10-02 19:36:29 +00:00
# Check if anything is to be done before moving on.
2024-06-20 17:03:21 +00:00
if [ [ " ${ DUMP1090_DO_INSTALL } " = "false" && " ${ DUMP1090_DO_UPGRADE } " = "false" && " ${ DUMP978_DO_INSTALL } " = "false" && " ${ DUMP978_DO_UPGRADE } " = "false" && " ${ WEBPORTAL_DO_INSTALL } " = "false" && ! -s " ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES " && ! -s " ${ RECEIVER_ROOT_DIRECTORY } /EXTRAS_CHOICES " ] ] ; then
2017-10-02 19:36:29 +00:00
# Nothing was chosen to be installed.
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
echo -e "\e[31m"
echo -e " Nothing was selected to do or be installed."
echo -e "\e[37m"
exit 1
else
# The user decided to install software.
CONFIRMATION = "The following software will be installed:\n"
# dump1090
2024-06-20 17:03:21 +00:00
if [ [ " ${ DUMP1090_DO_UPGRADE } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
case ${ DUMP1090_FORK } in
"fa" )
CONFIRMATION = " ${ CONFIRMATION } \n * dump1090-fa (upgrade) "
; ;
esac
2024-06-20 17:03:21 +00:00
elif [ [ " ${ DUMP1090_DO_INSTALL } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
case ${ DUMP1090_FORK } in
"fa" )
CONFIRMATION = " ${ CONFIRMATION } \n * dump1090-fa "
; ;
esac
2016-09-27 01:28:04 +00:00
fi
2017-10-02 19:36:29 +00:00
# dump978
2024-06-20 17:03:21 +00:00
if [ [ " ${ DUMP978_DO_UPGRADE } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
CONFIRMATION = " ${ CONFIRMATION } \n * dump978 (rebuild) "
2024-06-20 17:03:21 +00:00
elif [ [ " ${ DUMP978_DO_INSTALL } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
CONFIRMATION = " ${ CONFIRMATION } \n * dump978 "
2016-09-27 01:28:04 +00:00
fi
# If PiAware is required add it to the list.
2024-06-20 17:03:21 +00:00
if [ [ " ${ DUMP1090_FORK } " = "fa" && $( dpkg-query -W -f= '${STATUS}' piaware 2>/dev/null | grep -c "ok installed" ) -eq 0 || " ${ PIAWARE_INSTALL } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
CONFIRMATION = " ${ CONFIRMATION } \n * FlightAware PiAware "
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
if [ [ -s " ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES " ] ] ; then
2017-10-02 19:36:29 +00:00
while read FEEDER_CHOICE
2016-09-27 01:28:04 +00:00
do
2024-06-20 17:03:21 +00:00
CONFIRMATION = " ${ CONFIRMATION } \n * ${ FEEDER_CHOICE } "
2017-10-02 19:36:29 +00:00
done < ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ WEBPORTAL_DO_INSTALL } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
CONFIRMATION = " ${ CONFIRMATION } \n * ADS-B Receiver Project Web Portal "
fi
2024-06-20 17:03:21 +00:00
if [ [ -s " ${ RECEIVER_ROOT_DIRECTORY } /EXTRAS_CHOICES " ] ] ; then
2017-10-02 19:36:29 +00:00
while read EXTRAS_CHOICE
do
2024-06-20 17:03:21 +00:00
CONFIRMATION = " ${ CONFIRMATION } \n * ${ EXTRAS_CHOICE } "
2017-10-02 19:36:29 +00:00
done < ${ RECEIVER_ROOT_DIRECTORY } /EXTRAS_CHOICES
2016-09-27 01:28:04 +00:00
fi
2017-10-02 19:36:29 +00:00
CONFIRMATION = " ${ CONFIRMATION } \n\n "
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
# Ask for confirmation before moving on.
CONFIRMATION = " ${ CONFIRMATION } Do you wish to continue setup? "
if ! ( whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " --title "Confirm You Wish To Continue" --yesno " ${ CONFIRMATION } " 21 78) then
echo -e "\e[31m"
echo " Installation canceled by user."
exit 1
2016-09-27 01:28:04 +00:00
fi
#################
## BEGIN SETUP
## Decoders
2024-06-20 17:03:21 +00:00
if [ [ " ${ DUMP1090_DO_INSTALL } " = "true" || " ${ DUMP1090_DO_UPGRADE } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
case ${ DUMP1090_FORK } in
"fa" )
InstallDump1090Fa
; ;
esac
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ DUMP978_DO_INSTALL } " = "true" || " ${ DUMP978_DO_UPGRADE } " = "true" ] ] ; then
2024-06-17 21:38:17 +00:00
InstallDump978Fa
2016-09-27 01:28:04 +00:00
fi
## Feeders
# Moved execution of functions outside of while loop.
# Inside the while loop the installation scripts are not stopping at reads.
2018-06-26 13:06:46 +00:00
RUN_ADSBEXCHANGE_SCRIPT = "false"
2017-10-02 19:36:29 +00:00
RUN_PIAWARE_SCRIPT = "false"
RUN_FLIGHTRADAR24_SCRIPT = "false"
2024-07-07 19:36:38 +00:00
RUN_FLYITALYADSB_SCRIPT
2018-06-26 13:06:46 +00:00
RUN_OPENSKYNETWORK_SCRIPT = "false"
RUN_PLANEFINDER_SCRIPT = "false"
2016-09-27 01:28:04 +00:00
2024-06-20 17:03:21 +00:00
if [ [ -s " ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES " ] ] ; then
2017-10-02 19:36:29 +00:00
while read FEEDER_CHOICE
2016-09-27 01:28:04 +00:00
do
2017-10-02 19:36:29 +00:00
case ${ FEEDER_CHOICE } in
2024-07-11 02:34:59 +00:00
"ADS-B Exchange Feeder" | "ADS-B Exchange Feeder (reinstall)" )
2018-06-26 13:06:46 +00:00
RUN_ADSBEXCHANGE_SCRIPT = "true"
; ;
2024-06-20 17:51:02 +00:00
"FlightAware PiAware" | "FlightAware PiAware (upgrade)" | "FlightAware PiAware (reinstall)" )
2017-10-02 19:36:29 +00:00
RUN_PIAWARE_SCRIPT = "true"
; ;
2024-06-20 17:51:02 +00:00
"Flightradar24 Client" | "Flightradar24 Client (upgrade)" | "Flightradar24 Client (reinstall)" )
2017-10-02 19:36:29 +00:00
RUN_FLIGHTRADAR24_SCRIPT = "true"
; ;
2024-07-07 22:53:09 +00:00
"Fly Italy ADS-B Feeder" | "Fly Italy ADS-B Feeder (upgrade)" )
2024-07-07 19:36:38 +00:00
RUN_FLYITALYADSB_SCRIPT = "true"
; ;
2018-06-26 13:06:46 +00:00
"OpenSky Network Feeder" )
RUN_OPENSKYNETWORK_SCRIPT = "true"
; ;
2024-06-20 19:24:54 +00:00
"Plane Finder Client" | "Plane Finder Client (upgrade)" | "Plane Finder Client (reinstall)" )
2018-06-26 13:06:46 +00:00
RUN_PLANEFINDER_SCRIPT = "true"
2017-10-02 19:36:29 +00:00
; ;
2016-09-27 01:28:04 +00:00
esac
2017-10-02 19:36:29 +00:00
done < ${ RECEIVER_ROOT_DIRECTORY } /FEEDER_CHOICES
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ RUN_ADSBEXCHANGE_SCRIPT } " = "true" ] ] ; then
2018-06-26 13:06:46 +00:00
InstallAdsbExchange
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ RUN_PIAWARE_SCRIPT } " = "true" || " ${ FORCE_PIAWARE_INSTALL } " = "true" ] ] ; then
2018-06-26 13:06:46 +00:00
InstallPiAware
2016-09-27 01:28:04 +00:00
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ RUN_FLIGHTRADAR24_SCRIPT } " = "true" ] ] ; then
2016-09-27 01:28:04 +00:00
InstallFlightradar24
fi
2024-07-07 19:36:38 +00:00
if [ [ " ${ RUN_FLYITALYADSB_SCRIPT } " = "true" ] ] ; then
InstallFlyItalyAdsb
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ RUN_OPENSKYNETWORK_SCRIPT } " = "true" ] ] ; then
2018-06-26 13:06:46 +00:00
InstallOpenSkyNetwork
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ RUN_PLANEFINDER_SCRIPT } " = "true" ] ] ; then
2018-06-26 13:06:46 +00:00
InstallPlaneFinder
2016-09-27 01:28:04 +00:00
fi
## ADS-B Receiver Project Web Portal
2024-06-20 17:03:21 +00:00
if [ [ " ${ WEBPORTAL_DO_INSTALL } " = "true" ] ] ; then
2016-09-27 01:28:04 +00:00
InstallWebPortal
fi
2017-10-02 19:36:29 +00:00
# Moved execution of functions outside of while loop.
# Inside the while loop the installation scripts are not stopping at reads.
RUN_BEASTSPLITTER_SCRIPT = "false"
RUN_DUCKDNS_SCRIPT = "false"
2024-06-20 17:03:21 +00:00
if [ [ -s " ${ RECEIVER_ROOT_DIRECTORY } /EXTRAS_CHOICES " ] ] ; then
2017-10-02 19:36:29 +00:00
while read EXTRAS_CHOICE
do
case ${ EXTRAS_CHOICE } in
"beast-splitter" | "beast-splitter (reinstall)" )
RUN_BEASTSPLITTER_SCRIPT = "true"
; ;
"Duck DNS Free Dynamic DNS Hosting" | "Duck DNS Free Dynamic DNS Hosting (reinstall)" )
RUN_DUCKDNS_SCRIPT = "true"
; ;
esac
done < ${ RECEIVER_ROOT_DIRECTORY } /EXTRAS_CHOICES
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ RUN_BEASTSPLITTER_SCRIPT } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
InstallBeastSplitter
fi
2024-06-20 17:03:21 +00:00
if [ [ " ${ RUN_DUCKDNS_SCRIPT } " = "true" ] ] ; then
2017-10-02 19:36:29 +00:00
InstallDuckDns
fi
2016-09-27 01:28:04 +00:00
exit 0