Attempting to resync with origin 2.6.0

pull/283/head
Romeo-Golf 2016-12-21 20:47:55 +00:00
commit b591dcb853
22 zmienionych plików z 1225 dodań i 236 usunięć

Wyświetl plik

@ -2,6 +2,13 @@
The following is a history of the changes made to this project.
## v2.6.0
* Added the ability to install beast-splitter as an extra.
* Added the ability to setup Duck DNS dynamic DNS service as an extra.
* Added the ability to setup the AboveTustin Twitter bot.
* A log file can be kept by using either the -l or --log-output switch.
## v2.5.0 *(December 5th, 2016)*
* Can now specify the unit of measurement for dump1090-mutability during setup.

Wyświetl plik

@ -61,7 +61,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-fa setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -139,7 +141,9 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok instal
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-fa setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -191,6 +195,8 @@ echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-fa setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -61,7 +61,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-mutability setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -137,7 +139,9 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-mutability setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -239,6 +243,8 @@ echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-mutability setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -61,7 +61,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump978 setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -126,7 +128,9 @@ if [ ! -f $DUMP978BUILDDIRECTORY/dump978 ] || [ ! -f $DUMP978BUILDDIRECTORY/uat2
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump978 setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -255,6 +259,8 @@ echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump978 setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -31,9 +31,22 @@
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
BUILDDIR=$PWD
### VARIABLES
source ../bash/functions.sh
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
BUILDDIRECTORY_RTLSDROGN="$BUILDDIRECTORY/rtlsdr-ogn"
DECODER_NAME="RTLSDR-OGN"
DECODER_WEBSITE="http://wiki.glidernet.org"
### INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
### BEGIN SETUP
clear
@ -43,21 +56,27 @@ echo -e "\033[31mBEFORE CONTINUING:\033[33m"
echo "RTLSDR-OGN requires it's own dedicated dongle."
echo ""
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
## CHECK FOR PREREQUISITE PACKAGES
### CHECK FOR PREREQUISITE PACKAGES
CheckPackage git
CheckPackage wget
CheckPackage rtl-sdr
CheckPackage librtlsdr-dev
CheckPackage libusb-1.0-0-dev
CheckPackage libconfig-dev
CheckPackage fftw3-dev
CheckPackage libfftw3-dev
CheckPackage libjpeg8
CheckPackage libjpeg-dev
CheckPackage libconfig9
CheckPackage procserv
CheckPackage telnet
CheckPackage wget
CheckPackage lynx
## BLACKLIST UNWANTED RTL-SDR MODULES FROM BEING LOADED
### BLACKLIST UNWANTED RTL-SDR MODULES FROM BEING LOADED
echo -e "\033[33mStopping unwanted kernel modules from being loaded..."
echo -e "\033[37m"
@ -71,48 +90,62 @@ blacklist rtl2830
blacklist rtl2832
EOF
## DOWNLOAD AND SET UP THE BINARIES
### CHECK FOR EXISTING INSTALL AND IF SO STOP IT
if [[ -f /etc/init.d/rtlsdr-ogn ]] ; then
sudo service rtlsdr-ogn stop
fi
### DOWNLOAD AND SET UP THE BINARIES
# Create build directory if not already present.
if [[ ! -d ${BUILDDIRECTORY_RTLSDROGN} ]] ; then
mkdir ${BUILDDIRECTORY_RTLSDROGN}
fi
cd ${BUILDDIRECTORY_RTLSDROGN}
# Download and extract the proper binaries.
case `uname -m` in
"armv6l")
# Raspberry Pi 1
wget http://download.glidernet.org/rpi-gpu/rtlsdr-ogn-bin-RPI-GPU-latest.tgz -O $BUILDDIR/rtlsdr-ogn-bin-RPI-GPU-latest.tgz
tar xvzf rtlsdr-ogn-bin-RPI-GPU-latest.tgz -C $BUILDDIR
wget http://download.glidernet.org/rpi-gpu/rtlsdr-ogn-bin-RPI-GPU-latest.tgz -O $BUILDDIRECTORY_RTLSDROGN/rtlsdr-ogn-bin-RPI-GPU-latest.tgz
tar xvzf rtlsdr-ogn-bin-RPI-GPU-latest.tgz -C $BUILDDIRECTORY_RTLSDROGN
;;
"armv7l")
# Raspberry Pi 2
wget http://download.glidernet.org/arm/rtlsdr-ogn-bin-ARM-latest.tgz -O $BUILDDIR/rtlsdr-ogn-bin-ARM-latest.tgz
tar xvzf rtlsdr-ogn-bin-ARM-latest.tgz -C $BUILDDIR
wget http://download.glidernet.org/arm/rtlsdr-ogn-bin-ARM-latest.tgz -O $BUILDDIRECTORY_RTLSDROGN/rtlsdr-ogn-bin-ARM-latest.tgz
tar xvzf rtlsdr-ogn-bin-ARM-latest.tgz -C $BUILDDIRECTORY_RTLSDROGN
;;
"x86_64")
# 64 Bit
wget http://download.glidernet.org/x64/rtlsdr-ogn-bin-x64-latest.tgz -O $BUILDDIR/rtlsdr-ogn-bin-x64-latest.tgz
tar xvzf rtlsdr-ogn-bin-x64-latest.tgz -C $BUILDDIR
wget http://download.glidernet.org/x64/rtlsdr-ogn-bin-x64-latest.tgz -O $BUILDDIRECTORY_RTLSDROGN/rtlsdr-ogn-bin-x64-latest.tgz
tar xvzf rtlsdr-ogn-bin-x64-latest.tgz -C $BUILDDIRECTORY_RTLSDROGN
;;
*)
# 32 Bit (default install if no others matched)
wget http://download.glidernet.org/x86/rtlsdr-ogn-bin-x86-latest.tgz -O $BUILDDIR/rtlsdr-ogn-bin-x86-latest.tgz
tar xvzf rtlsdr-ogn-bin-x86-latest.tgz -C $BUILDDIR
wget http://download.glidernet.org/x86/rtlsdr-ogn-bin-x86-latest.tgz -O $BUILDDIRECTORY_RTLSDROGN/rtlsdr-ogn-bin-x86-latest.tgz
tar xvzf rtlsdr-ogn-bin-x86-latest.tgz -C $BUILDDIRECTORY_RTLSDROGN
;;
esac
# Create named pipe
cd $BUILDDIR/rtlsdr-ogn
# Create named pipe.
cd $BUILDDIRECTORY_RTLSDROGN/rtlsdr-ogn
sudo mkfifo ogn-rf.fifo
# Set file permissions.
sudo chown root gsm_scan
sudo chmod a+s gsm_scan
sudo chmod a+s gsm_scan
sudo chown root ogn-rf
sudo chmod a+s ogn-rf
sudo chown root rtlsdr-ogn
sudo chmod a+s rtlsdr-ogn
sudo chmod a+s rtlsdr-ogn
# Check if kernel v4.1 or higher is being used.
KERNEL=`uname -r`
VERSION="`echo $KERNEL | cut -d \. -f 1`.`echo $KERNEL | cut -d \. -f 2`"
if [[ $VERSION < 4.1 ]]; then
if [[ $VERSION < 4.1 ]] ; then
# Kernel is older than version 4.1.
sudo mknod gpu_dev c 100 0
else
@ -120,7 +153,7 @@ else
sudo mknod gpu_dev c 249 0
fi
## CREATE THE CONFIGURATION FILE
### CREATE THE CONFIGURATION FILE
#######################################################
@ -129,7 +162,7 @@ fi
#######################################################
## INSTALL AS A SERVICE
### INSTALL AS A SERVICE
echo -e "\033[33mDownloading and setting permissions on the init script..."
echo -e "\033[37m"
@ -144,8 +177,8 @@ sudo tee /etc/rtlsdr-ogn.conf > /dev/null <<EOF
#Contact the shell with: telnet <hostname> <port>
#Syntax:
#port user directory command args
50000 pi ${BUILDDIR}/rtlsdr-ogn ./ogn-rf rtlsdr-ogn.conf
50001 pi ${BUILDDIR}/rtlsdr-ogn ./ogn-decode rtlsdr-ogn.conf
50000 pi ${BUILDDIRECTORY_RTLSDROGN}/rtlsdr-ogn ./ogn-rf rtlsdr-ogn.conf
50001 pi ${BUILDDIRECTORY_RTLSDROGN}/rtlsdr-ogn ./ogn-decode rtlsdr-ogn.conf
EOF
echo -e "\033[33mSetting up rtlsdr-ogn as a service..."
@ -155,3 +188,19 @@ sudo update-rc.d rtlsdr-ogn defaults
echo -e "\033[33mStarting the rtlsdr-ogn service..."
echo -e "\033[37m"
sudo service rtlsdr-ogn start
### SETUP COMPLETE
# Enter into the project root directory.
echo -e "\e[94m Entering the $ADSB_PROJECTTITLE root directory...\e[97m"
cd $PROJECTROOTDIRECTORY
echo -e ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m ${DECODER_NAME} setup is complete.\e[39m"
echo -e ""
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -60,7 +60,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -79,7 +81,7 @@ else
echo -e "\e[94m Detecting CPU architeture...\e[97m"
CPUARCHITECTURE=`uname -m`
echo -e "\e[94m CPU architecture detected as $CPUARCHITECTURE...\e[97m"
if [ $CPUARCHITECTURE = "x86_64" ] || or [ $CPUARCHITECTURE = "i686" ]; then
if [ $CPUARCHITECTURE = "armv7l" ] || [ $CPUARCHITECTURE = "x86_64" ] || [ $CPUARCHITECTURE = "i686" ]; then
# A precompiled binary should be available for this device.
echo -e "\e[94m A precompiled PhantomJS binary appears to be available for this CPU's arcitecture...\e[97m"
BINARYAVAILABLE="true"
@ -99,7 +101,9 @@ else
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
echo -e "\e[94m Will attempt to build the PhantomJS binary from source...\e[97m"
@ -118,7 +122,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -221,14 +227,19 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
# Download the proper PhantomJS binary.
case $CPUARCHITECTURE in
"armv7l")
# Download the armv7l version of the PhantomJS binary from https://github.com/jprochazka/phantomjs-linux-armv7l.
echo -e "\e[94m Downloading the armv7l PhantomJS v$PHANTOMJSVERSION binary for Linux...\e[97m"
echo ""
wget https://github.com/jprochazka/phantomjs-linux-armv7l/releases/download/2.1.1/phantomjs-2.1.1-linux-armv7l.tar.bz2
"x86_64")
# Download the x86_64 version of the PhantomJS binary.
# Download the x86_64 version of the PhantomJS binary from the PhantomJS web site.
echo -e "\e[94m Downloading the official x86_64 PhantomJS v$PHANTOMJSVERSION binary for Linux...\e[97m"
echo ""
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
;;
"i686"
# Download the i686 version of the PantomJS binary.
# Download the i686 version of the PantomJS binary from the PhantomJS web site.
echo -e "\e[94m Downloading the official i686 PhantomJS v$PHANTOMJSVERSION binary for Linux...\e[97m"
echo ""
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
@ -321,7 +332,9 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -462,6 +475,8 @@ echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m OverTustin setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -0,0 +1,197 @@
#!/bin/bash
#####################################################################################
# ADS-B RECEIVER #
#####################################################################################
# #
# This script is not meant to be executed directly. #
# Instead execute install.sh to begin the installation process. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# 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 #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included in all #
# copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## VAARIABLES
PROJECT_ROOT_DIRECTORY="$PWD"
BASH_DIRECTORY="$PROJECT_ROOT_DIRECTORY/bash"
BUILD_DIRECTORY="$PROJECT_ROOT_DIRECTORY/build"
## INCLUDE EXTERNAL SCRIPTS
source $BASH_DIRECTORY/variables.sh
source $BASH_DIRECTORY/functions.sh
## BEGIN SETUP
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Setting up beast-splitter..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[96m"
echo ""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Beast-Splitter Setup" --yesno "This is a helper utility for the Mode-S Beast.\n\nThe Beast provides a single data stream over a (USB) serial port. If you have more than one thing that wants to read that data stream, you need something to redistribute the data. This is what beast-splitter does.\n\n https://github.com/flightaware/beast-splitter\n\nContinue beast-splitter setup?" 15 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 beast-splitter setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 1
fi
## CHECK FOR PREREQUISITE PACKAGES
# Ask the beast-splitter listen port.
LISTEN_PORT_TITLE="Listen Port"
while [[ -z $LISTEN_PORT ]]; do
LISTEN_PORT=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --backtitle "$BACKTITLETEXT" --title "$LISTEN_PORT_TITLE" --nocancel --inputbox "\nPlease enter the port beast-splitter will listen on.\nThis must be a port which is currently not in use." 10 78 "30005" 3>&1 1>&2 2>&3)
LISTEN_PORT_TITLE="Listen Port (REQUIRED)"
done
# Ask the beast-splitter connect port.
CONNECT_PORT_TITLE="Connect Port"
while [[ -z $CONNECT_PORT ]]; do
CONNECT_PORT=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --backtitle "$BACKTITLETEXT" --title "$CONNECT_PORT_TITLE" --nocancel --inputbox "\nPlease enter the port beast-splitter will connect to.\nThis is generally port 30104 on dump1090." 10 78 "30104" 3>&1 1>&2 2>&3)
CONNECT_PORT_TITLE="Connect Port (REQUIRED)"
done
echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m"
echo ""
CheckPackage build-essential
CheckPackage debhelper
CheckPackage libboost-system-dev
CheckPackage libboost-program-options-dev
CheckPackage libboost-regex-dev
CheckPackage dh-systemd
## DOWNLOAD OR UPDATE THE BEAST-SPLITTER SOURCE
echo ""
echo -e "\e[95m Preparing the beast-splitter Git repository...\e[97m"
echo ""
if [ -d $BUILD_DIRECTORY/beast-splitter ] && [ -d $BUILD_DIRECTORY/beast-splitter/.git ]; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the beast-splitter git repository directory...\e[97m"
cd $BUILD_DIRECTORY/beast-splitter
echo -e "\e[94m Updating the local beast-splitter git repository...\e[97m"
echo ""
git pull
else
# A directory containing the source code does not exist in the build directory.
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
cd $BUILD_DIRECTORY
echo -e "\e[94m Cloning the beast-splitter git repository locally...\e[97m"
echo ""
git clone https://github.com/flightaware/beast-splitter.git
fi
## BUILD AND INSTALL THE BEAST-SPLITTER PACKAGE
echo ""
echo -e "\e[95m Building and installing the beast-splitter package...\e[97m"
echo ""
if [ ! $PWD = $BUILD_DIRECTORY/beast-splitter ]; then
echo -e "\e[94m Entering the piaware_builder git repository directory...\e[97m"
cd $BUILD_DIRECTORY/beast-splitter
fi
echo -e "\e[94m Executing the beast-splitter build script...\e[97m"
echo ""
dpkg-buildpackage -b
echo ""
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
cd $BUILD_DIRECTORY
echo -e "\e[94m Installing the beast-splitter package...\e[97m"
sudo dpkg -i beast-splitter_*.deb
if [ -d $BUILD_DIRECTORY/beast-splitter/packages ]; then
echo -e "\e[94m Creating a directory within the beast-splitter build directory to store built packages...\e[97m"
mkdir $BUILD_DIRECTORY/beast-splitter/packages
fi
echo -e "\e[94m Moving the beast-splitter package into the beast-splitter package directory...\e[97m"
mv $BUILD_DIRECTORY/beast-splitter_*.deb $BUILD_DIRECTORY/beast-splitter/packages/
## CREATE THE SCRIPT TO BE USED TO EXECUTE BEAST-SPLITTER
echo -e "\e[94m Creating the file beast-splitter_maint.sh...\e[97m"
tee $BUILD_DIRECTORY/beast-splitter/beast-splitter_maint.sh > /dev/null <<EOF
#! /bin/sh
while true
do
sleep 30
beast-splitter --serial /dev/beast --listen $LISTEN_PORT:R --connect localhost:$CONNECT_PORT:R
done
EOF
echo -e "\e[94m Setting file permissions for beast-splitter_maint.sh...\e[97m"
sudo chmod +x $BUILD_DIRECTORY/beast-splitter/beast-splitter_maint.sh
echo -e "\e[94m Checking if the beast-splitter startup line is contained within the file /etc/rc.local...\e[97m"
if ! grep -Fxq "$BUILD_DIRECTORY/beast-splitter/beast-splitter_maint.sh &" /etc/rc.local; then
echo -e "\e[94m Adding the beast-splitter startup line to the file /etc/rc.local...\e[97m"
lnum=($(sed -n '/exit 0/=' /etc/rc.local))
((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i $BUILD_DIRECTORY/beast-splitter/beast-splitter_maint.sh &\n" /etc/rc.local
fi
## START BEAST-SPLITTER
echo ""
echo -e "\e[95m Starting beast-splitter...\e[97m"
echo ""
# Kill any currently running instances of the beast-splitter_maint.sh script.
echo -e "\e[94m Checking for any running beast-splitter_maint.sh processes...\e[97m"
PIDS=`ps -efww | grep -w "beast-splitter_maint.sh" | awk -vpid=$$ '$2 != pid { print $2 }'`
if [ ! -z "$PIDS" ]; then
echo -e "\e[94m Killing any running beast-splitter_maint.sh processes...\e[97m"
sudo kill $PIDS
sudo kill -9 $PIDS
fi
# Kill any currently running instances beast-splitter.
echo -e "\e[94m Checking for any running beast-splitter processes...\e[97m"
PIDS=`ps -efww | grep -w "beast-splitter" | awk -vpid=$$ '$2 != pid { print $2 }'`
if [ ! -z "$PIDS" ]; then
echo -e "\e[94m Killing any running beast-splitter processes...\e[97m"
sudo kill $PIDS
sudo kill -9 $PIDS
fi
echo -e "\e[94m Executing the beast-splitter_maint.sh script...\e[97m"
sudo nohup $BUILD_DIRECTORY/beast-splitter/beast-splitter_maint.sh > /dev/null 2>&1 &
## BEAST-SPLITTER SETUP COMPLETE
# Enter into the project root directory.
echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m"
cd $PROJECT_ROOT_DIRECTORY
echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Exchange feed setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 0

Wyświetl plik

@ -0,0 +1,138 @@
#!/bin/bash
#####################################################################################
# ADS-B RECEIVER #
#####################################################################################
# #
# A set of scripts created to automate the process of installing the software #
# needed to setup a Mode S decoder as well as feeders which are capable of #
# sharing your ADS-B results with many of the most popular ADS-B aggregate sites. #
# #
# Project Hosted On GitHub: https://github.com/jprochazka/adsb-receiver #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# 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 #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included in all #
# copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## VARIABLES
PROJECT_ROOT_DIRECTORY="$PWD"
BASH_DIRECTORY="$PROJECT_ROOT_DIRECTORY/bash"
BUILD_DIRECTORY="$PROJECT_ROOT_DIRECTORY/build"
## INCLUDE EXTERNAL SCRIPTS
source $BASH_DIRECTORY/variables.sh
source $BASH_DIRECTORY/functions.sh
DOMAIN=""
TOKEN=""
## BEGIN SETUP
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Setting up the Duck DNS dynamic DNS update script..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[96m"
echo ""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Duck DNS Dynamic DNS" --yesno "Duck DNS is a free dynamic DNS service hosted on Amazon VPC.\n\nPLEASE NOTE:\n\nBefore continuing this setup it is recommended that you visit the Duck DNS website and signup for then setup a sub domain which will be used by this device. You will need both the domain and token supplied to you after setting up your account.\n\nhttp://www.duckdns.org\n\nContinue with Duck DNS update script setup?" 18 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 Duck DNS dynamic DNS setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 1
fi
echo -e "\e[95m Setting up Duck DNS dynamic DNS on this device...\e[97m"
echo ""
# Ask the user for the user name for this receiver.
DOMAIN_TITLE="Duck DNS Domain"
while [[ -z $DOMAIN ]]; do
DOMAIN=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --backtitle "$BACKTITLETEXT" --title "$DOMAIN_TITLE" --nocancel --inputbox "\nPlease enter the Duck DNS domain you selected after registering.\nIf you do not have one yet visit http://www.ducknds.org to obtain one." 9 78 3>&1 1>&2 2>&3)
DOMAIN_TITLE="Duck DNS Domain (REQUIRED)"
done
# Ask the user for the user name for this receiver.
TOKEN_TITLE="Duck DNS Token"
while [[ -z $TOKEN ]]; do
TOKEN=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --backtitle "$BACKTITLETEXT" --title "$TOKEN_TITLE" --nocancel --inputbox "\nPlease enter your Duck DNS token." 8 78 3>&1 1>&2 2>&3)
TOKEN_TITLE="Duck DNS Token (REQUIRED)"
done
# Check that the required packages are installed.
CheckPackage cron
CheckPackage curl
# Create a duckdns directory within the build directory if it does not already exist.
if [ ! -d $BUILD_DIRECTORY/duckdns ]; then
echo -e "\e[94m Creating the directory $BUILD_DIRECTORY/duckdns...\e[97m"
mkdir $BUILD_DIRECTORY/duckdns
fi
# Create then set permissions on the file duck.sh.
echo -e "\e[94m Creating the Duck DNS update script...\e[97m"
tee $BUILD_DIRECTORY/duckdns/duck.sh > /dev/null <<EOF
echo url="https://www.duckdns.org/update?domains=$DOMAIN&token=$TOKEN&ip=" | curl -k -o $BUILD_DIRECTORY/duckdns/duck.log -K -
EOF
echo -e "\e[94m Setting execute permissions for only this user on the Duck DNS update script...\e[97m"
chmod 700 $BUILD_DIRECTORY/duckdns/duck.sh
# Add job to the users crontab if it does not exist.
echo -e "\e[94m Adding the Duck DNS update command to your crontab if it does not exist already...\e[97m"
COMMAND="$BUILD_DIRECTORY/duckdns/duck.sh >/dev/null 2>&1"
JOB="*/5 * * * * $COMMAND"
# Should only add the job if the COMMAND does not already exist in the users crontab.
(crontab -l | grep -v -F "$COMMAND" ; echo "$JOB") | crontab -
# The following command should remove the job from the users crontab.
#(crontab -l | grep -v -F "$COMMAND" ) | crontab -
# Run the Duck DNS update script for the first time..
echo -e "\e[94m Executing the Duck DNS update script...\e[97m"
echo ""
$BUILD_DIRECTORY/duckdns/duck.sh
echo ""
## DUCK DNS SETUP COMPLETE
# Enter into the project root directory.
echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m"
cd $PROJECT_ROOT_DIRECTORY
echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m Duck DNS dynamic DNS setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
#exit 0

Wyświetl plik

@ -62,7 +62,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Exchange feed setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -153,7 +155,9 @@ if [ $(dpkg-query -W -f='${STATUS}' mlat-client 2>/dev/null | grep -c "ok instal
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Exchange feed setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -276,6 +280,8 @@ echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Exchange feed setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -61,7 +61,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -146,7 +148,9 @@ else
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
fi
@ -161,6 +165,8 @@ 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
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -61,7 +61,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-mutability setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -143,7 +145,9 @@ if [ $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed"
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m PiAware setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -215,6 +219,8 @@ echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m PiAware setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -62,7 +62,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Plane Finder ADS-B Client setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -144,7 +146,9 @@ if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Plane Finder ADS-B Client setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -162,6 +166,8 @@ echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m Plane Finder ADS-B Client setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -106,3 +106,14 @@ function UncommentConfig {
# Use sed to locate the "KEY" then uncomment the line containing it in the specified "FILE".
sudo sed -i -e "/$1/s/^#//" $2
}
# The following function is used to clean up the log files by removing
# any color escaping sequences from the log file so it is easier to read.
# There are other lines not needed which can be removed as well.
function CleanLogFile {
# Use sed to remove any color sequences from the specified "FILE".
sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" $1
# Remove the "Press enter to continue..." lines from the log file.
sed -i "/Press enter to continue.../d" $1
}

Wyświetl plik

@ -67,7 +67,9 @@ if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Project Im
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
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
fi
## CONFIGURE DUMP1090
@ -148,7 +150,9 @@ echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090 configuration complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
# CONFIGURE PIAWARE IF NEEDED
@ -212,7 +216,9 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok instal
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m PiAware configuration complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
fi
## SETUP THE ADS-B RECIEVER PROJECT WEB PORTAL

192
bash/init.sh 100755
Wyświetl plik

@ -0,0 +1,192 @@
#!/bin/bash
#####################################################################################
# ADS-B RECEIVER #
#####################################################################################
# #
# A set of scripts created to automate the process of installing the software #
# needed to setup a Mode S decoder as well as feeders which are capable of #
# sharing your ADS-B results with many of the most popular ADS-B aggregate sites. #
# #
# Project Hosted On GitHub: https://github.com/jprochazka/adsb-receiver #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# 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 #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included in all #
# copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
## INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/functions.sh
## MORE VARIABLES
export ADSB_PROJECTTITLE="The ADS-B Receiver Project Installer"
TERMINATEDMESSAGE=" \e[91m ANY FURTHER SETUP AND/OR INSTALLATION REQUESTS HAVE BEEN TERMINIATED\e[39m"
# If git branch not already specified then set to master.
if [[ -z ${PROJECTBRANCH} ]] ; then
PROJECTBRANCH="master"
fi
## CHECK IF THIS IS THE FIRST RUN USING THE IMAGE RELEASE
if [ -f $PROJECTROOTDIRECTORY/image ]; then
# Enable extra confirmation dialogs..
VERBOSE="true"
# Execute image setup script..
chmod +x $BASHDIRECTORY/image.sh
$BASHDIRECTORY/image.sh
if [ $? -ne 0 ]; then
echo ""
echo -e $TERMINATEDMESSAGE
echo ""
exit 1
fi
exit 0
fi
## FUNCTIONS
# UPDATE REPOSITORY PACKAGE LISTS
function AptUpdate() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
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
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Finished downloading and updating package lists.\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
}
function CheckPrerequisites() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Checking to make sure the whiptail and git packages are installed..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
CheckPackage whiptail
CheckPackage git
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m The whiptail and git packages are installed.\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
}
function UpdateRepository() {
## UPDATE THIS REPOSITORY
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Pulling the latest version of the ADS-B Receiver Project repository..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
echo -e "\e[94m Switching to branch $PROJECTBRANCH...\e[97m"
echo ""
git checkout $PROJECTBRANCH
echo ""
echo -e "\e[94m Pulling the latest git repository...\e[97m"
echo ""
git pull
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Finished pulling the latest version of the ADS-B Receiver Project repository....\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
}
# UPDATE THE OPERATING SYSTEM
function UpdateOperatingSystem() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
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 dist-upgrade
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Your operating system should now be up to date.\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
}
AptUpdate
CheckPrerequisites
UpdateRepository
## DISPLAY WELCOME SCREEN
## ASK IF OPERATING SYSTEM SHOULD BE UPDATED
if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Operating System Updates" --yesno "It is recommended that you update your system before building and/or installing any ADS-B receiver related packages. This script can do this for you at this time if you like.\n\nWould you like to update your operating system now?" 11 78) then
UpdateOperatingSystem
fi
## EXECUTE BASH/MAIN.SH
chmod +x $BASHDIRECTORY/main.sh
$BASHDIRECTORY/main.sh
if [ $? -ne 0 ]; then
echo -e $TERMINATEDMESSAGE
echo ""
exit 1
fi
## INSTALLATION COMPLETE
# Display the installation complete message box.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Software Installation Complete" --msgbox "INSTALLATION COMPLETE\n\nDO NOT DELETE THIS DIRECTORY!\n\nFiles needed for certain items to run properly are contained within this directory. Deleting this directory may result in your receiver not working properly.\n\nHopefully, these scripts and files were found useful while setting up your ADS-B Receiver. Feedback regarding this software is always welcome. If you have any issues or wish to submit feedback, feel free to do so on GitHub.\n\nhttps://github.com/jprochazka/adsb-receiver" 20 65
# Unset any exported variables.
unset ADSB_PROJECTTITLE
# Remove the FEEDERCHOICES and EXTRASCHOICES files created by whiptail.
rm -f FEEDERCHOICES
rm -f EXTRASCHOICES
echo -e "\033[32m"
echo "Installation complete."
echo -e "\033[37m"
exit 0

Wyświetl plik

@ -130,6 +130,35 @@ function InstallWebPortal() {
fi
}
## Extras
# Execute the AboveTustin setup script.
function InstallAboveTustin() {
chmod +x $BASHDIRECTORY/extras/abovetustin.sh
$BASHDIRECTORY/extras/abovetustin.sh
if [ $? -ne 0 ]; then
exit 1
fi
}
# Execute the beast-splitter setup script.
function InstallBeastSplitter() {
chmod +x $BASHDIRECTORY/extras/beeastsplitter.sh
$BASHDIRECTORY/extras/beastsplitter.sh
if [ $? -ne 0 ]; then
exit 1
fi
}
# Execute the Duck DNS setup script.
function InstallDuckDns() {
chmod +x $BASHDIRECTORY/extras/duckdns.sh
$BASHDIRECTORY/extras/duckdns.sh
if [ $? -ne 0 ]; then
exit 1
fi
}
#############
## DIALOGS
@ -218,7 +247,7 @@ fi
# Check for the Planefinder ADS-B Client package.
if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
# The Planefinder ADS-B Client package appears to be installed.
# The Planefinder ADS-B Client package does not appear to be installed.
FEEDERLIST=("${FEEDERLIST[@]}" 'Plane Finder ADS-B Client' '' OFF)
else
# Set version depending on the device architecture.
@ -234,7 +263,7 @@ fi
# Check for the Flightradar24 Feeder Client package.
if [ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
# The Flightradar24 client package appears to be installed.
# The Flightradar24 client package does not appear to be installed.
FEEDERLIST=("${FEEDERLIST[@]}" 'Flightradar24 Client' '' OFF)
else
# Check if a newer version can be installed if this is not a Raspberry Pi device.
@ -267,10 +296,51 @@ fi
whiptail --backtitle "$ADSB_PROJECTTITLE" --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-mutability 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 on this device?" 8 78
PORTAL_INSTALL=$?
## Extras
# Declare the EXTRASLIST array which will store choices for extras which are available for install.
declare array EXTRASLIST
# Check if the AboveTustin repository has been cloned.
if [ -d $BUILDDIRECTORY/AboveTustin ] && [ -d $BUILDDIRECTORY/AboveTustin/.git ]; then
# The AboveTustin repository has been cloned to this device.
EXTRASLIST=("${EXTRASLIST[@]}" 'AboveTustin (reinstall)' '' OFF)
else
# The AboveTustin repository has not been cloned to this device.
EXTRASLIST=("${EXTRASLIST[@]}" 'AboveTustin' '' OFF)
fi
# Check if the beast-splitter package is installed.
if [ $(dpkg-query -W -f='${STATUS}' beast-splitter 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
# The beast-splitter package appears to not be installed.
EXTRASLIST=("${EXTRASLIST[@]}" 'beast-splitter' '' OFF)
else
# Offer the option to build then reinstall the beast-splitter package.
EXTRASLIST=("${EXTRASLIST[@]}" 'beast-splitter (reinstall)' '' OFF)
fi
# Check if the Duck DNS update script exists.
if [ ! -f $BUILDDIRECTORY/duckdns/duck.sh ]; then
# Duck DNS does not appear to be set up on this device.
EXTRASLIST=("${EXTRASLIST[@]}" 'Duck DNS Free Dynamic DNS Hosting' '' OFF)
else
# Offer the option to install/setup Duck DNS once more.
EXTRASLIST=("${EXTRASLIST[@]}" 'Duck DNS Free Dynamic DNS Hosting (reinstall)' '' OFF)
declare EXTRASCHOICES
if [[ -n "$FEEDERLIST" ]]; then
# Display a checklist containing feeders that are not installed if any.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Feeder Installation Options" --checklist --nocancel --separate-output "The following extras are available for installation.\nChoose the extrass you wish to install." 13 65 4 "${EXTRASLIST[@]}" 2>EXTRASCHOICES
else
# Since all available extras appear to be installed inform the user of the fact.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "All Extras Installed" --msgbox "It appears that all the optional extras available for installation by this script have been installed already." 8 65
fi
## Setup Confirmation
# Check if anything is to be done before moving on.
if [ $DUMP1090MUTABILITY_INSTALL = 1 ] && [ $DUMP1090MUTABILITY_REINSTALL = 1 ] && [ $DUMP1090FA_INSTALL = 1 ] && [ $DUMP1090FA_UPGRADE = 1 ] && [ $DUMP978_INSTALL = 1 ] && [ $DUMP978_REINSTALL = 1 ] && [ $PORTAL_INSTALL = 1 ] && [ ! -s FEEDERCHOICES ]; then
if [ $DUMP1090MUTABILITY_INSTALL = 1 ] && [ $DUMP1090MUTABILITY_REINSTALL = 1 ] && [ $DUMP1090FA_INSTALL = 1 ] && [ $DUMP1090FA_UPGRADE = 1 ] && [ $DUMP978_INSTALL = 1 ] && [ $DUMP978_REINSTALL = 1 ] && [ $PORTAL_INSTALL = 1 ] && [ ! -s FEEDERCHOICES ] && [ ! -s EXTRASCHOICES ]; then
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Nothing to be done" --msgbox "Nothing has been selected to be installed so the script will exit now." 10 65
echo -e "\033[31m"
echo "Nothing was selected to do or be installed."
@ -281,7 +351,7 @@ fi
declare CONFIRMATION
# If the user decided to install software...
if [ $DUMP1090MUTABILITY_INSTALL = 0 ] || [ $DUMP1090MUTABILITY_REINSTALL = 0 ] || [ $DUMP1090FA_INSTALL = 0 ] || [ $DUMP1090FA_UPGRADE = 0 ] || [ $DUMP978_INSTALL = 0 ] || [ $DUMP978_REINSTALL = 0 ] || [ $PORTAL_INSTALL = 0 ] || [ -s FEEDERCHOICES ]; then
if [ $DUMP1090MUTABILITY_INSTALL = 0 ] || [ $DUMP1090MUTABILITY_REINSTALL = 0 ] || [ $DUMP1090FA_INSTALL = 0 ] || [ $DUMP1090FA_UPGRADE = 0 ] || [ $DUMP978_INSTALL = 0 ] || [ $DUMP978_REINSTALL = 0 ] || [ $PORTAL_INSTALL = 0 ] || [ -s FEEDERCHOICES ] || [ -s EXTRASCHOICES ]; then
CONFIRMATION="$The following software will be installed:\n"
if [ $DUMP1090MUTABILITY_INSTALL = 0 ] || [ $DUMP1090MUTABILITY_REINSTALL = 0 ]; then
@ -319,7 +389,7 @@ if [ $DUMP1090MUTABILITY_INSTALL = 0 ] || [ $DUMP1090MUTABILITY_REINSTALL = 0 ]
case $FEEDERCHOICE in
"FlightAware PiAware")
CONFIRMATION="$CONFIRMATION\n * FlightAware PiAware"
;;
;;
"FlightAware PiAware (upgrade)")
CONFIRMATION="$CONFIRMATION\n * FlightAware PiAware (upgrade)"
;;
@ -331,10 +401,10 @@ if [ $DUMP1090MUTABILITY_INSTALL = 0 ] || [ $DUMP1090MUTABILITY_REINSTALL = 0 ]
;;
"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"
;;
@ -345,12 +415,39 @@ if [ $DUMP1090MUTABILITY_INSTALL = 0 ] || [ $DUMP1090MUTABILITY_REINSTALL = 0 ]
if [ $PORTAL_INSTALL = 0 ]; then
CONFIRMATION="$CONFIRMATION\n * ADS-B Receiver Project Web Portal"
fi
if [ -s EXTRASCHOICES ]; then
while read EXTRASCHOICE
do
case $EXTRASCHOICE in
"AboveTustin")
CONFIRMATION="$CONFIRMATION\n * AboveTustin"
;;
"AboveTustin (reinstall)")
CONFIRMATION="$CONFIRMATION\n * AboveTustin (reinstall)"
;;
"beast-splitter")
CONFIRMATION="$CONFIRMATION\n * beast-splitter"
;;
"beast-splitter (reinstall)")
CONFIRMATION="$CONFIRMATION\n * beast-splitter (reinstall)"
;;
"Duck DNS Free Dynamic DNS Hosting")
CONFIRMATION="$CONFIRMATION\n * Duck DNS Free Dynamic DNS Hosting"
;;
"Duck DNS Free Dynamic DNS Hosting (reinstall)")
CONFIRMATION="$CONFIRMATION\n * Duck DNS Free Dynamic DNS Hosting (reinstall)"
;;
esac
done < EXTRASCHOICES
fi
CONFIRMATION="$CONFIRMATION\n\n"
fi
# Ask for confirmation before moving on.
CONFIRMATION="${CONFIRMATION}Do you wish to continue setup?"
if ! (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Confirm You Wish To Continue" --yesno "$CONFIRMATION" 17 78) then
if ! (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Confirm You Wish To Continue" --yesno "$CONFIRMATION" 20 78) then
echo -e "\033[31m"
echo " Installation canceled by user."
exit 1
@ -389,16 +486,16 @@ if [ -s FEEDERCHOICES ]; then
case $FEEDERCHOICE in
"FlightAware PiAware"|"FlightAware PiAware (upgrade)")
RUNPIAWARESCRIPT=0
;;
;;
"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
;;
;;
esac
done < FEEDERCHOICES
fi
@ -425,4 +522,40 @@ if [ $PORTAL_INSTALL = 0 ]; then
InstallWebPortal
fi
# Moved execution of functions outside of while loop.
# Inside the while loop the installation scripts are not stopping at reads.
RUNABOVETUSTINSCRIPT=1
RUNBEASTSPLITTERSCRIPT=1
RUNDUCKDNSSCRIPT=1
if [ -s EXTRASCHOICES ]; then
while read EXTRASCHOICE
do
case $EXTRASCHOICE in
"AboveTustin"|"AboveTustin (reinstall)")
RUNABOVETUSTINSCRIPT=0
;;
"beast-splitter"|"beast-splitter (reinstall)")
RUNBEASTSPLITTERSCRIPT=0
;;
"Duck DNS Free Dynamic DNS Hosting"|"Duck DNS Free Dynamic DNS Hosting (reinstall)")
RUNDUCKDNSSCRIPT=0
;;
esac
done < EXTRASCHOICES
fi
if [ $RUNABOVETUSTINSCRIPT = 0 ]; then
InstallAboveTustin
fi
if [ $RUNBEASTSPLITTERSCRIPT = 0 ]; then
InstallBeastSplitter
fi
if [ $RUNDUCKDNSSCRIPT = 0 ]; then
InstallDuckDns
fi
exit 0

