Added file logging.

pull/593/head
jprochazka 2024-07-22 17:57:59 -04:00
rodzic 9b474c1939
commit 6c88cd0476
18 zmienionych plików z 182 dodań i 124 usunięć

3
.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1,3 @@
logs/
build/package-archive
build/dump1090*

Wyświetl plik

@ -7,9 +7,9 @@ The following is a history of the changes made to this project.
* The PiAware installation script now supports Ubuntu Noble Numbat.
* The installation of PiAware is no longer required when choosing to install dump1090-fa.
* The dump1090-fa installation script now mimics the current dump1090-fa installation instructions.
* Added logging functions which in the future will offer a way to log output to files.
* All scripts excluding those related to the portal now utilize the new logging functions.
* Logging to the logs directory is enabled by default but can be disabled with --no-log or -n.
* Added variables which can be modified to adjust text colors used by the bash scripts.
* All installation scripts now utilize the new logging functions.
* Added the --version and -v arguments in order to display the current project version.
* Removed scripting used for image setup.

Wyświetl plik

@ -12,11 +12,11 @@ clear
LogProjectTitle
LogTitleHeading "Setting up the FlightAware Dump1090 decoder"
LogTitleMessage "------------------------------------------------------------------------------"
echo ""
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
echo ""
LogAlertHeading "INSTALLATION HALTED"
LogAlertMessage "Setup has been halted at the request of the user"
echo ""
@ -32,6 +32,7 @@ LogHeading "Installing packages needed to fulfill FlightAware Dump1090 decoder d
CheckPackage build-essential
CheckPackage debhelper
CheckPackage devscripts
CheckPackage fakeroot
CheckPackage libbladerf-dev
CheckPackage libhackrf-dev
@ -45,7 +46,7 @@ CheckPackage pkg-config
## BLACKLIST UNWANTED RTL-SDR MODULES
LogHeading "Blacklist unwanted RTL-SDR kernel modules.
LogHeading "Blacklist unwanted RTL-SDR kernel modules."
BlacklistModules
@ -54,24 +55,23 @@ BlacklistModules
LogHeading "Preparing the FlightAware Dump1090 Git repository"
if [[ -d $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090 && -d $RECEIVER_BUILD_DIRECTORY/dump1090.fa/dump1090/.git ]]; then
if [[ -d $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090 && -d $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/.git ]]; then
LogMessage "Entering the dump1090 git repository directory"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090
LogMessage "Pulling the dump1090 git repository"
echo ""
git pull
git pull 2>&1 | tee -a $RECEIVER_LOG_FILE
else
LogMessage "Creating the FlightAware dump1090 Project build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/dump1090-fa
mkdir -v $RECEIVER_BUILD_DIRECTORY/dump1090-fa 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Entering the FlightAware dump1090 Project build directory"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa
LogMessage "Cloning the dump1090 git repository"
echo ""
git clone https://github.com/flightaware/dump1090.git
git clone https://github.com/flightaware/dump1090.git 2>&1 | tee -a $RECEIVER_LOG_FILE
fi
echo ""
## BUILD AND INSTALL THE DUMP1090-FA PACKAGE
@ -86,20 +86,24 @@ case $RECEIVER_OS_CODE_NAME in
focal)
distro="buster"
;;
bullseye | jammy)
bullseye|jammy|bookworm|noble)
distro="bullseye"
;;
bookworm | noble)
distro="bookworm"
;;
esac
LogMessage "Entering the package/${distro} directory"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa/package/$distro
LogMessage "Preparing to build dump1090-fa for ${distro}"
echo ""
./prepare-build.sh $distro 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Entering the package-${distro} directory"
cd $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/package-$distro
LogMessage "Building the dump1090-fa Debian package"
dpkg-buildpackage -b --no-sign
echo ""
dpkg-buildpackage -b --no-sign 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Installing the dump1090-fa Debian package"
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/dump1090-fa_${DUMP1090_FA_VERSION}_*.deb
echo ""
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/dump1090-fa_$DUMP1090_FA_VERSION_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
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
@ -119,13 +123,12 @@ fi
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
LogMessage "Creating the Debian package archive directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
mkdir -v $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Copying the dump1090-fa Debian package into the Debian package archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/dump1090-fa/dump1090/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
## POST INSTALLATION OPERATIONS
@ -137,50 +140,54 @@ if [[ ! -f "/usr/share/dump1090-fa/html/upintheair.json" ]]; then
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?" \
--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
LogMessage "Asking the user for the heywhatsthat panarama ID"
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." \
--inputbox "Please 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)"
fi
heywhatsthat_panorama_id_title="Enter the Heywhatsthat Panorama ID [REQUIRED]"
done
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)"
--title "${heywhatsthat_ring_one_altitude_title}" \
--nocancel \
--inputbox "Enter 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
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
while [[ -z $heywhatsthat_ring_two_altitude ]] ; do
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)"
--title "${heywhatsthat_ring_two_altitude_title}" \
--nocancel \
--inputbox "Enter 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}"
sudo wget -v -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}" 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "
LogMessage "Heywhatsthat configuration complete"
fi
else
LogMessage "Heywhatsthat maximum range rings was skipped"
fi
fi

