From 953284368518ee2377d3a37d319267c9b5359cd3 Mon Sep 17 00:00:00 2001 From: jprochazka Date: Sun, 21 Jul 2024 23:30:05 -0400 Subject: [PATCH] The FlightRadar24 script now uses new logging functions. --- CHANGELOG.md | 1 + bash/feeders/airplaneslive.sh | 6 +- bash/feeders/flightradar24.sh | 151 ++++++++++++++++------------------ bash/feeders/piaware.sh | 1 - 4 files changed, 76 insertions(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c4fc92..a841880 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The following is a history of the changes made to this project. * Modified the dump978-fa installation script so that it utilizes the new logging functions. * Modified the ADS-B Exchange client installation script so it utilizes the new logging functions. * Modified the airplanes.live client installation script so it utilizes the new logging functions. +* Modified the FlightRadar24 client installation script so it utilizes the new logging functions. * Added the --version and -v arguments in order to display the current project version. ## v2.8.4 *(July 13th, 2024)* :rooster: diff --git a/bash/feeders/airplaneslive.sh b/bash/feeders/airplaneslive.sh index af78f0b..2de023d 100755 --- a/bash/feeders/airplaneslive.sh +++ b/bash/feeders/airplaneslive.sh @@ -34,7 +34,7 @@ whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \ --msgbox "Scripts supplied by airplanes.live will be used in order to install or upgrade this system. Interaction with the script exececuted will be required in order to complete the installation." \ 10 78 -if [[ ! -d $RECEIVER_BUILD_DIRECTORY/adsbexchange ]]; then +if [[ ! -d $RECEIVER_BUILD_DIRECTORY/airplaneslive ]]; then LogMessage "Creating the airplanes.live build directory" echo "" mkdir -vp $RECEIVER_BUILD_DIRECTORY/airplaneslive @@ -45,7 +45,7 @@ cd $RECEIVER_BUILD_DIRECTORY/airplaneslive LogMessage "Downloading the airplanes.live client installation script" echo "" -wget -O $RECEIVER_BUILD_DIRECTORY/airplaneslive/install.sh https://raw.githubusercontent.com/airplanes-live/feed/main/install.sh +wget -v -O $RECEIVER_BUILD_DIRECTORY/airplaneslive/install.sh https://raw.githubusercontent.com/airplanes-live/feed/main/install.sh echo "" LogMessage "Executing the airplanes.live client installation script" @@ -54,7 +54,7 @@ sudo bash $RECEIVER_BUILD_DIRECTORY/airplaneslive/install.sh echo "" -## CHECK THE STATUS OF THE FEEDER +## CHECK THE STATUS OF THE CLIENT LogHeading "Checking if the reciver is now feeding airplanes.live" diff --git a/bash/feeders/flightradar24.sh b/bash/feeders/flightradar24.sh index 92d3b10..dff479b 100755 --- a/bash/feeders/flightradar24.sh +++ b/bash/feeders/flightradar24.sh @@ -1,105 +1,98 @@ #!/bin/bash -## INCLUDE EXTERNAL SCRIPTS +## PRE INSTALLATION OPERATIONS source $RECEIVER_BASH_DIRECTORY/variables.sh source $RECEIVER_BASH_DIRECTORY/functions.sh - -## BEGIN SETUP - clear -echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}" -echo -e "" -echo -e "\e[92m Setting up FlightRadar24 feeder client..." -echo -e "" -echo -e "\e[93m ------------------------------------------------------------------------------\e[96m" -echo -e "" +LogProjectName ${RECEIVER_PROJECT_TITLE} +LogTitleHeading "Setting up the FlightRadar24 client" +LogTitleMessage "------------------------------------------------------------------------------" +echo "" -# Confirm component installation. -if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "FlightRadar24 feeder client Setup" --yesno "The FlightRadar24 feeder client takes data from a local dump1090 instance and shares this with FlightRadar24 using the fr24feed package, for more information please see their website:\n\n https://www.flightradar24.com/share-your-data\n\nContinue setup by installing the FlightRadar24 feeder client?" 13 78 3>&1 1>&2 2>&3; then - echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m" - echo -e " Setup has been halted at the request of the user." - echo -e "" - echo -e "\e[93m ------------------------------------------------------------------------------" - echo -e "\e[92m FlightRadar24 feeder client setup halted.\e[39m" - echo -e "" +if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \ + --title "FlightRadar24 feeder client Setup" \ + --yesno "The FlightRadar24 feeder client takes data from a local dump1090 instance and shares this with FlightRadar24 using the fr24feed package, for more information please see their website:\n\n https://www.flightradar24.com/share-your-data\n\nContinue setup by installing the FlightRadar24 feeder client?" \ + 13 78; then + LogAlertHeading "INSTALLATION HALTED" + LogAlertMessage "Setup has been halted at the request of the user" + echo "" + LogTitleMessage "------------------------------------------------------------------------------" + LogTitleHeading "FlightRadar24 client setup halted" + echo "" + exit 1 +fi + + +## DOWNLOAD AND EXECUTE THE FLIGHTRADAR24 CLIENT INSTALL SCRIPT + +LogHeading "Begining the FlightRadar24 client installation process" + +if [[ ! -d $RECEIVER_BUILD_DIRECTORY/flightradar24 ]]; then + LogMessage "Creating the FlightRadar24 build directory" + echo "" + mkdir -vp $RECEIVER_BUILD_DIRECTORY/flightradar24 + echo "" +fi +LogMessage "Entering the FlightRadar24 build directory" +cd $RECEIVER_BUILD_DIRECTORY/flightradar24 + +LogMessage "Downloading the airplanes.live client installation script" +echo "" +wget -v -O $RECEIVER_BUILD_DIRECTORY/flightradar24/install.sh https://fr24.com/install.sh +echo "" + +LogMessage "Executing the airplanes.live client installation script" +echo "" +sudo bash $RECEIVER_BUILD_DIRECTORY/flightradar24/install.sh +echo "" + + +## CHECK THE STATUS OF THE CLIENT + +LogHeading "Checking if the FlightRadar24 client was installed successfully" + +echo -e "\e[94m Checking that the FlightRadar24 client package was installed" +if [[ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then + echo "" + LogAlertHeading "INSTALLATION HALTED" + echo "" + LogAlertMessage "FlightRadar24 package installation failed" + LogAlertMessage "Setup has been terminated" + echo "" + LogTitleMessage "------------------------------------------------------------------------------" + LogTitleHeading "FlightRadar24 client setup failed" + echo "" read -p "Press enter to continue..." discard exit 1 fi -## START INSTALLATION +## POST INSTALLATION OPERATIONS -echo -e "" -echo -e "\e[95m Begining the FlightRadar24 feeder client installation process...\e[97m" -echo -e "" +LogHeading "Performing post installation operations" -# Create the component build directory if it does not exist -if [[ ! -d $RECEIVER_BUILD_DIRECTORY/flightradar24 ]]; then - echo -e "\e[94m Creating the FlightRadar24 feeder client build directory...\e[97m" - echo "" - mkdir -vp $RECEIVER_BUILD_DIRECTORY/flightradar24 - echo "" -fi - -# Change to the component build directory -echo -e "\e[94m Entering the FlightRadar24 feeder client build directory...\e[97m" -cd $RECEIVER_BUILD_DIRECTORY/flightradar24 2>&1 -echo "" - -# Download the official Flightradar24 installation script -echo -e "\e[95m Beginning the Flightradar24 client installation...\e[97m" -echo -e "" - -echo -e "\e[94m Downloading the Flightradar24 client installation script...\e[97m" -echo "" -wget -v https://fr24.com/install.sh - -echo -e "\e[94m Executing the Flightradar24 client installation script...\e[97m" -echo "" -sudo bash $RECEIVER_BUILD_DIRECTORY/flightradar24/install.sh -echo "" - -# Check that the component package was installed successfully. -echo -e "\e[94m Checking that the FlightRadar24 feeder client package was installed properly...\e[97m" - -if [[ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then - echo -e "" - echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m" - echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE." - echo -e " SETUP HAS BEEN TERMINATED!" - echo -e "" - echo -e "\e[93mThe package \"fr24feed\" could not be installed.\e[39m" - echo -e "" - echo -e "\e[93m ------------------------------------------------------------------------------" - echo -e "\e[92m FlightRadar24 feeder client setup halted.\e[39m" - echo -e "" - read -p "Press enter to continue..." CONTINUE - exit 1 -fi - - -## COMPONENT POST INSTALL ACTIONS - -# If sharing to other networks alongside Flightradar24 make sure MLAT is disabled -echo -e "\e[94m Flightradar24 asks that MLAT be disabled if sharing with other networks...\e[97m" +LogMessage "Flightradar24 asks that MLAT be disabled if sharing with other networks" ChangeConfig "mlat" "no" "/etc/fr24feed.ini" ChangeConfig "mlat-without-gps" "no" "/etc/fr24feed.ini" -echo -e "\e[94m Restarting the Flightradar24 client...\e[97m" +LogMessage "Restarting the Flightradar24 client" sudo systemctl restart fr24feed +LogWarningMessage "If the Flightradar24 client is the only feeder utilizing MLAT execute the following commands to enable MLAT" +LogWarningMessage 'sudo sed -i -e "s/\(mlat *= *\).*/\1\"yes\"/" /etc/fr24feed.ini' +LogWarningMessage 'sudo sed -i -e "s/\(mlat-without-gps *= *\).*/\1\"yes\"/" /etc/fr24feed.ini' + ## SETUP COMPLETE -# Return to the project root directory -echo -e "\e[94m Returning to ${RECEIVER_PROJECT_TITLE} root directory...\e[97m" -cd $RECEIVER_ROOT_DIRECTORY 2>&1 +LogMessage "Returning to ${RECEIVER_PROJECT_TITLE} root directory" +cd $RECEIVER_ROOT_DIRECTORY -echo -e "" -echo -e "\e[93m ------------------------------------------------------------------------------" -echo -e "\e[92m FlightRadar24 feeder client setup is complete.\e[39m" -echo -e "" +echo "" +LogTitleMessage "------------------------------------------------------------------------------" +LogTitleHeading "FlightRadar24 client setup is complete" +echo "" read -p "Press enter to continue..." discard exit 0 diff --git a/bash/feeders/piaware.sh b/bash/feeders/piaware.sh index 4bbed54..968bbe2 100755 --- a/bash/feeders/piaware.sh +++ b/bash/feeders/piaware.sh @@ -206,7 +206,6 @@ echo "" LogMessage "Checking that the FlightAware PiAware client package was installed properly" if [[ $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then - echo "" LogAlertHeading "INSTALLATION HALTED" echo "" LogAlertMessage "FlightAware PiAware package installation failed"