Updated dump1090.fa script and fixed color variables.

pull/593/head
jprochazka 2024-07-21 20:58:36 -04:00
rodzic ee411ea7be
commit 143331a7d5
8 zmienionych plików z 313 dodań i 281 usunięć

Wyświetl plik

@ -2,6 +2,16 @@
The following is a history of the changes made to this project.
## v2.8.5 *(in development)*
* Added the --version and -v arguments in order to display the current project version.
* Added logging functions which in the future will offer a way to log output to files.
* Added variables which can be modified to adjust text colors used by the Bash scripts.
* The installation of PiAware is no longer required when choosing to install dump1090-fa.
* The dump1090-fa installation script to match current installation dump1090-fa instructions.
* Modified the dump1090-fa installation script so that it utilizes the new logging functions.
* The PiAware installation script now supports Ubuntu Noble Numbat.
## v2.8.4 *(July 13th, 2024)* :rooster:
### Installers

Wyświetl plik

@ -74,8 +74,6 @@ The project currently supports the following Linux distributions.
* Debian _(Bookworm and Bullseye)_
* DietPi _(Bookworm aand Bullseye)_
* Rasbperry PI OS _(Bookworm and Bullseye)_
* Ubuntu _(Jammy Jellyfish and Focal Fossa)_
* Ubuntu _(Jammy Jellyfish, Focal Fossa and Noble Numbat)_
_Support is available via this repository through the use of the issue tracker or discussions._
[Support for Ubuntu Noble Numbat is on hold due to incompatibilities with PiAware's MLAT client.](https://github.com/jprochazka/adsb-receiver/issues/575)

Wyświetl plik

@ -9,176 +9,188 @@ source $RECEIVER_BASH_DIRECTORY/functions.sh
## BEGIN SETUP
clear
echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}"
LogProjectName ${RECEIVER_PROJECT_TITLE}
LogTitleHeading "Setting up the FlightAware Dump1090 decoder"
LogTitleMessage "------------------------------------------------------------------------------"
echo ""
echo -e "\e[92m Setting up dump1090-fa..."
echo ""
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo ""
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090-fa Setup" --yesno "Dump 1090 is a Mode-S decoder specifically designed for RTL-SDR devices. Dump1090-fa is a fork of the dump1090-mutability version of dump1090 that is specifically designed for FlightAware's PiAware software.\n\nIn order to use this version of dump1090 FlightAware's PiAware software must be installed as well.\n\n https://github.com/flightaware/dump1090\n\nContinue setup by installing dump1090-fa?" 14 78; then
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--title "FlightAware Dump1090 Decoder Setup" \
--yesno "FlightAware Dump1090 is an ADS-B, Mode S, and Mode 3A/3C demodulator and decoder that will receive and decode aircraft transponder messages received via a directly connected software defined radio, or from data provided over a network connection.\n\nWebsite: https://www.flightaware.com/\nGitHub Repository: https://github.com/flightaware/dump1090\n\nWould you like to begin the setup process now?" \
14 78; then
LogAlertHeading "INSTALLATION HALTED"
LogAlertMessage "Setup has been halted at the request of the user"
echo ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-fa setup halted.\e[39m"
LogTitleMessage "------------------------------------------------------------------------------"
LogTitleHeading "FlightAware Dump1090 decoder setup halted"
echo ""
read -p "Press enter to continue..." discard
exit 1
fi
## CHECK FOR PREREQUISITE PACKAGES
echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m"
echo ""
LogHeading "Installing packages needed to fulfill FlightAware Dump1090 decoder dependencies"
CheckPackage build-essential
CheckPackage fakeroot
CheckPackage debhelper
CheckPackage librtlsdr-dev
CheckPackage pkg-config
CheckPackage libncurses-dev
CheckPackage fakeroot
CheckPackage libbladerf-dev
CheckPackage libhackrf-dev
CheckPackage liblimesuite-dev
CheckPackage libncurses-dev
CheckPackage librtlsdr-dev
CheckPackage libsoapysdr-dev
CheckPackage lighttpd
CheckPackage pkg-config
echo ""
## BLACKLIST UNWANTED RTL-SDR MODULES
LogHeading "Blacklist unwanted RTL-SDR kernel modules.
LogMessage "Blacklisting problematic kernel modules"
BlacklistModules
## DOWNLOAD OR UPDATE THE DUMP1090-FA SOURCE
## CLONE OR PULL THE FLIGHTAWARE DUMP1090 DECODER SOURCE
echo -e "\e[95m Preparing the dump1090-fa Git repository...\e[97m"
echo ""
if [[ -d $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090 && -d $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/.git ]]; then
# A directory with a git repository containing the source code already exists
echo -e "\e[94m Entering the dump1090-fa git repository directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090 2>&1
echo -e "\e[94m Updating the local dump1090-fa git repository...\e[97m"
LogHeading "Preparing the FlightAware Dump1090 Git repository"
if [[ -d $RECEIVER_BUILD_DIRECTORY/dump1090-fa && -d $RECEIVER_BUILD_DIRECTORY/dump1090.fa/.git ]]; then
LogMessage "Entering the dump1090 git repository directory"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa
LogMessage "Pulling the dump1090 git repository"
echo ""
git pull
else
# A directory containing the source code does not exist in the build directory
echo -e "\e[94m Creating the ADS-B Receiver Project build directory...\e[97m"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/dump1090-fa
echo ""
echo -e "\e[94m Entering the dump1090-fa build directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa 2>&1
echo -e "\e[94m Cloning the dump1090-fa git repository locally...\e[97m"
LogMessage "Entering the ADS-B Receiver Project build directory"
cd $RECEIVER_BUILD_DIRECTORY
LogMessage "Cloning the dump1090 git repository"
echo ""
git clone https://github.com/flightaware/dump1090.git
fi
echo ""
## BUILD AND INSTALL THE DUMP1090-FA PACKAGE
echo ""
echo -e "\e[95m Building and installing the dump1090-fa package...\e[97m"
echo ""
echo -e "\e[94m Entering the dump1090-fa git repository directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090 2>&1
echo -e "\e[94m Building the dump1090-fa package...\e[97m"
echo ""
dpkg-buildpackage -b
echo ""
echo -e "\e[94m Entering the dump1090-fa build directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa 2>&1
echo -e "\e[94m Installing the dump1090-fa package...\e[97m"
echo ""
echo "dump1090-fa_${DUMP1090_FA_VERSION}_*.deb"
sudo dpkg -i dump1090-fa_${DUMP1090_FA_VERSION}_*.deb
LogMessage "Entering the Git repository"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090
# Check that the package was installed
echo ""
echo -e "\e[94m Checking that the dump1090-fa package was installed properly...\e[97m"
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") = 0 ]]; then
# If the dump1090-fa package could not be installed halt setup
LogMessage "Determining which distribution to build the package tree for"
case $RECEIVER_OS_CODE_NAME in
focal)
distro="buster"
;;
bullseye | jammy)
distro="bullseye"
;;
bookworm | noble)
distro="bookworm"
;;
esac
LogMessage "Entering the package/${distro} directory"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa/package/$distro
LogMessage "Building the dump1090-fa Debian package"
dpkg-buildpackage -b --no-sign
# TODO: Figure out a better way than using a variable to determine which package to install
LogMessage "Installing the dump1090-fa Debian package"
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/dump1090-fa_${DUMP1090_FA_VERSION}_*.deb
LogMessage "Checking that the dump1090-fa Debian package was installed"
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then
echo ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE."
echo -e " SETUP HAS BEEN TERMINATED!"
LogAlertHeading "INSTALLATION HALTED"
echo ""
echo -e "\e[93mThe package \"dump1090-fa\" could not be installed.\e[39m"
LogAlertMessage "The dump1090-fa Debian package failed to install"
LogAlertMessage "Setup has been terminated"
echo ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-fa setup halted.\e[39m"
LogTitleMessage "------------------------------------------------------------------------------"
LogTitleHeading "FlightAware Dump1090 decoder setup halted"
echo ""
read -p "Press enter to continue..." discard
exit 1
fi
# Create binary package archive directory
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
echo -e "\e[94m Creating package archive directory...\e[97m"
echo -e ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1
echo -e ""
LogMessage "Creating the Debian package archive directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
echo ""
fi
# Archive binary package
echo -e "\e[94m Moving the dump1090-mutability binary package into the archive directory...\e[97m"
LogMessage "Copying the dump1090-fa Debian package into the Debian package archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/dump1090-fa/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
echo ""
## DUMP1090-FA POST INSTALLATION CONFIGURATION
# Ask for a Bing Maps API key
bing_maps_key=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Bing Maps API Key" --nocancel --inputbox "\nProvide a Bing Maps API key here to enable the Bing imagery layer.\nYou can obtain a free key at https://www.bingmapsportal.com/\n\nProviding a Bing Maps API key is not required to continue." 11 78 "${DUMP1090_BING_MAPS_KEY}" 3>&1 1>&2 2>&3)
if [[ -n $bing_maps_key ]]; then
echo -e "\e[94m Setting the Bing Maps API Key to ${DUMP1090_BING_MAPS_KEY}...\e[97m"
ChangeConfig "BingMapsAPIKey" $bing_maps_key "/usr/share/dump1090-fa/html/config.js"
fi
## POST INSTALLATION OPERATIONS
# Download Heywhatsthat.com maximum range rings
LogHeading "Performing post installation operations"
LogMessage "Checking if a heywhatsthat upintheair.json file exists"
if [[ ! -f "/usr/share/dump1090-fa/html/upintheair.json" ]]; then
if (whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Heywhaststhat.com Maximum Range Rings" --yesno "Maximum range rings can be added to dump1090-fa usings data obtained from Heywhatsthat.com. In order to add these rings to your dump1090-fa map you will first need to visit http://www.heywhatsthat.com and generate a new panorama centered on the location of your receiver. Once your panorama has been generated a link to the panorama will be displayed in the top left hand portion of the page. You will need the view id which is the series of letters and/or numbers after \"?view=\" in this URL.\n\nWould you like to add heywhatsthat.com maximum range rings to your map?" 16 78); then
setup_heywhatsthat="true"
# Ask the user for the Heywhatsthat.com panorama ID
heywhatsthat_id_title="Heywhatsthat.com Panorama ID"
while [[ -z $heywhatsthat_id ]] ; do
heywhatsthat_id=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${heywhatsthat_id_title}" --nocancel --inputbox "\nEnter your Heywhatsthat.com panorama ID." 8 78 3>&1 1>&2 2>&3)
heywhatsthat_id_title="Heywhatsthat.com Panorama ID (REQUIRED)"
LogMessage "Asking the user if they want to add heywhatsthat maximum range rings"
if (whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--title "Setup heywhaststhat Maximum Range Rings" \
--yesno "Maximum range rings can be added to the FlightAware Dump1090 map usings data obtained from heywhatsthat. In order to add these rings to your FlightAware dump1090 map you will first need to visit http://www.heywhatsthat.com and generate a new panorama centered on the location of your receiver. Once your panorama has been generated a link to the panorama will be displayed in the top left hand portion of the page. You will need the view ID which is the series of letters and numbers after \"?view=\" in the URL.\n\nWould you like to add heywhatsthat maximum range rings to your map?" \
16 78); then
heywhatsthat_panorama_id_title="Enter the heywhatsthat Panorama ID"
while [[ -z $heywhatsthat_panorama_id ]] ; do
heywhatsthat_panorama_id=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--title "${heywhatsthat_panorama_id_title}" \
--inputbox "\nPlease enter your Heywhatsthat panorama ID." \
8 78)
whiptail_exit_status=$?
if [[ $whiptail_exit_status == 0 ]]; then
LogAlertMessage "Setup of heywhatsthat maximum range rings was cancelled"
break
heywhatsthat_panorama_id_title="Enter the Heywhatsthat Panorama ID (REQUIRED)"
done
# Ask the user what altitude in meters to set the first range ring
heywhatsthat_ring_one_title="Heywhatsthat.com First Ring Altitude"
while [[ -z $heywhatsthat_ring_one ]] ; do
heywhatsthat_ring_one=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${heywhatsthat_ring_one_title}" --nocancel --inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
heywhatsthat_ring_one_title="Heywhatsthat.com First Ring Altitude (REQUIRED)"
if [[ $whiptail_exit_status != 0 ]]; then
LogMessage "Asking the user what the altitude is for the first ring"
heywhatsthat_ring_one_altitude_title="First heywhatsthat Ring Altitude"
while [[ -z $heywhatsthat_ring_one_altitude ]] ; do
heywhatsthat_ring_one_altitude=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--title "${heywhatsthat_ring_one_title}" \
--nocancel \
--inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" \
8 78 \
"3048")
heywhatsthat_ring_one_altitude_title="First heywhatsthat Ring Altitude (REQUIRED)"
done
# Ask the user what altitude in meters to set the second range ring
heywhatsthat_ring_two_title="Heywhatsthat.com Second Ring Altitude"
LogMessage "Asking the user what the altitude is for the second ring"
heywhatsthat_ring_two_altitude_title="Second heywhatsthat Ring Altitude"
while [[ -z $heywhatsthat_ring_two ]] ; do
heywhatsthat_ring_two=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${heywhatsthat_ring_two_title}" --nocancel --inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
heywhatsthat_ring_two_title="Heywhatsthat.com Second Ring Altitude (REQUIRED)"
heywhatsthat_ring_two_altitude=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--title "${heywhatsthat_ring_two_title}" \
--nocancel \
--inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" \
8 78 \
"12192")
heywhatsthat_ring_two_altitude_title="Second heywhatsthat Ring Altitude (REQUIRED)"
done
LogMessage "Downloading JSON data file assigned to panorama ID ${heywhatsthat_panorama_id}"
echo ""
sudo wget -O /usr/share/skyaware/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=${heywhatsthat_panarama_id}&refraction=0.25&alts=${heywhatsthat_ring_one_altitude},${heywhatsthat_ring_two_altitude}"
echo ""
LogMessage "
fi
# If the Heywhatsthat.com maximum range rings are to be added download them now
if [[ "${setup_heywhatsthat}" = "true" ]]; then
echo -e "\e[94m Downloading JSON data pertaining to the supplied panorama ID...\e[97m"
echo ""
sudo wget -O /usr/share/dump1090-fa/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=${heywhatsthat_id}&refraction=0.25&alts=${heywhatsthat_ring_one},${heywhatsthat_ring_two}"
echo ""
fi
fi
### SETUP COMPLETE
# Return to the project root directory
echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m"
cd $RECEIVER_ROOT_DIRECTORY 2>&1
## SETUP COMPLETE
LogMessage "Returning to ${RECEIVER_PROJECT_TITLE} root directory"
cd $RECEIVER_ROOT_DIRECTORY
echo ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-fa setup is complete.\e[39m"
LogTitleMessage "------------------------------------------------------------------------------"
LogTitleHeading "FlightAware Dump1090 decoder setup is complete"
echo ""
read -p "Press enter to continue..." discard

Wyświetl plik

@ -23,12 +23,15 @@ LogTitleHeading "Setting up the FlightAware PiAware Client"
LogTitleMessage "------------------------------------------------------------------------------"
echo ""
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "FlightAware PiAware client Setup" --yesno "The FlightAware PiAware client takes data from a local dump1090 instance and shares this with FlightAware using the piaware package, for more information please see their website:\n\n https://www.flightaware.com/adsb/piaware/\n\nContinue setup by installing the FlightAware PiAware client?" 13 78 3>&1 1>&2 2>&3; then
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--title "FlightAware PiAware client Setup" \
--yesno "The FlightAware PiAware client takes data from a local dump1090 instance and shares this with FlightAware using the piaware package, for more information please see their website:\n\n https://www.flightaware.com/adsb/piaware/\n\nContinue setup by installing the FlightAware PiAware client?" \
13 78; then
LogAlertHeading "INSTALLATION HALTED"
LogAlertMessage "Setup has been halted at the request of the user"
echo ""
LogTitleMessage "------------------------------------------------------------------------------"
LogTitleHeading "ADS-B Receiver Portal setup halted"
LogTitleHeading "FlightAware PiAware Client setup halted"
echo ""
exit 1
fi
@ -38,32 +41,31 @@ fi
LogHeading "Installing packages needed to fulfill dependencies for FlightAware PiAware client"
CheckPackage build-essential
CheckPackage git
CheckPackage devscripts
CheckPackage debhelper
CheckPackage tcl8.6-dev
CheckPackage autoconf
CheckPackage python3-dev
CheckPackage python3-venv
CheckPackage python3-setuptools
CheckPackage zlib1g-dev
CheckPackage openssl
CheckPackage libboost-system-dev
CheckPackage build-essential
CheckPackage chrpath
CheckPackage debhelper
CheckPackage devscripts
CheckPackage git
CheckPackage itcl3
CheckPackage libboost-filesystem-dev
CheckPackage libboost-program-options-dev
CheckPackage libboost-regex-dev
CheckPackage libboost-filesystem-dev
CheckPackage libboost-system-dev
CheckPackage libssl-dev
CheckPackage net-tools
CheckPackage openssl
CheckPackage patchelf
CheckPackage python3-dev
CheckPackage python3-pip
CheckPackage python3-setuptools
CheckPackage python3-venv
CheckPackage python3-wheel
CheckPackage net-tools
CheckPackage tclx8.4
CheckPackage tcllib
CheckPackage itcl3
CheckPackage libssl-dev
CheckPackage tcl-dev
CheckPackage chrpath
CheckPackage tcl8.6-dev
CheckPackage tcllib
CheckPackage tclx8.4
CheckPackage zlib1g-dev
if [[ "${RECEIVER_OS_CODE_NAME}" == "noble" ]]; then
CheckPackage python3-pyasyncore
@ -72,8 +74,8 @@ fi
if [[ "${RECEIVER_OS_CODE_NAME}" == "focal" ]]; then
CheckPackage python3-dev
else
CheckPackage tcl-tls
CheckPackage python3-build
CheckPackage tcl-tls
fi
echo ""
@ -162,7 +164,7 @@ else
cd $RECEIVER_BUILD_DIRECTORY
LogMessage "Cloning the piaware_builder git repository locally"
echo ""
git clone https://github.com/flightaware/piaware_builder.git
git clone https://github.com/flightaware/dump978.git
fi
echo ""

Wyświetl plik

@ -1,110 +1,10 @@
#!/bin/bash
# Detect if a package is installed and if not attempt to install it
function CheckPackage {
attempt=1
max_attempts=5
wait_time=5
## LOGGING FUNCTIONS
while (( $attempt -le `(($max_attempts + 1))` )); do
# If the maximum attempts has been reached
if [[ $attempt > $max_attempts ]]; then
echo -e "\n\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE."
echo -e " SETUP HAS BEEN TERMINATED!\n"
echo -e "\e[93mThe package \"$1\" could not be installed in ${max_attempts} attempts.\e[39m\n"
exit 1
fi
# Check if the package is already 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") = 0 ]]; then
# If this is not the first attempt at installing this package...
if [[ $attempt > 1 ]]; then
echo -e "\e[91m \e[5m[INSTALLATION ATTEMPT FAILED]\e[25m"
echo -e "\e[94m Will attempt to Install the package $1 again in ${wait_time} seconds (ATTEMPT ${attempt} OF ${max_attempts})..."
sleep $wait_time
else
echo -e "\e[91m [NOT INSTALLED]"
echo -e "\e[94m Installing the package $1..."
fi
# Attempt to install the required package
echo -e "\e[97m"
attempt=$((attempt+1))
sudo apt-get install -y $1
echo -e "\e[39m"
else
# The package appears to be installed
echo -e "\e[92m [OK]\e[39m"
break
fi
done
}
# Blacklist DVB-T drivers for RTL-SDR devices
function BlacklistModules {
if [[ ! -f /etc/modprobe.d/rtlsdr-blacklist.conf || `cat /etc/modprobe.d/rtlsdr-blacklist.conf | wc -l` < 9 ]]; then
echo -en "\e[94m Blacklisting unwanted RTL-SDR kernel modules so they are not loaded...\e[97m"
sudo tee /etc/modprobe.d/rtlsdr-blacklist.conf > /dev/null <<EOF
blacklist dvb_usb_v2
blacklist dvb_usb_rtl28xxu
blacklist dvb_usb_rtl2830u
blacklist dvb_usb_rtl2832u
blacklist rtl_2830
blacklist rtl_2832
blacklist r820t
blacklist rtl2830
blacklist rtl2832
EOF
else
echo -en "\e[94m Kernel module blacklisting complete...\e[97m"
fi
}
## CHANGE SETTINGS IN CONFIGURATION FILES
# Use sed to locate the "SWITCH" then replace the "VALUE", the portion after the equals sign, in the specified "FILE"
# This function will replace the value assigned to a specific switch contained within a file
function ChangeSwitch {
sudo sed -i -re "s/($1)\s+\w+/\1 $2/g" $3
}
# Use sed to locate the "KEY" then replace the "VALUE", the portion after the equals sign, in the specified "FILE"
# This function should work with any configuration file with settings formated as KEY="VALUE"
function ChangeConfig {
sudo sed -i -e "s/\($1 *= *\).*/\1\"$2\"/" $3
}
# Use sed to locate the "KEY" then read the "VALUE", the portion after the equals sign, in the specified "FILE"
# This function should work with any configuration file with settings formated as KEY="VALUE"
function GetConfig {
echo `sed -n "/^$1 *= *\"\(.*\)\"$/s//\1/p" $2`
}
# Use sed to locate the "KEY" then comment out the line containing it in the specified "FILE"
function CommentConfig {
if [[ ! `grep -cFx "#${1}" $2` -gt 0 ]]; then
sudo sed -i "/${1}/ s/^/#/" $2
fi
}
# Use sed to locate the "KEY" then uncomment the line containing it in the specified "FILE"
function UncommentConfig {
if [[ `grep -cFx "#${1}" $2` -gt 0 ]]; then
sudo sed -i "/#${1}*/ s/#*//" $2
fi
}
## LOGGING
# Logs the "PROJECT NAME" to the console
function LogProjectName {
echo -e "${DISPLAY_PROJECT_NAME} ${1}${DISPLAY_DEFAULT}"
# Logs the "PROJECT TITLE" to the console
function LogProjectTitle {
echo -e "${DISPLAY_PROJECT_NAME} ${RECEIVER_PROJECT_TITLE}${DISPLAY_DEFAULT}"
echo ""
}
@ -149,3 +49,109 @@ function LogWarningHeading {
function LogWarningMessage {
echo -e "${DISPLAY_WARNING_MESSAGE} ${1}${DISPLAY_DEFAULT}"
}
function LogMessageInline {
printf "${DISPLAY_MESSAGE} ${1}${DISPLAY_DEFAULT}"
}
function LogFalseInline {
echo -e "${DISPLAY_FALSE_INLINE} ${1}${DISPLAY_DEFAULT}"
}
function LogTrueInline {
echo -e "${DISPLAY_TRUE_INLINE} ${1}${DISPLAY_DEFAULT}"
}
## CHECK IF THE SUPPLIED PACKAGE IS INSTALLED AND IF NOT ATTEMPT TO INSTALL IT
function CheckPackage {
attempt=1
max_attempts=5
wait_time=5
while (( $attempt -le `(($max_attempts + 1))` )); do
if [[ $attempt > $max_attempts ]]; then
LogAlertHeading "INSTALLATION HALTED"
LogAlertMessage "Unable to install a required package"
LogAlertMessage "The package $1 could not be installed in ${max_attempts} attempts"
exit 1
fi
LogMessageInline "Checking if the package $1 is installed"
if [[ $(dpkg-query -W -f='${STATUS}' $1 2>/dev/null | grep -c "ok installed") = 0 ]]; then
if [[ $attempt > 1 ]]; then
LogAlertMessage "Inastallation attempt failed"
LogAlertMessage "Will attempt to Install the package $1 again in ${wait_time} seconds (attempt ${attempt} of ${max_attempts})"
sleep $wait_time
else
LogFalseInline "[NOT INSTALLED]"
LogMessage "Installing the package ${1}"
fi
echo ""
attempt=$((attempt+1))
sudo apt-get install -y $1
echo ""
else
LogTrueInline "[OK]"
break
fi
done
}
## BLACKLIST DVB-T DRIVERS FOR RTL-SDR DEVICES
function BlacklistModules {
if [[ ! -f /etc/modprobe.d/rtlsdr-blacklist.conf || `cat /etc/modprobe.d/rtlsdr-blacklist.conf | wc -l` < 9 ]]; then
LogMessage "Blacklisting unwanted RTL-SDR kernel modules so they are not loaded"
sudo tee /etc/modprobe.d/rtlsdr-blacklist.conf > /dev/null <<EOF
blacklist dvb_usb_v2
blacklist dvb_usb_rtl28xxu
blacklist dvb_usb_rtl2830u
blacklist dvb_usb_rtl2832u
blacklist rtl_2830
blacklist rtl_2832
blacklist r820t
blacklist rtl2830
blacklist rtl2832
EOF
else
LogMessage "Kernel module blacklisting complete"
fi
}
## CONFIGURATION RELATED FUNCTIONS
# Use sed to locate the "SWITCH" then replace the "VALUE", the portion after the equals sign, in the specified "FILE"
# This function will replace the value assigned to a specific switch contained within a file
function ChangeSwitch {
sudo sed -i -re "s/($1)\s+\w+/\1 $2/g" $3
}
# Use sed to locate the "KEY" then replace the "VALUE", the portion after the equals sign, in the specified "FILE"
# This function should work with any configuration file with settings formated as KEY="VALUE"
function ChangeConfig {
sudo sed -i -e "s/\($1 *= *\).*/\1\"$2\"/" $3
}
# Use sed to locate the "KEY" then read the "VALUE", the portion after the equals sign, in the specified "FILE"
# This function should work with any configuration file with settings formated as KEY="VALUE"
function GetConfig {
echo `sed -n "/^$1 *= *\"\(.*\)\"$/s//\1/p" $2`
}
# Use sed to locate the "KEY" then comment out the line containing it in the specified "FILE"
function CommentConfig {
if [[ ! `grep -cFx "#${1}" $2` -gt 0 ]]; then
sudo sed -i "/${1}/ s/^/#/" $2
fi
}
# Use sed to locate the "KEY" then uncomment the line containing it in the specified "FILE"
function UncommentConfig {
if [[ `grep -cFx "#${1}" $2` -gt 0 ]]; then
sudo sed -i "/#${1}*/ s/#*//" $2
fi
}

Wyświetl plik

@ -153,7 +153,7 @@ fi
# If no dump1090 fork is installed then attempt to install one.
if [[ ! "${DUMP1090_IS_INSTALLED}" = "true" ]] ; then
DUMP1090_OPTION=$(whiptail --nocancel --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Choose Dump1090 Version To Install" --radiolist "Dump1090 does not appear to be present on this device. In order to continue setup dump1090 will need to exist on this device. Please select your prefered dump1090 version from the list below.\n\nPlease note that in order to run dump1090-fa PiAware will need to be installed as well." 16 65 2 "dump1090-fa" "(FlightAware)" ON 3>&1 1>&2 2>&3)
DUMP1090_OPTION=$(whiptail --nocancel --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Choose Dump1090 Version To Install" --radiolist "Dump1090 does not appear to be present on this device. In order to continue setup dump1090 will need to exist on this device. Please select your prefered dump1090 version from the list below." 16 65 2 "dump1090-fa" "(FlightAware)" ON 3>&1 1>&2 2>&3)
case ${DUMP1090_OPTION} in
"dump1090-fa")
DUMP1090_FORK="fa"
@ -165,11 +165,6 @@ if [[ ! "${DUMP1090_IS_INSTALLED}" = "true" ]] ; then
esac
fi
# If the FlightAware fork of dump1090 is or has been chosen to be installed PiAware must be installed.
if [[ "${DUMP1090_FORK}" = "fa" && "${DUMP1090_DO_INSTALL}" = "true" || "${DUMP1090_DO_UPGRADE}" = "true" ]]; then
FORCE_PIAWARE_INSTALL="true"
fi
# Check if the dump978-fa package is installed.
if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
# Dump978 appears to be present on this device.
@ -416,11 +411,6 @@ else
CONFIRMATION="${CONFIRMATION}\n * dump978"
fi
# If PiAware is required add it to the list.
if [[ "${DUMP1090_FORK}" = "fa" && $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed") -eq 0 || "${PIAWARE_INSTALL}" = "true" ]]; then
CONFIRMATION="${CONFIRMATION}\n * FlightAware PiAware"
fi
if [[ -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" ]]; then
while read FEEDER_CHOICE
do
@ -516,7 +506,7 @@ if [[ "${RUN_AIRPLANESLIVE_SCRIPT}" = "true" ]]; then
InstallAirplanesLive
fi
if [[ "${RUN_PIAWARE_SCRIPT}" = "true" || "${FORCE_PIAWARE_INSTALL}" = "true" ]]; then
if [[ "${RUN_PIAWARE_SCRIPT}" = "true" ]]; then
InstallPiAware
fi

Wyświetl plik

@ -1,11 +1,22 @@
#!/bin/bash
## DISPLAY COLORS
DISPLAY_DEFAULT="\033[0m"
DISPLAY_HEADING="\033[1;36m"
DISPLAY_MESSAGE="\033[2;36m"
DISPLAY_PROJECT_NAME="\033[1;31m"
DISPLAY_TITLE_HEADING="\033[1;32m"
DISPLAY_TITLE_MESSAGE="\033[2;32m"
DISPLAY_WARNING_HEADING="\033[1;33m"
DISPLAY_WARNING_MESSAGE="\033[2;33m"
DISPLAY_ALERT_HEADING="\033[1;31m"
DISPLAY_ALERT_MESSAGE="\033[2;31m"
DISPLAY_FALSE_INLINE="\033[2;31m"
DISPLAY_TRUE_INLINE="\033[2;32m"
## SOFTWARE VERSIONS
# The ADS-B Receiver Project
PROJECT_VERSION="2.8.4"
# FlightAware
DUMP1090_FA_VERSION="9.0"
DUMP978_FA_VERSION="9.0"
@ -23,17 +34,3 @@ FLIGHTRADAR24_CLIENT_VERSION="1.0.18-5"
# OpenSky Network Client
OPENSKY_NETWORK_CLIENT_VERSION="2.1.7-1"
## DISPLAY
DISPLAY_DEFAULT = "\033[0m"
DISPLAY_HEADING = "\033[1;36m"
DISPLAY_MESSAGE = "\033[2;36m"
DISPLAY_PROJECT_NAME = "\033[1;33m"
DISPLAY_TITLE_HEADING = "\033[1;32m"
DISPLAY_TITLE_MESSAGE = "\033[2;32m"
DISPLAY_WARNING_HEADING = "\033[1;33m"
DISPLAY_WARNING_MESSAGE = "\033[2;33m"
DISPLAY_ALERT_HEADING = "\033[1;31m"
DISPLAY_ALERT_MESSAGE = "\033[2;31m"

Wyświetl plik

@ -34,6 +34,11 @@
# #
#####################################################################################
## ASSIGN VERSION VARIABLE
project_version="2.8.5"
## FUNCTIONS
# Display the help message
@ -48,6 +53,7 @@ function DisplayHelp() {
echo "-d --development Skips local repository update so changes are not overwrote."
echo "-h --help Shows this message. "
echo "-m <MTA> --mta=<MTA> Specify which email MTA to use currently Exim or Postfix. "
echo "-v --version Displays the version being used. "
echo "-------------------------------------------------------------------------------------------"
echo " "
}
@ -96,8 +102,9 @@ while [[ $# > 0 ]] ; do
;;
--version | -v)
# Display the version
echo $PROJECT_VERSION
echo $project_version
exit 0
;;
*)
# Unknown options were set so exit
echo -e "Error: Unknown option: $1" >&2
@ -117,7 +124,7 @@ export RECEIVER_MTA=$mta
project_branch="master"
export RECEIVER_PROJECT_TITLE="The ADS-B Receiver Project Preliminary Setup Process"
export RECEIVER_PROJECT_TITLE="ADS-B Receiver Installer v${project_version}"
export RECEIVER_ROOT_DIRECTORY=$PWD
export RECEIVER_BASH_DIRECTORY=$PWD/bash
export RECEIVER_BUILD_DIRECTORY=$PWD/build
@ -126,24 +133,34 @@ export RECEIVER_BUILD_DIRECTORY=$PWD/build
## SOURCE EXTERNAL SCRIPTS
source $RECEIVER_BASH_DIRECTORY/functions.sh
source $RECEIVER_BASH_DIRECTORY/variables.sh
## UPDATE PACKAGE LISTS AND INSTALL DEPENDENCIES
clear
echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}\n"
echo -e "\e[92m ADS-B Receiver Project Package Dependency Check"
echo -e "\e[93m ------------------------------------------------------------------------------\e[97m\n"
echo -e "\e[94m Downloading the latest package lists for all enabled repositories and PPAs...\e[97m\n"
LogProjectTitle
LogTitleHeading "Starting ADS-B Receiver Installer package dependency check"
LogTitleMessage "------------------------------------------------------------------------------"
LogHeading "Updating package lists for all enabled repositories and PPAs"
LogMessage "Downloading the latest package lists for all enabled repositories and PPAs"
echo ""
sudo apt-get update
echo -e "\n\e[94m Ensuring that all required packages are installed...\e[97m\n"
LogHeading "Ensuring that all required packages are installed"
CheckPackage bc
CheckPackage git
CheckPackage lsb-base
CheckPackage lsb-release
CheckPackage whiptail
echo -e "\n\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m All required packages are installed.\e[39m\n"
echo ""
LogTitleMessage "------------------------------------------------------------------------------"
LogTitleHeading "ADS-B Receiver Installer package dependency check complete"
echo ""
read -p "Press enter to continue..." discard