Wyświetl plik

@ -40,7 +40,7 @@ fi
if [[ "${adsb_decoder_installed}" == "true" ]]; then
LogMessage "Checking if dump978-fa has been configured"
if grep -wq "driver=rtlsdr,serial=" /etc/default/dump978-fa; then
echo -e "The dump978-fa installation appears to have been configured"
LogMessage "The dump978-fa installation appears to have been configured"
else
whiptail --backtitle "FlightAware Dump978 Configuration" \
--title "RTL-SDR Dongle Assignments" \
@ -114,17 +114,17 @@ if [[ -d $RECEIVER_BUILD_DIRECTORY/dump978-fa/dump978 && -d $RECEIVER_BUILD_DIRE
cd $RECEIVER_BUILD_DIRECTORY/dump978-fa/dump978
LogMessage "Pulling the dump1090 git repository"
echo ""
git pull
git pull 2>&1 | tee -a $RECEIVER_LOG_FILE
else
LogMessage "Creating the FlightAware dump978 Project build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/dump1090-fa
mkdir -v $RECEIVER_BUILD_DIRECTORY/dump1090-fa 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Entering the ADS-B Receiver Project build directory"
cd $RECEIVER_BUILD_DIRECTORY/dump978-fa
LogMessage "Cloning the FlightAware dump978 git repository"
echo ""
git clone https://github.com/flightaware/dump978.git
git clone https://github.com/flightaware/dump978.git 2>&1 | tee -a $RECEIVER_LOG_FILE
fi
echo ""
@ -138,13 +138,13 @@ cd $RECEIVER_BUILD_DIRECTORY/dump978-fa/dump978
LogMessage "Building the dump978-fa package"
echo ""
dpkg-buildpackage -b
dpkg-buildpackage -b 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Installing the dump1090-fa Debian package"
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump978-fa/dump978-fa_${DUMP978_FA_VERSION}_*.deb
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/dump978-fa/dump978-fa_${DUMP978_FA_VERSION}_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
LogMessage "Installing the skyaware978 Debian package"
sudo dpkg -i $$RECEIVER_BUILD_DIRECTORY/dump978-fa/skyaware978_${DUMP978_FA_VERSION}_*.deb
sudo dpkg -i $$RECEIVER_BUILD_DIRECTORY/dump978-fa/skyaware978_${DUMP978_FA_VERSION}_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
LogMessage "Checking that the dump978-fa Debian package was installed"
if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then
@ -179,16 +179,16 @@ fi
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
LogMessage "Creating the Debian package archive directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
mkdir -v $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Copying the dump978-fa Debian package into the Debian package archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Copying the skyaware978 Debian package into the Debian package archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""

Wyświetl plik

@ -87,17 +87,17 @@ if [[ -d $RECEIVER_BUILD_DIRECTORY/beast-splitter/beast-splitter && -d $RECEIVER
cd $RECEIVER_BUILD_DIRECTORY/beast-splitter/beast-splitter
LogMessage "Pulling the beast-splitter git repository"
echo ""
git pull
git pull 2>&1 | tee -a $RECEIVER_LOG_FILE
else
LogMessage "Creating the beast-splitter build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/beast-splitter
mkdir -v $RECEIVER_BUILD_DIRECTORY/beast-splitter 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Entering the beast-splitter build directory"
cd $RECEIVER_BUILD_DIRECTORY/beast-splitter
LogMessage "Cloning the FlightAware dump978 git repository"
echo ""
git clone https://github.com/flightaware/beast-splitter.git
git clone https://github.com/flightaware/beast-splitter.git 2>&1 | tee -a $RECEIVER_LOG_FILE
fi
@ -110,11 +110,11 @@ cd $RECEIVER_BUILD_DIRECTORY/beast-splitter/beast-splitter
LogMessage "Building the beast-splitter package"
echo ""
dpkg-buildpackage -b
dpkg-buildpackage -b 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Installing the beast-splitter Debian package"
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/beast-splitter/beast-splitter_*.deb
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/beast-splitter/beast-splitter_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
LogMessage "Checking that the beast-splitter Debian package was installed"
if [[ $(dpkg-query -W -f='${STATUS}' beast-splitter 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then
@ -134,12 +134,12 @@ fi
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
LogMessage "Creating the Debian package archive directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
mkdir -v $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Copying the beast-splitter Debian package into the Debian package archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/beast-splitter/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
cp -vf $RECEIVER_BUILD_DIRECTORY/beast-splitter/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""

Wyświetl plik

@ -80,7 +80,7 @@ LogHeading "Creating the Duck DNS script"
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/duckdns ]]; then
LogMessage "Creating the Duck DNS build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/duckdns
mkdir -v $RECEIVER_BUILD_DIRECTORY/duckdns 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
@ -91,7 +91,7 @@ EOF
LogMessage "Adding execute permissions for only this user to the Duck DNS update script"
echo ""
chmod -v 700 $RECEIVER_BUILD_DIRECTORY/duckdns/duck.sh
chmod -v 700 $RECEIVER_BUILD_DIRECTORY/duckdns/duck.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Creating the Duck DNS cron file"

Wyświetl plik

@ -37,7 +37,7 @@ whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/adsbexchange ]]; then
LogMessage "Creating the ADSBExchange build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/adsbexchange
mkdir -v $RECEIVER_BUILD_DIRECTORY/adsbexchange 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Entering the ADSBExchange build directory"
@ -52,9 +52,9 @@ fi
LogMessage "Downloading the ADS-B Exchange client ${action_to_perform} script"
echo ""
if [[ "${action_to_perform}" = "install" ]]; then
wget -O $RECEIVER_BUILD_DIRECTORY/adsbexchange/feed-${action_to_perform}.sh https://www.adsbexchange.com/feed.sh
wget -v -O $RECEIVER_BUILD_DIRECTORY/adsbexchange/feed-${action_to_perform}.sh https://www.adsbexchange.com/feed.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
else
wget -O $RECEIVER_BUILD_DIRECTORY/adsbexchange/feed-${action_to_perform}.sh https://www.adsbexchange.com/feed-update.sh
wget -v -O $RECEIVER_BUILD_DIRECTORY/adsbexchange/feed-${action_to_perform}.sh https://www.adsbexchange.com/feed-update.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
fi
echo ""
@ -75,7 +75,7 @@ if whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
12 78; then
LogMessage "Downloading the ADS-B Exchange stats package installation script"
echo ""
curl -L -o $RECEIVER_BUILD_DIRECTORY/adsbexchange/axstats.sh https://adsbexchange.com/stats.sh
wget -v -O $RECEIVER_BUILD_DIRECTORY/adsbexchange/axstats.sh https://adsbexchange.com/stats.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
echo -e "Executing the ADS-B Exchange stats package installation script"
echo ""

Wyświetl plik

@ -37,7 +37,7 @@ whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/airplaneslive ]]; then
LogMessage "Creating the airplanes.live build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/airplaneslive
mkdir -v $RECEIVER_BUILD_DIRECTORY/airplaneslive 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Entering the airplanes.live build directory"
@ -45,7 +45,7 @@ cd $RECEIVER_BUILD_DIRECTORY/airplaneslive
LogMessage "Downloading the airplanes.live client installation script"
echo ""
wget -v -O $RECEIVER_BUILD_DIRECTORY/airplaneslive/install.sh https://raw.githubusercontent.com/airplanes-live/feed/main/install.sh
wget -v -O $RECEIVER_BUILD_DIRECTORY/airplaneslive/install.sh https://raw.githubusercontent.com/airplanes-live/feed/main/install.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Executing the airplanes.live client installation script"

Wyświetl plik

@ -32,7 +32,7 @@ LogHeading "Begining the FlightRadar24 client installation process"
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/flightradar24 ]]; then
LogMessage "Creating the FlightRadar24 build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/flightradar24
mkdir -v $RECEIVER_BUILD_DIRECTORY/flightradar24 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Entering the FlightRadar24 build directory"
@ -40,7 +40,7 @@ cd $RECEIVER_BUILD_DIRECTORY/flightradar24
LogMessage "Downloading the airplanes.live client installation script"
echo ""
wget -v -O $RECEIVER_BUILD_DIRECTORY/flightradar24/install.sh https://fr24.com/install.sh
wget -v -O $RECEIVER_BUILD_DIRECTORY/flightradar24/install.sh https://fr24.com/install.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Executing the airplanes.live client installation script"

