kopia lustrzana https://github.com/jprochazka/adsb-receiver
Began shell script cleanup.
rodzic
5726025300
commit
59b7ee07cb
|
@ -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 #
|
||||
|
@ -31,49 +31,39 @@
|
|||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
BUILDDIR=$PWD
|
||||
DUMP1090DIR="$BUILDDIR/dump1090"
|
||||
### VARIABLES
|
||||
|
||||
source ../bash/functions.sh
|
||||
PROJECTROOTDIRECTORY="$PWD"
|
||||
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
|
||||
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
|
||||
DUMP1090BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build/dump1090"
|
||||
|
||||
### INCLUDE EXTERNAL SCRIPTS
|
||||
|
||||
source $BASHDIRECTORY/variables.sh
|
||||
source $BASHDIRECTORY/functions.sh
|
||||
|
||||
## BEGIN SETUP
|
||||
|
||||
clear
|
||||
|
||||
echo -e "\033[31m"
|
||||
echo "-------------------------------------------"
|
||||
echo " Now ready to install dump1090-mutability."
|
||||
echo "-------------------------------------------"
|
||||
echo -e "\033[33mDump 1090 is a Mode S decoder specifically designed for RTLSDR devices."
|
||||
echo "Dump1090-mutability is a fork of MalcolmRobb's version of dump1090 that adds new"
|
||||
echo "functionality and is designed to be built as a Debian/Raspbian package."
|
||||
echo -e "\n\e[91m THE ADS-B RECIEVER PROJECT VERSION $PROJECTVERSION"
|
||||
echo ""
|
||||
echo "https://github.com/mutability/dump1090"
|
||||
echo -e "\033[37m"
|
||||
echo -e "\e[92m Setting up dump1090-mutability..."
|
||||
echo -e "\e[93m------------------------------------------------------------------------------\e[96m"
|
||||
echo ""
|
||||
echo " Dump 1090 is a Mode S decoder specifically designed for RTLSDR devices."
|
||||
echo " Dump1090-mutability is a fork of MalcolmRobb's version of dump1090 that adds"
|
||||
echo " new functionality and is designed to be built as a Debian/Raspbian package."
|
||||
echo ""
|
||||
echo " https://github.com/mutability/dump1090"
|
||||
echo -e "\e[39m"
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
|
||||
## ASK WHICH WEB SERVER TO INSTALL
|
||||
|
||||
# Commented out temporarily until choice has been added to
|
||||
# the portal installations scipt as well.
|
||||
|
||||
#echo -e "\033[31m"
|
||||
#echo "Select Web Server"
|
||||
#echo -e "\033[33m"
|
||||
#echo "Select the web server you wish to use."
|
||||
#echo "Currently Lighttpd is the recommended web server."
|
||||
#echo ""
|
||||
#echo " 1) Lighttpd"
|
||||
#echo " 2) Nginx"
|
||||
#echo -e "\033[37m"
|
||||
#read -p "Which web server do you wish to use? [1] " WEBSERVER
|
||||
|
||||
# For now we will force Lighttpd as the web server chosen.
|
||||
WEBSERVER=1
|
||||
|
||||
## CHECK FOR PREREQUISITE PACKAGES
|
||||
|
||||
echo -e "\033[33m"
|
||||
echo "Installing packages needed to build and fulfill dependencies..."
|
||||
echo -e "\033[37m"
|
||||
echo ""
|
||||
echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m"
|
||||
echo ""
|
||||
CheckPackage git
|
||||
CheckPackage curl
|
||||
CheckPackage build-essential
|
||||
|
@ -83,49 +73,67 @@ CheckPackage rtl-sdr
|
|||
CheckPackage librtlsdr-dev
|
||||
CheckPackage libusb-1.0-0-dev
|
||||
CheckPackage pkg-config
|
||||
|
||||
if [[ $WEBSERVER != "2" ]]; then
|
||||
CheckPackage lighttpd
|
||||
else
|
||||
CheckPackage nginx
|
||||
fi
|
||||
|
||||
CheckPackage lighttpd
|
||||
CheckPackage fakeroot
|
||||
|
||||
## DOWNLOAD OR UPDATE THE DUMP1090-MUTABILITY SOURCE
|
||||
|
||||
# Check if the git repository already exists locally.
|
||||
if [ -d $DUMP1090DIR ] && [ -d $DUMP1090DIR/.git ]; then
|
||||
# A directory with a git repository containing the source code exists.
|
||||
echo -e "\033[33m"
|
||||
echo "Updating the local dump1090-mutability git repository..."
|
||||
echo -e "\033[37m"
|
||||
cd $DUMP1090DIR
|
||||
git pull origin master
|
||||
echo ""
|
||||
echo -e "\e[95m Prepare the dump1090-mutability Git repository...\e[97m"
|
||||
echo ""
|
||||
if [ -d $DUMP1090BUILDDIRECTORY ] && [ -d $DUMP1090BUILDDIRECTORY/.git ]; then
|
||||
# A directory with a git repository containing the source code already exists.
|
||||
echo -e "\e[94m Entering the dump1090-mutability git repository directory...\e[97m"
|
||||
cd $DUMP1090BUILDDIRECTORY
|
||||
echo -e "\e[94m Updating the local dump1090-mutability git repository...\e[97m"
|
||||
echo ""
|
||||
git pull
|
||||
else
|
||||
# A directory containing the source code does not exist in the build directory.
|
||||
echo -e "\033[33m"
|
||||
echo "Cloning the dump1090-mutability git repository locally..."
|
||||
echo -e "\033[37m"
|
||||
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
|
||||
cd $BUILDDIRECTORY
|
||||
echo -e "\e[94m Cloning the dump1090-mutability git repository locally...\e[97m"
|
||||
echo ""
|
||||
git clone https://github.com/mutability/dump1090.git
|
||||
echo ""
|
||||
fi
|
||||
|
||||
## BUILD THE DUMP1090-MUTABILITY PACKAGE
|
||||
|
||||
echo -e "\033[33m"
|
||||
echo "Building the dump1090-mutability package..."
|
||||
echo -e "\033[37m"
|
||||
cd $DUMP1090DIR
|
||||
echo ""
|
||||
echo -e "\e[95m Building the dump1090-mutability package...\e[97m"
|
||||
echo ""
|
||||
if [ ! $PWD = $DUMP1090BUILDDIRECTORY ]; then
|
||||
echo -e "\e[94m Entering the dump1090-mutability git repository directory...\e[97m"
|
||||
cd $DUMP1090BUILDDIRECTORY
|
||||
fi
|
||||
echo -e "\e[94m Building the dump1090-mutability package...\e[97m"
|
||||
echo ""
|
||||
dpkg-buildpackage -b
|
||||
|
||||
## INSTALL THE DUMP1090-MUTABILITY PACKAGE
|
||||
|
||||
echo -e "\033[33m"
|
||||
echo "Installing the dump1090-mutability package..."
|
||||
echo -e "\033[37m"
|
||||
cd $BUILDDIR
|
||||
echo ""
|
||||
echo -e "\e[95m Installing the dump1090-mutability package...\e[97m"
|
||||
echo ""
|
||||
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
|
||||
cd $BUILDDIRECTORY
|
||||
echo -e "\e[94m Installing the dump1090-mutability package......\e[97m"
|
||||
echo ""
|
||||
sudo dpkg -i dump1090-mutability_1.15~dev_*.deb
|
||||
|
||||
#########################
|
||||
|
||||
echo ""
|
||||
echo -e "\e[93m------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m Dump1090-mutability setup is complete.\e[39m"
|
||||
|
||||
echo -e "\e[97m"
|
||||
cd $PROJECTROOTDIRECTORY
|
||||
exit 0
|
||||
|
||||
#########################
|
||||
|
||||
## CHECK THAT THE PACKAGE INSTALLED
|
||||
|
||||
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
|
||||
|
|
|
@ -43,39 +43,38 @@ function CheckPackage {
|
|||
|
||||
# If the maximum attempts has been reached...
|
||||
if [ $ATTEMPT -gt $MAXATTEMPTS ]; then
|
||||
echo -e "\033[31m"
|
||||
echo "#########################################"
|
||||
echo "# INSTALLATION HALTED! #"
|
||||
echo "# UNABLE TO INSTALL A REQUIRED PACKAGE. #"
|
||||
echo "#########################################"
|
||||
echo -e "\033[33m"
|
||||
echo "The package \"$1\" could not be installed in $MAXATTEMPTS attempts."
|
||||
echo -e "\033[37m"
|
||||
echo ""
|
||||
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
|
||||
echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE."
|
||||
echo -e " SETUP HAS BEEN TERMINATED!"
|
||||
echo ""
|
||||
echo -e "\e[93mThe package \"$1\" could not be installed in $MAXATTEMPTS attempts.\e[39m"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the package is already installed.
|
||||
printf "\033[33mChecking if the package $1 is installed..."
|
||||
printf "\e[94m Checking if the package $1 is installed..."
|
||||
if [ $(dpkg-query -W -f='${STATUS}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
|
||||
|
||||
# If this is not the first attempt at installing this package...
|
||||
if [ $ATTEMPT -gt 1 ]; then
|
||||
echo -e "\033[31m [PREVIOUS INSTALLATION FAILED]"
|
||||
echo -e "\033[33mAttempting to Install the package $1 again in $WAITTIME seconds (ATTEMPT $ATTEMPT OF $MAXATTEMPTS)..."
|
||||
echo -e "\e[91m \e[5m[INSTALLATION ATTEMPT FAILED]\e[25m"
|
||||
echo -e "\e[94m Attempting to Install the package $1 again in $WAITTIME seconds (ATTEMPT $ATTEMPT OF $MAXATTEMPTS)..."
|
||||
sleep $WAITTIME
|
||||
else
|
||||
echo -e "\033[31m [NOT INSTALLED]"
|
||||
echo -e "\033[33mInstalling the package $1..."
|
||||
echo -e "\e[91m [NOT INSTALLED]"
|
||||
echo -e "\e[94m Installing the package $1..."
|
||||
fi
|
||||
|
||||
# Attempt to install the required package.
|
||||
echo -e "\033[37m"
|
||||
echo -e "\e[97m"
|
||||
ATTEMPT=$((ATTEMPT+1))
|
||||
sudo apt-get install -y $1
|
||||
echo ""
|
||||
echo -e "\e[39m"
|
||||
else
|
||||
# The package appears to be installed.
|
||||
echo -e "\033[32m [OK]\033[37m"
|
||||
echo -e "\e[92m [OK]\e[39m"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
|
||||
## SOFTWARE VERSIONS
|
||||
|
||||
# The ADS-B Receiver Project
|
||||
PROJECTVERSION="2.1.1"
|
||||
|
||||
# FlightAware PiAware
|
||||
PIAWAREVERSION="3.0.5"
|
||||
|
||||
|
|
85
install.sh
85
install.sh
|
@ -12,7 +12,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 #
|
||||
|
@ -36,64 +36,61 @@
|
|||
|
||||
## VARIABLES
|
||||
|
||||
BASEDIR=$PWD
|
||||
BASHDIR="$BASEDIR/bash"
|
||||
BUILDDIR="$BASEDIR/build"
|
||||
PROJECTROOTDIRECTORY="$PWD"
|
||||
BASHDIRECTORY="$PWD/bash"
|
||||
BUILDDIRECTORY="$PWD/build"
|
||||
|
||||
source $BASHDIR/variables.sh
|
||||
source $BASHDIR/functions.sh
|
||||
source $BASHDIRECTORY/variables.sh
|
||||
source $BASHDIRECTORY/functions.sh
|
||||
|
||||
## CHECK IF FIRST RUN USING IMAGE
|
||||
|
||||
if [ -f $BASEDIR/image ]; then
|
||||
# Execute image setup script.
|
||||
chmod +x $BASHDIR/image.sh
|
||||
$BASHDIR/image.sh
|
||||
|
||||
# Exit scripts once the the image setup script has completed.
|
||||
echo -e "\033[32m"
|
||||
echo "Image setup complete."
|
||||
echo -e "\033[33m"
|
||||
echo "At any time you can execute install.sh to add additional features"
|
||||
echo "or update existing packages installed on this device."
|
||||
echo -e "\033[37m"
|
||||
## CHECK IF THIS IS THE FIRST RUN USING THE IMAGE RELEASE
|
||||
|
||||
if [ -f $PROJECTROOTDIRECTORY/image ]; then
|
||||
# Execute image setup script..
|
||||
chmod +x $BASHDIRECTORY/image.sh
|
||||
$BASHDIRECTORY/image.sh
|
||||
exit 0
|
||||
fi
|
||||
|
||||
## FUNCTIONS
|
||||
|
||||
# Download the latest package lists for enabled repositories and PPAs.
|
||||
# UPDATE REPOSITORY PACKAGE LISTS.
|
||||
function AptUpdate() {
|
||||
clear
|
||||
echo -e "\033[33m"
|
||||
echo "Downloading latest package lists for enabled repositories and PPAs..."
|
||||
echo -e "\033[37m"
|
||||
echo -e "\n\e[91m THE ADS-B RECIEVER PROJECT VERSION $PROJECTVERSION"
|
||||
echo ""
|
||||
echo -e "\e[92m Downloading the latest package lists for all enabled repositories and PPAs..."
|
||||
echo -e "\e[93m------------------------------------------------------------------------------------\e[97m"
|
||||
echo ""
|
||||
sudo apt-get update
|
||||
}
|
||||
|
||||
# Update the operating system.
|
||||
function UpdateOperatingSystem() {
|
||||
clear
|
||||
echo -e "\033[33m"
|
||||
echo "Downloading and installing the latest updates for your operating system..."
|
||||
echo -e "\033[37m"
|
||||
sudo apt-get -y upgrade
|
||||
echo -e "\033[33m"
|
||||
echo "Your system should now be up to date."
|
||||
echo -e "\033[37m"
|
||||
echo ""
|
||||
echo -e "\e[93m------------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m Finished downloading and updating package lists.\e[39m"
|
||||
echo ""
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
}
|
||||
|
||||
# Download, build and then install the dump1090-mutability package.
|
||||
function InstallDump1090() {
|
||||
# UPDATE THE OPERATING SYSTEM.
|
||||
function UpdateOperatingSystem() {
|
||||
clear
|
||||
cd $BUILDDIR
|
||||
echo -e "\033[33mExecuting the dump1090-mutability installation script..."
|
||||
echo -e "\033[37m"
|
||||
chmod +x $BASHDIR/decoders/dump1090-mutability.sh
|
||||
$BASHDIR/decoders/dump1090-mutability.sh
|
||||
cd $BASEDIR
|
||||
echo -e "\n\e[91m THE ADS-B RECIEVER PROJECT VERSION $PROJECTVERSION"
|
||||
echo ""
|
||||
echo -e "\e[92m Downloading and installing the latest updates for your operating system..."
|
||||
echo -e "\e[93m---------------------------------------------------------------------------------\e[97m"
|
||||
echo ""
|
||||
sudo apt-get -y upgrade
|
||||
echo ""
|
||||
echo -e "\e[93m---------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m Your operating system should now be up to date.\e[39m"
|
||||
echo ""
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
}
|
||||
|
||||
# DUMP1090-MUTABILITY
|
||||
function InstallDump1090() {
|
||||
# Execute the dump1090-mutability setup script.
|
||||
chmod +x $BASHDIRECTORY/decoders/dump1090-mutability.sh
|
||||
$BASHDIRECTORY/decoders/dump1090-mutability.sh
|
||||
}
|
||||
|
||||
# Download and build dump978.
|
||||
|
|
Ładowanie…
Reference in New Issue