Scripts now exit when package error occurs.

pull/113/head
Joe Prochazka 2016-03-07 11:44:26 -05:00
rodzic 1aba8d1cb1
commit e6c6a67292
6 zmienionych plików z 153 dodań i 34 usunięć

Wyświetl plik

@ -104,12 +104,17 @@ sudo dpkg -i dump1090-mutability_1.15~dev_*.deb
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 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 "#########################################"
echo ""
echo "The dump1090-mutability 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 ""
exit 1
kill -9 `ps --pid $$ -oppid=`; exit
fi
## CONFIGURE LIGHTTPD

Wyświetl plik

@ -35,6 +35,7 @@
BUILDDIR=$PWD
source ../bash/variables.sh
source ../bash/functions.sh
## INFORMATIVE MESSAGE ABOUT THIS SOFTWARE
@ -55,36 +56,102 @@ read -p "Press enter to continue..." CONTINUE
## CHECK FOR PREREQUISITE PACKAGES
echo -e "\033[33m"
echo "Installing packages needed to build and fulfill dependencies..."
echo -e "\033[37m"
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..."
sudo dpkg --add-architecture i386
echo "Downloading latest package lists for enabled repositories and PPAs..."
echo -e "\033[37m"
sudo apt-get update
echo ""
fi
CheckPackage libc6:i386
CheckPackage libudev1:i386
CheckPackage zlib1g:i386
CheckPackage libusb-1.0-0:i386
CheckPackage libstdc++6:i386:i386
else
CheckPackage libc6
CheckPackage libudev1
CheckPackage zlib1g
CheckPackage libusb-1.0-0
CheckPackage libstdc++6
fi
CheckPackage wget
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."
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
if [[ `uname -m` == "armv7l" ]]; then
sudo bash -c "$(wget -O - http://repo.feed.flightradar24.com/install_fr24_rpi.sh)"
## ARMV71 INSTALLATION
## START THE FLIGHTAWARE24 CLIENT
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."
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
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"
if [[ `lsb_release -si` == "Debian" ]]; then
# Force architecture if this is Debian.
sudo dpkg -i --force-architecture $BUILDDIR/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
else
sudo dpkg -i $BUILDDIR/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
fi
## CHECK THAT THE PACKAGE INSTALLED
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 "#########################################"
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 ""
kill -9 `ps --pid $$ -oppid=`; exit
fi
fi
echo -e "\033[33m"
echo "Starting the flightradar24 feeder client..."
echo -e "\033[37m"
sudo service fr24feed start
## INSTALLATION COMPLETE

Wyświetl plik

