Cleaned up flightradar24.sh.

pull/222/head
Joe Prochazka 2016-09-06 16:19:14 -04:00
rodzic 90ca8501b6
commit 00c72de0c5
3 zmienionych plików z 90 dodań i 84 usunięć

Wyświetl plik

@ -9,7 +9,7 @@
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Copyright (c) 2015 Joseph A. Prochazka #
# Copyright (c) 2015-2016 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 #
@ -33,38 +33,48 @@
## VARIABLES
BUILDDIR=$PWD
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
FR24BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build/flightradar24"
source ../bash/variables.sh
source ../bash/functions.sh
### INCLUDE EXTERNAL SCRIPTS
## INFORMATIVE MESSAGE ABOUT THIS SOFTWARE
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
## BEGIN SETUP
clear
echo -e "\033[31m"
echo "-----------------------------------------------------"
echo " Now ready to install the flightradar24 Pi24 Client."
echo "-----------------------------------------------------"
echo -e "\033[33mThe Flightradar24's Pi24 client can track flights within"
echo "200-400 miles and will automatically share data with Flightradar24. You"
echo "can track flights directly off your Pi24 device or via Flightradar24.com"
echo -e "\n\e[91m THE ADS-B RECIEVER PROJECT VERSION $PROJECTVERSION"
echo ""
echo "http://www.flightradar24.com/share-your-data"
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
echo -e "\e[92m Setting up the Flightradar24 feeder client..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[96m"
echo ""
whiptail --title "Flightradar24 Feeder Client Setup" --yesno "The Flightradar24's feeder client can track flights within 200-400 miles and will automatically share data with Flightradar24. You can track flights directly off your device or via Flightradar24.com.\n\n http://www.flightradar24.com/share-your-data\n\nContinue setup by installing the Flightradar24 feeder client?" 13 78
CONTINUESETUP=$?
if [ $CONTINUESETUP = 1 ]; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 1
fi
## CHECK FOR PREREQUISITE PACKAGES
echo -e "\033[33m"
echo "Installing packages needed to build and fulfill dependencies..."
echo -e "\033[37m"
echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m"
echo ""
if [[ `uname -m` == "x86_64" ]]; then
if [[ `lsb_release -si` == "Debian" ]] && [ $(dpkg --print-foreign-architectures $1 2>/dev/null | grep -c "i386") -eq 0 ]; then
echo -e "\033[33mAdding i386 Architecture..."
echo -e "\e[94m Adding the i386 architecture...\e[97m"
sudo dpkg --add-architecture i386
echo "Downloading latest package lists for enabled repositories and PPAs..."
echo -e "\033[37m"
echo -e "\e[94m Downloading latest package lists for enabled repositories and PPAs...\e[97m"
echo ""
sudo apt-get update
echo ""
fi
@ -82,81 +92,75 @@ else
fi
CheckPackage wget
## BEGIN INSTALLATION DEPENDING ON DEVICE ARCHITECTURE
echo ""
echo -e "\e[95m Begining the installation process...\e[97m"
echo ""
# Create the flightradar24 build directory if it does not exist.
if [ ! -d $FR24BUILDDIRECTORY ]; then
echo -e "\e[94m Creating the Flightradar24 feeder client build directory...\e[97m"
mkdir $FR24BUILDDIRECTORY
fi
echo -e "\e[94m Entering the Flightradar24 feeder client build directory...\e[97m"
cd $FR24BUILDDIRECTORY
if [[ `uname -m` == "armv7l" ]] || [[ `uname -m` == "armv6l" ]]; then
## ARM INSTALLATION
echo -e "\033[31m"
echo "------------------------------------------------------"
echo " MAKE SURE TO READ THROUGH THE FOLLOWING INSTRUCTIONS"
echo "------------------------------------------------------"
echo -e "\033[33m"
echo "This script will now download and execute the script provided by Flightradar24."
echo "You will be asked for your email address, the latitude and longitude of your"
echo "receiver as well as its altitude above sea level."
whiptail --title "Plane Finder ADS-B Client Setup Instructions" --msgbox "This script will now download and execute the official Flightradar24 setup script. Follow the instructions provided and supply the required information when ask for by the script.\n\nOnce finished the ADS-B Receiver Project scripts will continue." 11 78
echo -e "\e[94m Detected the device architecture as ARM...\e[97m"
echo -e "\e[94m Downloading the executing the Flightradar24 Pi24 installation script...\e[97m"
echo ""
echo "Latitude and longitude can be calculated by address by my website."
echo "https://www.swiftbyte.com/toolbox/geocode"
echo ""
echo "As for distance abocve sea level I used heywhatsthat.com information."
echo ""
echo "once the Flightradar24 script has completed this script will once again take over."
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
## DOWNLOAD AND EXECUTE THE FLIGHTRADAR24 SCRIPT
sudo bash -c "$(wget -O - http://repo.feed.flightradar24.com/install_fr24_rpi.sh)"
## START THE FLIGHTAWARE24 CLIENT
echo -e "\033[33m"
echo "Starting the flightradar24 feeder client..."
echo -e "\033[37m"
sudo service fr24feed start
echo ""
else
## I386 INSTALLATION
echo -e "\033[33m"
echo "Downloading the Flightradar24 feeder client package..."
echo -e "\033[37m"
wget http://feed.flightradar24.com/linux/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb -O $BUILDDIR/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
echo -e "\033[33m"
echo "Installing the Flightradar24 feeder client package..."
echo -e "\033[37m"
echo -e "\e[94m Detected the device architecture as I386...\e[97m"
echo -e "\e[94m Downloading the Flightradar24 feeder client package...\e[97m"
echo ""
wget http://feed.flightradar24.com/linux/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb -O $FR24BUILDDIRECTORY/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
echo -e "\e[94m Installing the Flightradar24 feeder client package...\e[97m"
if [[ `lsb_release -si` == "Debian" ]]; then
# Force architecture if this is Debian.
sudo dpkg -i --force-architecture $BUILDDIR/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
echo -e "\e[94m NOTE: dpkg executed with added flag --force-architecture.\e[97m"
echo ""
sudo dpkg -i --force-architecture $FR24BUILDDIRECTORY/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
else
sudo dpkg -i $BUILDDIR/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
echo ""
sudo dpkg -i $FR24BUILDDIRECTORY/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
fi
## CHECK THAT THE PACKAGE INSTALLED
echo ""
echo -e "\e[94m Checking that the fr24feed package was installed properly...\e[97m"
if [ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "\033[31m"
echo "#########################################"
echo "# INSTALLATION HALTED! #"
echo "# UNABLE TO INSTALL A REQUIRED PACKAGE. #"
echo "#########################################"
# If the fr24feed package could not be installed halt setup.
echo ""
echo "The fr24feed package did not install properly!"
echo -e "\033[33m"
echo "This script has exited due to the error encountered."
echo "Please read over the above output in order to determine what went wrong."
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE."
echo -e " SETUP HAS BEEN TERMINATED!"
echo ""
kill -9 `ps --pid $$ -oppid=`; exit
echo -e "\e[93mThe package \"fr24feed\" could not be installed.\e[39m"
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 1
fi
fi
## FLIGHTRADAR24 FEEDER CLIENT SETUP COMPLETE
## INSTALLATION COMPLETE
# Enter into the project root directory.
echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m"
cd $PROJECTROOTDIRECTORY
echo -e "\033[33m"
echo "Installation and configuration of flightradar24 feeder client is now complete."
echo "Please look over the output generated to be sure no errors were encountered."
echo -e "\033[37m"
echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 0

Wyświetl plik

@ -90,7 +90,7 @@ CheckPackage wget
echo ""
echo -e "\e[95m Downloading the Plane Finder ADS-B Client package...\e[97m"
echo ""
# Create the plane finder build directory if it does not exist.
# Create the planefinder build directory if it does not exist.
if [ ! -d $PLANEFINDERBUILDDIRECTORY ]; then
echo -e "\e[94m Creating the Plane Finder ADS-B Client build directory...\e[97m"
mkdir $PLANEFINDERBUILDDIRECTORY
@ -126,6 +126,7 @@ else
echo ""
sudo dpkg -i --force-architecture $PLANEFINDERBUILDDIRECTORY/pfclient_${PFCLIENTVERSIONI386}_i386.deb
else
echo ""
sudo dpkg -i $PLANEFINDERBUILDDIRECTORY/pfclient_${PFCLIENTVERSIONI386}_i386.deb
fi
fi

Wyświetl plik

@ -136,13 +136,14 @@ function InstallPlaneFinder() {
# Download and install the Flightradar24 client package.
function InstallFlightradar24() {
clear
cd $BUILDDIR
echo -e "\033[33mExecuting the Flightradar24 client installation script..."
echo -e "\033[37m"
chmod +x $BASHDIR/feeders/flightradar24.sh
$BASHDIR/feeders/flightradar24.sh
cd $BASEDIR
chmod +x $BASHDIRECTORY/feeders/flightradar24.sh
$BASHDIRECTORY/feeders/flightradar24.sh
if [ $? -ne 0 ]; then
echo ""
echo -e "\e[91m ANY FURTHER SETUP AND/OR INSTALLATION REQUESTS HAVE BEEN TERMINIATED\e[39m"
echo ""
exit 1
fi
}
# Setup the ADS-B Exchange feed.