Wyświetl plik

@ -37,7 +37,7 @@ whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/flyitalyadsb ]]; then
LogMessage "Creating the Fly Italy ADS-B build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/flyitalyadsb
mkdir -v $RECEIVER_BUILD_DIRECTORY/flyitalyadsb 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Entering the Fly Italy ADS-B build directory"
@ -45,7 +45,7 @@ cd $RECEIVER_BUILD_DIRECTORY/flyitalyadsb
LogMessage "Downloading the Fly Italy ADS-B installation script"
echo ""
wget -v -O$RECEIVER_BUILD_DIRECTORY/flyitalyadsb/install.sh wget https://raw.githubusercontent.com/flyitalyadsb/mlat-client/master/scripts/install.sh
wget -v -O $RECEIVER_BUILD_DIRECTORY/flyitalyadsb/install.sh wget https://raw.githubusercontent.com/flyitalyadsb/mlat-client/master/scripts/install.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Executing the Fly Italy ADS-B feeder installation script"
echo ""
@ -59,7 +59,7 @@ if whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
12 78;
LogMessage "Downloading the Fly Italy ADS-B updater script"
echo ""
wget -v -O$RECEIVER_BUILD_DIRECTORY/flyitalyadsb/install_updater.sh wget https://raw.githubusercontent.com/flyitalyadsb/mlat-client/master/scripts/install_updater.sh
wget -v -O $RECEIVER_BUILD_DIRECTORY/flyitalyadsb/install_updater.sh wget https://raw.githubusercontent.com/flyitalyadsb/mlat-client/master/scripts/install_updater.sh 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Executing the Fly Italy ADS-B feeder updater script"
echo ""