@ -123,12 +123,17 @@ sudo dpkg -i $PIAWAREDIR/piaware_${PIAWAREVERSION}_*.deb
if [ $(dpkg-query -W -f='${STATUS}' piaware 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 "#########################################"
echo ""
echo "The piaware 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 ""
exit 1
kill -9 `ps --pid $$ -oppid=`; exit
fi
## CONFIGURE FLIGHTAWARE

Wyświetl plik

@ -106,12 +106,17 @@ fi
if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "\033[31m"
echo "The piaware package did not install properly!"
echo "#########################################"
echo "# INSTALLATION HALTED! #"
echo "# UNABLE TO INSTALL A REQUIRED PACKAGE. #"
echo "#########################################"
echo ""
echo "The pfclient 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 ""
exit 1
kill -9 `ps --pid $$ -oppid=`; exit
fi
## DISPLAY FINAL SETUP INSTRUCTIONS WHICH CONNOT BE HANDLED BY THIS SCRIPT

Wyświetl plik

@ -40,3 +40,6 @@ PIAWAREBRANCH="5c77c4924"
# PlaneFinder ADS-B Client
PFCLIENTVERSIONARM="3.3.222"
PFCLIENTVERSIONI386="3.3.222"
# Flightradar24 Linux Debian package
FR24CLIENTVERSIONI386="1.0.18-5"

Wyświetl plik

@ -129,6 +129,17 @@ function InstallPlaneFinder() {
cd $BASEDIR
}
# 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
}
# Setup the ADS-B Exchange feed.
function InstallAdsbExchange() {
clear
@ -327,12 +338,9 @@ if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed
else
# Set version depending on the device architecture.
PFCLIENTVERSION=$PFCLIENTVERSIONARM
## The i386 version even though labeled as 3.1.201 is in fact reported as 3.0.2080.
## So for now we will skip the architecture check and use the ARM version variable for both.
#if [[ `uname -m` != "armv7l" ]]; then
# PFCLIENTVERSION=$PFCLIENTVERSIONI386
#fi
if [[ `uname -m` != "armv7l" ]]; then
PFCLIENTVERSION=$PFCLIENTVERSIONI386
fi
# Check if a newer version can be installed.
if [ $(sudo dpkg -s pfclient 2>/dev/null | grep -c "Version: ${PFCLIENTVERSION}") -eq 0 ]; then
@ -340,6 +348,18 @@ else
fi
fi
# Check if the Flightradar24 client package is installed.
if [ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
# The Flightradar24 client package appear to be installed.
FEEDERLIST=("${FEEDERLIST[@]}" 'Flightradar24 Client' '' OFF)
else
if [[ `uname -m` != "armv7l" ]]; then
if [ $(sudo dpkg -s fr24feed 2>/dev/null | grep -c "Version: ${FR24CLIENTVERSIONI386}") -eq 0 ]; then
FEEDERLIST=("${FEEDERLIST[@]}" 'Flightradar24 Client (upgrade)' '' OFF)
fi
fi
fi
# Check if ADS-B Exchange sharing has been set up.
if ! grep -q "${BUILDDIR}/adsbexchange/adsbexchange-maint.sh &" /etc/rc.local; then
# The ADS-B Exchange maintainance script does not appear to be executed on start up.
@ -430,6 +450,12 @@ if [ $DUMP1090CHOICE = 0 ] || [ $DUMP978CHOICE = 0 || [ $DOINSTALLWEBPORTAL = 0
"Plane Finder ADS-B Client (upgrade)")
CONFIRMATION="${CONFIRMATION}\n * Plane Finder ADS-B Client (upgrade)"
;;
"Flightradar24 Client")
CONFIRMATION="${CONFIRMATION}\n * Flightradar24 Client"
;;
"Flightradar24 Client (upgrade)")
CONFIRMATION="${CONFIRMATION}\n * Flightradar24 Client (upgrade)"
;;
"ADS-B Exchange Script")
CONFIRMATION="${CONFIRMATION}\n * ADS-B Exchange Script"
;;
@ -488,6 +514,7 @@ fi
# Inside the while loop the installation scripts are not stopping at reads.
RUNPIAWARESCRIPT=1
RUNPLANEFINDERSCRIPT=1
RUNFLIGHTRADAR24SCRIPT=1
RUNADSBEXCHANGESCRIPT=1
if [ -s FEEDERCHOICES ]; then
@ -500,6 +527,9 @@ if [ -s FEEDERCHOICES ]; then
"Plane Finder ADS-B Client"|"Plane Finder ADS-B Client (upgrade)")
RUNPLANEFINDERSCRIPT=0
;;
"Flightradar24 Client"|"Flightradar24 Client (upgrade)")
RUNFLIGHTRADAR24SCRIPT=0
;;
"ADS-B Exchange Script")
RUNADSBEXCHANGESCRIPT=0
;;
@ -515,6 +545,10 @@ if [ $RUNPLANEFINDERSCRIPT = 0 ]; then
InstallPlaneFinder
fi
if [ $RUNFLIGHTRADAR24SCRIPT = 0 ]; then
InstallFlightradar24
fi
if [ $RUNADSBEXCHANGESCRIPT = 0 ]; then
InstallAdsbExchange
fi