Wyświetl plik

@ -61,7 +61,9 @@ if [ $CONTINUESETUP = 1 ]; then
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Receiver Project Portal setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
@ -561,6 +563,8 @@ echo ""
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Receiver Project Portal setup is complete.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -161,6 +161,8 @@ echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Finished backing up portal data.\e[39m"
echo ""
read -p "Press enter to exit..." CONTINUE
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 0

Wyświetl plik

@ -34,13 +34,13 @@
## SOFTWARE VERSIONS
# The ADS-B Receiver Project
PROJECTVERSION="2.5.0"
PROJECTVERSION="2.6.0"
# FlightAware PiAware
PIAWAREVERSION="3.1.0"
# PlaneFinder ADS-B Client
PFCLIENTVERSIONARM="3.4.61"
PFCLIENTVERSIONARM="3.5.461"
PFCLIENTVERSIONI386="3.4.61"
# Flightradar24 Linux Debian package

241
example.config 100644
Wyświetl plik

@ -0,0 +1,241 @@
#!/bin/bash
#####################################################################################
# ADS-B RECEIVER #
#####################################################################################
# #
# This script is not meant to be executed directly. #
# Instead execute install.sh to begin the installation process. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Copyright (c) 2015 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 #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included in all #
# copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## RECEIVER AND OPERATING SYSTEM
# Allow updates the operating system software installed on your device.
UPDATE_OS="true"
# Specify the receivers latitude and longitude as well as its altitude. This
# information can be obtained from https://www.swiftbyte.com/toolbox/geocode by
# simply supplying an address for this receiver.
RECEIVER_LATITUDE="41.3683798"
RECEIVER_LONGITUDE="-82.1076486"
RECIEVER_ALTITUDE="224"
## DECODERS
# ---------------------------------------------------------------------------------
# DUMP1090
# ---------------------------------------------------------------------------------
#
# One of two dump1090 forks must be installed by these scripts. You are required to
# specify one of the compatably forks in order to complete setup. The two available
# options at this time are the following:
#
# mutability : dump1090-mutability : https://github.com/mutability/dump1090
# fa : dump1090-fa : https://github.com/flightaware/dump1090
#
# If dump1090-fa (fa) is selected PiAware must be installed as
# well in order for dump1090-fa to run properly.
DUMP1090_FORK="mutability"
# Some setups will require you to specify the USB device dump1090 will be using.
# In particular when you are setting up more than one decoder on a single device.
# If you are only running the dump1090 decoder and not in cujunction with say
# dump978 on the same device then it is safe to leave this variable empty.
DUMP1090_USB_DEVICE=""
# OPTIONAL: You can optionally specify a Bing Maps API key in order to use maps
# provided by the Bing Maps service within the dump1090 map page. You can sign up
# for a Bing Maps API key at https://www.bingmapsportal.com.
DUMP1090_BING_MAPS_KEY=""
# OPTIONAL: You can optionally specify a Mapzen API key in order to use maps
# provided by the Mapzen Maps service within the dump1090 map page. You can sign up
# for a Mapzen API key at https://mapzen.com.
DUMP1090_MAPZEN_KEY=""
# OPTIONAL: Maximum range rings can be added to the dump109 map usings data
# obtained from Heywhatsthat.com. You will need to generate a new panarama for
# the receivers location before begining the installation. Note that the ability
# to download the JSON file making up the rings may expire over time on the
# Heywhatsthat.com website.
DUMP1090_HEYWHATSTHAT_INSTALL="false"
# In order to add these rings to your dump1090 map you will first need to visit
# http://www.heywhatsthat.com and generate a new panarama centered on the location
# of your receiver. You will need to supply the view id which is the series of
# letters and/or numbers after "?view=" in the URL located near the top left hand
# corner of the page the panarama is displayed.
DUMP1090_HEYWHATSTHAT_ID=""
# You can speicify the distances to display the Heywhatsthat.com maximum range
# rings in meters be setting the following variables.
DUMP1090_HAYWHATSTHAT_RING1="3048"
DUMP1090_HAYWHATSTHAT_RING2="12192"
# MUTABILITY ONLY: You can specify if dump1090-mutability will be allowed to listen
# on all IP addresses assigned to the device or only on the loopback address.'
DUMP1090_BIND_TO_ALL_IPS="true"
# MUTABILITY ONLY: You can specify the unit of measure used by dump1090-mutability.
# This can be set to either "metric" or "imperial".
DUMP1090_UNIT_OF_MEASURMENT="imperial"
# ---------------------------------------------------------------------------------
# DUMP978
# ---------------------------------------------------------------------------------
DUMP978_INSTALL="false"
# When setting up dump978 along with dump1090 on the same device you will be
# required specify the USB device dump1090 as well as dump978 will be using.
DUMP978_USB_DEVICE="1"
# ---------------------------------------------------------------------------------
# RTLSDR-OGN
# ---------------------------------------------------------------------------------
RTLSDROGN_INSTALL="false"
## FEEDERS
# ---------------------------------------------------------------------------------
# ADS-B Exchange
# ---------------------------------------------------------------------------------
ADSBEXCHANGE_INSTALL="false"
# The receiver name should be a unique name specific to this receiver which you can
# use to identify your receiver on the ADS-B Exchange MLAT status pages.
ADSBEXCHANGE_RECEIVER_NAME=""
# ---------------------------------------------------------------------------------
# FLIGHTRADAR24 FEEDER CLIENT
# ---------------------------------------------------------------------------------
#
# The Flightradar24 Feeder Client requires the user to interact physically with the
# device during installation. If you are to choose to set this installation option
# to "true" then the insteractive installation mode will be automatically enabled
# for the entire installation process.
FLIGHTRADAR24_INSTALL="false"
# ---------------------------------------------------------------------------------
# PIAWARE
# ---------------------------------------------------------------------------------
PIAWARE_INSTALL="false"
# The variables PIAWARE_FLIGHTAWARE_LOGIN and PIAWARE_FLIGHTAWARE_PASSWORD are
# optional and may be left empty. If you decide to leave these values empty you
# will need to manual claim this device as your on FlightAwares website.
# Information on claiming your device can be found at the following address:
#
# http://flightaware.com/adsb/piaware/claim
PIAWARE_FLIGHTAWARE_LOGIN=""
PIAWARE_FLIGHTAWARE_PASSWORD=""
# ---------------------------------------------------------------------------------
# PLANEFINDER ADS-B CLIENT
# ---------------------------------------------------------------------------------
#
# After setup has completed the Plane Finder ADS-B Client should be installed and
# running however this script is only capable of installing the Plane Finder ADS-B
# Client. There are still a few steps left which you must manually do through the
# Plane Finder ADS-B Client itself after the setup process is complete.
#
# Visit the following URL: http://127.0.0.1:30053
#
# Use the following settings when asked for them.
#
# Data Format: Beast
# Tcp Address: 127.0.0.1
# Tcp Port: 30005
PLANEFINDER_INSTALL="false"
## WEB PORTAL
# ---------------------------------------------------------------------------------
#
# In order to complete the portal setup process you will still be required to visit
# the following URL in your favorite web browser: http://127.0.0.1/install/
WEBPORTAL_INSTALL="true"
WEBPORTAL_ADVANCED="false"
# If WEBPORTAL_ADVANCED is set to "true" the variable WEBPORTAL_DATABASE_ENGINE
# must be set as well. There are currently two database engine options available.
#
# mysql : MySQL : http://www.mysql.com/
# sqlite : SQLite : http://sqlite.org/
WEBPORTAL_DATABASE_ENGINE=""
# If you are using MySQL as your database engine you must specify if the database
# server will be hosted locally on this device or at a remote location.
WEBPORTAL_MYSQL_SERVER_LOCAL=""
# If you are using MySQL you will also need to specify the hostname or address of
# the MySQL server you are going to use. If the MySQL server will be running
# locally on this device then the WEBPORTAL_MYSQL_SERVER_HOSTNAME value should
# be set to "localhost".
WEBPORTAL_MYSQL_SERVER_HOSTNAME="localhost"
# If the database to be used by the portal already exists set you will want to set
# the value of the variable WEBPORTAL_DATABASE_EXISTS to "true" in order to skip
# the database creation process.
WEBPORTAL_DATABASE_EXISTS=""
# If the database which will be used by the portal does not exist you will need to
# supply administrative credentials the script can use to log into the database
# eengine in order to create the database.
WEBPORTAL_DATABASE_ADMIN_USER=""
WEBPORTAL_DATABASE_ADMIN_PASSWORD=""
# You will need to supply both the database name as well as the credentials needed
# to log into the database server even if the database does or does not exist yet.
WEBPORTAL_DATABASE_NAME=""
WEBPORTAL_DATABASE_USER=""
WEBPORTAL_DATABASE_PASSWORD=""

275
install.sh 100755 → 100644
Wyświetl plik

@ -34,179 +34,130 @@
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## VARIABLES
### VARIABLES
PROJECTBRANCH="master"
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
VERBOSE=""
PROJECT_ROOT_DIRECTORY="$PWD"
BASH_DIRECTORY="$PROJECT_ROOT_DIRECTORY/bash"
LOG_DIRECTORY="$PROJECT_ROOT_DIRECTORY/logs"
## INCLUDE EXTERNAL SCRIPTS
ENABLE_LOGGING="false"
AUTOMATED_INSTALL="false"
CONFIGURATION_FILE="default"
source $BASHDIRECTORY/functions.sh
### INCLUDE EXTERNAL SCRIPTS
## MORE VARIABLES
source $BASH_DIRECTORY/functions.sh
export ADSB_PROJECTTITLE="The ADS-B Receiver Project Installer"
TERMINATEDMESSAGE=" \e[91m ANY FURTHER SETUP AND/OR INSTALLATION REQUESTS HAVE BEEN TERMINIATED\e[39m"
### USAGE
## PARSE OPTIONS FROM CLI
usage()
{
echo -e ""
echo -e "Usage: $0 [OPTIONS] [ARGUMENTS]"
echo -e ""
echo -e "Option GNU long option Meaning"
echo -e "-c <FILE> --config-file=<FILE> The configuration file to be use for an unattended installation."
echo -e "-h --help Shows this message."
echo -e "-l --log-output Logs all output to a file in the logs directory."
echo -e "-u --unattended Begins an unattended installation using a configuration file."
echo -e "-v --verbose Provides extra confirmation at each stage of the install."
echo -e ""
}
# Parse the command line options
while [[ $1 = -* ]]; do
case "$1" in
-v|--verbose)
VERBOSE="1"
shift 1
;;
--help)
usage
exit 1
;;
*)
echo "Error: Unknown option: $1" >&2
usage
exit 1
;;
esac
### CHECK FOR OPTIONS AND ARGUMENTS
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
# Display a help message.
usage
exit 0
;;
-a|--automated)
# Enable logging to a log file.
AUTOMATED_INSTALL="true"
shift 1
;;
-c)
# The specified installation configuration file.
CONFIGURATION_FILE="$2"
shift 2
;;
--config-file*)
# The specified installation configuration file.
CONFIGURATION_FILE=`echo $1 | sed -e 's/^[^=]*=//g'`
shift 1
;;
-l|--log-output)
# Enable logging to a file in the logs directory.
ENABLE_LOGGING="true"
shift 1
;;
-v|--verbose)
# Provides extra confirmation at each stage of the install.
export VERBOSE="true"
shift 1
;;
*)
# Unknown options were set so exit.
echo -e "Error: Unknown option: $1" >&2
usage
exit 1
;;
esac
done
## CHECK IF THIS IS THE FIRST RUN USING THE IMAGE RELEASE
### AUTOMATED INSTALL
if [ -f $PROJECTROOTDIRECTORY/image ]; then
# Execute image setup script..
chmod +x $BASHDIRECTORY/image.sh
$BASHDIRECTORY/image.sh
if [ $? -ne 0 ]; then
echo ""
echo -e $TERMINATEDMESSAGE
echo ""
# If the automated installation option was selected set the needed environmental variables.
if [ $AUTOMATED_INSTALL = "true" ]; then
###################################################################
## THIS FEATURE IS NOT READY FOR USE YET ###
echo "The automated installation option is still in development..."
exit 1
###################################################################
# If no configuration file was specified use the default configuration file path and name.
if [ $CONFIGURATION_FILE = "default" ]; then
CONFIGURATION_FILE="$PROJECT_ROOT_DIRECTORY/install.config"
fi
# If either the -c or --config-file= flags were set a valid file must reside there.
if [ ! -f $CONFIGURATION_FILE ]; then
echo "The specified configuration file does not exist."
exit 1
fi
fi
# Add any environmental variables needed by any child scripts.
export AUTOMATED_INSTALL
export CONFIGURATION_FILE
### EXECUTE BASH/INIT.SH
chmod +x $BASH_DIRECTORY/init.sh
if [[ ! -z $ENABLE_LOGGING ]] && [[ $ENABLE_LOGGING = "true" ]] ; then
# Execute init.sh logging all output to the log drectory as the file name specified.
LOG_FILE="$LOG_DIRECTORY/install_$(date +"%m_%d_%Y_%H_%M_%S").log"
$BASH_DIRECTORY/init.sh 2>&1 | tee -a "$LOG_FILE"
CleanLogFile "$LOG_FILE"
else
# Execute init.sh without logging any output to the log directory.
$BASH_DIRECTORY/init.sh
fi
### CLEAN UP
# Remove any global variables assigned by this script.
unset AUTOMATED_INSTALL
unset CONFIGURATION_FILE
unset VERBOSE
# Check if any errors were encountered by any child scripts.
# If no errors were encountered then exit this script cleanly.
if [[ $? -ne 0 ]] ; then
exit 1
else
exit 0
fi
## FUNCTIONS
# UPDATE REPOSITORY PACKAGE LISTS
function AptUpdate() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Downloading the latest package lists for all enabled repositories and PPAs..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
if [ ${VERBOSE} ] ; then
sudo apt-get update
else
sudo apt-get -y upgrade
fi
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Finished downloading and updating package lists.\e[39m"
echo ""
if [ ${VERBOSE} ] ; then
Read -p "Press enter to continue..." CONTINUE
fi
}
function CheckPrerequisites() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Checking to make sure the whiptail and git packages are installed..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
CheckPackage whiptail
CheckPackage git
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m The whiptail and git packages are installed.\e[39m"
echo ""
if [ ${VERBOSE} ] ; then
read -p "Press enter to continue..." CONTINUE
fi
}
function UpdateRepository() {
## UPDATE THIS REPOSITORY
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Pulling the latest version of the ADS-B Receiver Project repository..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
echo -e "\e[94m Switching to branch $PROJECTBRANCH...\e[97m"
echo ""
git checkout $PROJECTBRANCH
echo ""
echo -e "\e[94m Pulling the latest git repository...\e[97m"
echo ""
git pull
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Finished pulling the latest version of the ADS-B Receiver Project repository....\e[39m"
echo ""
if [ ${VERBOSE} ] ; then
read -p "Press enter to continue..." CONTINUE
fi
}
# UPDATE THE OPERATING SYSTEM
function UpdateOperatingSystem() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
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 dist-upgrade
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Your operating system should now be up to date.\e[39m"
echo ""
if [ ${VERBOSE} ] ; then
read -p "Press enter to continue..." CONTINUE
fi
}
AptUpdate
CheckPrerequisites
UpdateRepository
## DISPLAY WELCOME SCREEN
## ASK IF OPERATING SYSTEM SHOULD BE UPDATED
if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Operating System Updates" --yesno "It is recommended that you update your system before building and/or installing any ADS-B receiver related packages. This script can do this for you at this time if you like.\n\nWould you like to update your operating system now?" 11 78) then
UpdateOperatingSystem
fi
## EXECUTE BASH/MAIN.SH
chmod +x $BASHDIRECTORY/main.sh
$BASHDIRECTORY/main.sh
if [ $? -ne 0 ]; then
echo -e $TERMINATEDMESSAGE
echo ""
exit 1
fi
## INSTALLATION COMPLETE
# Display the installation complete message box.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Software Installation Complete" --msgbox "INSTALLATION COMPLETE\n\nDO NOT DELETE THIS DIRECTORY!\n\nFiles needed for certain items to run properly are contained within this directory. Deleting this directory may result in your receiver not working properly.\n\nHopefully, these scripts and files were found useful while setting up your ADS-B Receiver. Feedback regarding this software is always welcome. If you have any issues or wish to submit feedback, feel free to do so on GitHub.\n\nhttps://github.com/jprochazka/adsb-receiver" 20 65
# Unset any exported variables.
unset ADSB_PROJECTTITLE
# Remove the FEEDERCHOICES file created by whiptail.
rm -f FEEDERCHOICES
echo -e "\033[32m"
echo "Installation complete."
echo -e "\033[37m"
exit 0

Wyświetl plik

@ -0,0 +1 @@
Placeholder file to make sure the logs folder is created