Wyświetl plik

@ -42,7 +42,7 @@ if ! grep -q "^deb .*opensky." /etc/apt/sources.list /etc/apt/sources.list.d/*;
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/openskynetwork ]]; then
LogMessage "Creating the OpenSky Network build directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/openskynetwork
mkdir -v $RECEIVER_BUILD_DIRECTORY/openskynetwork 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Entering the OpenSky Network build directory"
@ -50,8 +50,8 @@ if ! grep -q "^deb .*opensky." /etc/apt/sources.list /etc/apt/sources.list.d/*;
LogMessage "Downloading and adding the OpenSky Network apt repository GPG key"
echo ""
wget -v -O $RECEIVER_BUILD_DIRECTORY/openskynetwork/opensky.gpg.pub https://opensky-network.org/files/firmware/opensky.gpg.pub
wget -q -O - https://opensky-network.org/files/firmware/opensky.gpg.pub | sudo apt-key add -
wget -v -O $RECEIVER_BUILD_DIRECTORY/openskynetwork/opensky.gpg.pub https://opensky-network.org/files/firmware/opensky.gpg.pub 2>&1 | tee -a $RECEIVER_LOG_FILE
wget -q -O - https://opensky-network.org/files/firmware/opensky.gpg.pub | sudo apt-key add - 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Adding the OpenSky Network apt repository"
sudo bash -c "echo deb https://opensky-network.org/repos/debian opensky custom > /etc/apt/sources.list.d/opensky.list"
@ -66,7 +66,7 @@ LogHeading "Installing the OpenSky Network feeder package"
LogMessage "Downloading the latest package lists for all enabled repositories and PPAs"
echo ""
sudo apt-get update
sudo apt-get update 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Installing the OpenSky Network fedder package using apt"
CheckPackage opensky-feeder

Wyświetl plik

@ -89,13 +89,17 @@ if [[ "${RECEIVER_OS_CODE_NAME}" == "focal" ]]; then
cd $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild
LogMessage "Updating the local tcltls-rebuild git repository"
echo ""
git pull
git pull 2>&1 | tee -a $RECEIVER_LOG_FILE
else
LogMessage "Entering the ADS-B Receiver Project build directory"
cd $RECEIVER_BUILD_DIRECTORY
LogMessage "Creating the tcltls-rebuild build directory"
echo ""
mkdir -v $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Entering the tcltls-rebuild build directory"
cd $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild
LogMessage "Cloning the tcltls-rebuild git repository locally"
echo ""
git clone https://github.com/flightaware/tcltls-rebuild
git clone https://github.com/flightaware/tcltls-rebuild 2>&1 | tee -a $RECEIVER_LOG_FILE
fi
echo ""
@ -110,11 +114,11 @@ if [[ "${RECEIVER_OS_CODE_NAME}" == "focal" ]]; then
cd $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/tcltls-1.7.22
LogMessage "Building the tcltls-rebuild package"
echo ""
dpkg-buildpackage -b
dpkg-buildpackage -b 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Installing the tcltls-rebuild package"
echo ""
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/tcl-tls_1.7.22-2+fa1_*.deb
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/tcl-tls_1.7.22-2+fa1_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Checking that the FlightAware tcltls-rebuild package was installed properly"
@ -134,12 +138,12 @@ if [[ "${RECEIVER_OS_CODE_NAME}" == "focal" ]]; then
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
LogMessage "Creating the package archive directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
mkdir -v $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Copying the FlightAware tcltls-rebuild Debian package into the archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
cp -vf $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
fi
fi
@ -153,13 +157,17 @@ if [[ -d $RECEIVER_BUILD_DIRECTORY/piaware_builder && -d $RECEIVER_BUILD_DIRECTO
cd $RECEIVER_BUILD_DIRECTORY/piaware_builder
LogMessage "Updating the local piaware_builder git repository"
echo ""
git pull
git pull 2>&1 | tee -a $RECEIVER_LOG_FILE
else
LogMessage "Creating the FlightAware piaware_builder build directory"
echo ""
mkdir -v $RECEIVER_BUILD_DIRECTORY/piaware_builder 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Entering the ADS-B Receiver Project build directory"
cd $RECEIVER_BUILD_DIRECTORY
LogMessage "Cloning the piaware_builder git repository locally"
echo ""
git clone https://github.com/flightaware/dump978.git
git clone https://github.com/flightaware/dump978.git 2>&1 | tee -a $RECEIVER_LOG_FILE
fi
echo ""
@ -184,20 +192,21 @@ case $RECEIVER_OS_CODE_NAME in
distro="bookworm"
;;
esac
LogMessage "Setting distribution to build for to ${distro}"
LogMessage "Executing the FlightAware PiAware client build script"
echo ""
./sensible-build.sh $distro
./sensible-build.sh $distro 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Entering the FlightAware PiAware client build directory"
cd $RECEIVER_BUILD_DIRECTORY/piaware_builder/package-${distro}
LogMessage "Building the FlightAware PiAware client package"
echo ""
dpkg-buildpackage -b
dpkg-buildpackage -b 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Installing the FlightAware PiAware client package"
echo ""
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/piaware_builder/piaware_*.deb 2>&1
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/piaware_builder/piaware_*.deb 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Checking that the FlightAware PiAware client package was installed properly"
@ -216,12 +225,12 @@ else
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
LogMessage "Creating the package archive directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
mkdir -v $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Copying the FlightAware PiAware client binary package into the archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi

Wyświetl plik

@ -85,22 +85,22 @@ cd $RECEIVER_BUILD_DIRECTORY/planefinder
LogMessage "Downloading the appropriate PlaneFinder client Debian package"
echo ""
wget -v -O --no-check-certificate http://client.planefinder.net/$PACKAGE_NAME $RECEIVER_BUILD_DIRECTORY/planefinder/$PACKAGE_NAME
wget -v -O --no-check-certificate http://client.planefinder.net/$PACKAGE_NAME $RECEIVER_BUILD_DIRECTORY/planefinder/$PACKAGE_NAME 2>&1 | tee -a $RECEIVER_LOG_FILE
LogMessage "Installing the PlaneFinder Client Debian package"
echo -e ""
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/planefinder/$package_name
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/planefinder/$package_name 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
LogMessage "Creating the package archive directory"
echo ""
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
mkdir -v $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
LogMessage "Copying the PlaneFinder client Debian package into the archive directory"
echo ""
cp -vf $RECEIVER_BUILD_DIRECTORY/planefinder/$package_name $RECEIVER_BUILD_DIRECTORY/package-archive/
cp -vf $RECEIVER_BUILD_DIRECTORY/planefinder/$package_name $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""

Wyświetl plik

@ -2,14 +2,36 @@
## LOGGING FUNCTIONS
# LogToFile <message> <append_timestamp> <inline>
function LogToFile {
if [[ "${RECEIVER_LOGGING_ENABLED}" == "true" ]]; then
time_stamp=''
if [[ -z $2 || "${2}" == "true" ]]; then
printf -v time_stamp '[%(%Y-%m-%d %H:%M:%S)T]' -1
fi
if [[ ! -z $3 && "${3}" == "inline" ]]; then
printf "${time_stamp} ${1}" >> $RECEIVER_LOG_FILE
else
echo "${time_stamp} ${1}" >> $RECEIVER_LOG_FILE
fi
fi
}
function LogOutput {
LogToFile "${1}"
}
# Logs the "PROJECT TITLE" to the console
function LogProjectTitle {
LogToFile "${RECEIVER_PROJECT_TITLE}"
echo -e "${DISPLAY_PROJECT_NAME} ${RECEIVER_PROJECT_TITLE}${DISPLAY_DEFAULT}"
echo ""
}
# Logs a "HEADING" to the console
function LogHeading {
LogToFile "${1}"
echo ""
echo -e "${DISPLAY_HEADING} ${1}${DISPLAY_DEFAULT}"
echo ""
@ -17,48 +39,58 @@ function LogHeading {
# Logs a "MESSAGE" to the console
function LogMessage {
LogToFile "${1}"
echo -e "${DISPLAY_MESSAGE} ${1}${DISPLAY_DEFAULT}"
}
# Logs an alert "HEADING" to the console
function LogAlertHeading {
LogToFile "${1}"
echo -e "${DISPLAY_ALERT_HEADING} ${1}${DISPLAY_DEFAULT}"
}
# Logs an alert "MESSAGE" to the console
function LogAlertMessage {
LogToFile "${1}"
echo -e "${DISPLAY_ALERT_MESSAGE} ${1}${DISPLAY_DEFAULT}"
}
# Logs an title "HEADING" to the console
function LogTitleHeading {
LogToFile "${1}"
echo -e "${DISPLAY_TITLE_HEADING} ${1}${DISPLAY_DEFAULT}"
}
# Logs an title "MESSAGE" to the console
function LogTitleMessage {
LogToFile "${1}"
echo -e "${DISPLAY_TITLE_MESSAGE} ${1}${DISPLAY_DEFAULT}"
}
# Logs a warning "HEADING" to the console
function LogWarningHeading {
LogToFile "${1}"
echo -e "${DISPLAY_WARNING_HEADING} ${1}${DISPLAY_DEFAULT}"
}
# Logs a warning "MESSAGE" to the console
function LogWarningMessage {
LogToFile "${1}"
echo -e "${DISPLAY_WARNING_MESSAGE} ${1}${DISPLAY_DEFAULT}"
}
function LogMessageInline {
LogToFile "${1}" "true" "inline"
printf "${DISPLAY_MESSAGE} ${1}${DISPLAY_DEFAULT}"
}
function LogFalseInline {
LogToFile "${1}" "false"
echo -e "${DISPLAY_FALSE_INLINE} ${1}${DISPLAY_DEFAULT}"
}
function LogTrueInline {
LogToFile "${1}" "false"
echo -e "${DISPLAY_TRUE_INLINE} ${1}${DISPLAY_DEFAULT}"
}
@ -90,7 +122,7 @@ function CheckPackage {
fi
echo ""
attempt=$((attempt+1))
sudo apt-get install -y $1
sudo apt-get install -y $1 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
else
LogTrueInline "[OK]"

Wyświetl plik

@ -11,12 +11,14 @@ source $RECEIVER_BASH_DIRECTORY/functions.sh
LogHeading "Displaying the welcome message"
LogMessage "Displaying the welcome message to the user"
echo ""
if ! whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--title "The ADS-B Receiver Project" \
--yesno "Thanks for choosing The ADS-B Receiver Project to setup your receiver.\n\nMore information on this project as well as news, support, and discussions can be found on the projects official website located at:\n\n https://www.adsbreceiver.net\n\nWould you like to continue setup?" \
14 78; then
LogAlertHeading "INSTALLATION HALTED"
LogAlertMessage "Setup has been halted at the request of the user"
echo ""
exit 1
fi
@ -41,11 +43,12 @@ if [[ $RECEIVER_DEVELOPMENT_MODE != "true" ]]; then
--yesno "There appears to be changes to the current branch. In order to switch to or fetch the ${current_branch} branch these changes will need to be stashed. Would you like to stash these changes now?" \
14 78; then
LogMessage "Stashing changes made to the ${current_branch} branch"
git stash
git stash 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
else
LogAlertHeading "INSTALLATION HALTED"
LogAlertMessage "Setup has been halted at the request of the user"
echo ""
exit 1
fi
fi
@ -53,14 +56,14 @@ if [[ $RECEIVER_DEVELOPMENT_MODE != "true" ]]; then
if [[ "${current_branch}" != "${RECEIVER_PROJECT_BRANCH}" ]]; then
LogMessage "Switching to branch ${RECEIVER_PROJECT_BRANCH}"
echo ""
git checkout $RECEIVER_PROJECT_BRANCH
git checkout $RECEIVER_PROJECT_BRANCH 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
fi
if [[ `git ls-remote --heads https://github.com/jprochazka/adsb-receiver.git refs/heads/$RECEIVER_PROJECT_BRANCH | wc -l` = 1 ]]; then
LogMessage "Fetching branch ${RECEIVER_PROJECT_BRANCH} from origin"
echo ""
git fetch origin
git fetch origin 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogMessage "Performing hard reset of branch ${RECEIVER_PROJECT_BRANCH} so it matches origin/${RECEIVER_PROJECT_BRANCH}"
echo ""
@ -92,7 +95,7 @@ if whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
echo ""
LogMessage "Updating the operating system using apt-get"
echo ""
sudo apt-get -y dist-upgrade
sudo apt-get -y dist-upgrade 2>&1 | tee -a $RECEIVER_LOG_FILE
echo ""
LogTitleMessage "------------------------------------------------------------------------"
LogTitleHeading "Your operating system should now be up to date"
@ -124,6 +127,9 @@ whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" \
--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\n https://github.com/jprochazka/adsb-receiver" \
20 65
LogProjectName "Installation complete"
echo ""
LogAlertHeading "Installation complete"
echo ""
exit 0

Wyświetl plik

@ -69,7 +69,6 @@ function InstallFlyItalyAdsb() {
fi
}
# Execute the OpenSky Network setup script.
function InstallOpenSkyNetwork() {
chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/openskynetwork.sh
@ -465,7 +464,7 @@ fi
RUN_ADSBEXCHANGE_SCRIPT="false"
RUN_PIAWARE_SCRIPT="false"
RUN_FLIGHTRADAR24_SCRIPT="false"
RUN_FLYITALYADSB_SCRIPT
RUN_FLYITALYADSB_SCRIPT="false"
RUN_OPENSKYNETWORK_SCRIPT="false"
RUN_PLANEFINDER_SCRIPT="false"

15
build/.gitignore vendored
Wyświetl plik

@ -1,15 +0,0 @@
# exclude build directories
AboveTustin/
adsbexchange/
acarsdec/
dump1090*
gps/
hab/
mlat-client/
mlat-client*
ogn/
phantomjs*
piaware_builder/
planefinder/
portal/graphs/dump1090.pyc
portal/logging/

Wyświetl plik

@ -35,10 +35,15 @@
#####################################################################################
## ASSIGN VERSION VARIABLE
## ASSIGN VARIABLE
project_version="2.8.5"
printf -v date_time '%(%Y-%m-%d_%H-%M-%S)T' -1
log_file="adsb-installer_${date_time}.log"
logging_enabled="true"
## FUNCTIONS
# Display the help message
@ -53,6 +58,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 "-n --no-logging Disables writing output to a log file. "
echo "-v --version Displays the version being used. "
echo "-------------------------------------------------------------------------------------------"
echo " "
@ -64,22 +70,18 @@ function DisplayHelp() {
while [[ $# > 0 ]] ; do
case $1 in
--branch*)
# The specified branch of github
project_branch=`echo $1 | sed -e 's/^[^=]*=//g'`
shift 1
;;
-b)
# The specified branch of github
project_branch=$2
shift 2
;;
--development | -d)
# Skip adsb-receiver repository update
development_mode="true"
shift 1
;;
--help | -h)
# Display a help message
DisplayHelp
exit 0
;;
@ -91,6 +93,10 @@ while [[ $# > 0 ]] ; do
fi
shift 1
;;
--no-logging | -n)
logging_enabled="false"
shift 1
;;
-m)
# The MTA to use
mta=${2^^}
@ -114,9 +120,9 @@ while [[ $# > 0 ]] ; do
esac
done
# Add any environmental variables needed by any child scripts
export RECEIVER_PROJECT_BRANCH=$project_branch
export RECEIVER_DEVELOPMENT_MODE=$development_mode
export RECEIVER_LOGGING_ENABLED=$logging_enabled
export RECEIVER_MTA=$mta
@ -136,6 +142,17 @@ source $RECEIVER_BASH_DIRECTORY/functions.sh
source $RECEIVER_BASH_DIRECTORY/variables.sh
## CREATE THE LOG DIRECTORY
if [[ "${RECEIVER_LOGGING_ENABLED}" == "true" ]]; then
export RECEIVER_LOG_FILE=$PWD/logs/$log_file
if [ ! -d "$DIRECTORY" ]; then
LogMessage "Creating logs directory"
mkdir $PWD/logs
fi
fi
## UPDATE PACKAGE LISTS AND INSTALL DEPENDENCIES
clear
@ -147,7 +164,7 @@ 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
sudo apt-get update 2>&1 | tee -a $RECEIVER_LOG_FILE
LogHeading "Ensuring that all required packages are installed"
@ -185,14 +202,12 @@ $RECEIVER_BASH_DIRECTORY/init.sh
## CLEAN UP
# Remove any files created by whiptail.
for choice in FEEDER_CHOICES EXTRAS_CHOICES ; do
if [[ -f ${RECEIVER_ROOT_DIRECTORY}/${choice} ]] ; then
rm -f ${RECEIVER_ROOT_DIRECTORY}/${choice}
fi
done
# Remove any global variables assigned by this script
unset RECEIVER_PROJECT_TITLE
unset RECEIVER_ROOT_DIRECTORY
unset RECEIVER_BASH_DIRECTORY
@ -204,6 +219,8 @@ unset RECIEVER_CPU_ARCHITECTURE
unset RECEIVER_CPU_REVISION
unset RECEIVER_PROJECT_BRANCH
unset RECEIVER_DEVELOPMENT_MODE
unset RECEIVER_LOGGING_ENABLED
unset RECEIVER_LOG_FILE
unset RECEIVER_MTA
# Check if any errors were encountered by any child scripts