2015-11-04 04:48:08 +00:00
#!/bin/bash
2024-07-19 19:58:45 +00:00
# THE FLIGHTAWARE PIAWARE CLIENT SETUP SCRIPT
2024-06-30 03:49:36 +00:00
2024-07-23 21:50:50 +00:00
# JPROCHAZKA/PIAWARE_BUILDER REPOSITORY
2024-10-18 13:11:46 +00:00
# -------------------------------------------------------------------------------------
2024-07-23 21:50:50 +00:00
# I submitted a fix to support Debian Trixie and Ubuntu Noble Numbat to FlightAware's
# piaware_builder repository. Until the changes are merged into their Git reposiory
# the installation will be done using the fork I created along with the branch which
# contains the changes needed in order to build the package.
#
# https://github.com/flightaware/piaware_builder/pull/26
2024-07-19 20:04:56 +00:00
# TCLTLS-REBUILD
2024-10-18 13:11:46 +00:00
# -------------------------------------------------------------------------------------
2024-07-19 21:00:17 +00:00
# Along with PiAware, a version of tcltls maintained by FlightAware can be installed.
2024-10-18 13:11:46 +00:00
# This package is only needed for any distribution utilizing tcl-tls 1.7.22-2 or older.
2024-07-19 21:00:17 +00:00
#
2024-10-18 13:11:46 +00:00
# This fix may need to remain in place until Debian Bullseye hits end of life.
2024-07-19 20:04:56 +00:00
2024-06-30 03:49:36 +00:00
2024-07-19 19:58:45 +00:00
## PRE INSTALLATION OPERATIONS
2024-06-30 03:49:36 +00:00
2024-07-19 19:58:45 +00:00
source $RECEIVER_BASH_DIRECTORY /variables.sh
source $RECEIVER_BASH_DIRECTORY /functions.sh
2017-10-02 19:36:29 +00:00
2024-06-18 20:37:40 +00:00
clear
2024-07-23 21:39:20 +00:00
log_project_title
log_title_heading "Setting up the FlightAware PiAware client"
log_title_message "------------------------------------------------------------------------------"
2024-07-22 00:58:36 +00:00
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
2024-07-23 18:45:59 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_alert_heading "INSTALLATION HALTED"
log_alert_message "Setup has been halted at the request of the user"
2024-06-18 20:37:40 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_title_message "------------------------------------------------------------------------------"
log_title_heading "FlightAware PiAware client setup halted"
2017-10-03 18:08:52 +00:00
echo ""
2016-09-02 20:47:46 +00:00
exit 1
fi
2015-11-04 04:48:08 +00:00
2024-06-30 03:49:36 +00:00
## CHECK FOR PREREQUISITE PACKAGES
2015-11-04 04:48:08 +00:00
2024-07-23 21:39:20 +00:00
log_heading "Installing packages needed to fulfill FlightAware PiAware client dependencies"
check_package autoconf
check_package build-essential
check_package chrpath
check_package debhelper
check_package devscripts
check_package git
check_package itcl3
check_package libboost-filesystem-dev
check_package libboost-program-options-dev
check_package libboost-regex-dev
check_package libboost-system-dev
check_package libssl-dev
check_package net-tools
check_package openssl
check_package patchelf
check_package python3-dev
check_package python3-pip
check_package python3-setuptools
check_package python3-venv
check_package python3-wheel
check_package tcl-dev
check_package tcl8.6-dev
check_package tcllib
check_package tclx8.4
check_package zlib1g-dev
2024-06-28 04:32:18 +00:00
2024-07-19 21:00:17 +00:00
if [ [ " ${ RECEIVER_OS_CODE_NAME } " = = "noble" ] ] ; then
2024-08-23 15:51:56 +00:00
check_package python3-filelock
2024-07-23 21:39:20 +00:00
check_package python3-pyasyncore
2024-07-19 19:58:45 +00:00
fi
2024-07-19 21:00:17 +00:00
if [ [ " ${ RECEIVER_OS_CODE_NAME } " = = "focal" ] ] ; then
2024-07-23 21:39:20 +00:00
check_package python3-dev
2024-07-19 19:58:45 +00:00
else
2024-07-23 21:39:20 +00:00
check_package python3-build
check_package tcl-tls
2024-07-19 19:58:45 +00:00
fi
2024-06-28 04:32:18 +00:00
2024-06-30 03:49:36 +00:00
2024-07-19 19:58:45 +00:00
## CLONE OR PULL THE TCLTLS REBUILD GIT REPOSITORY
2024-10-18 13:11:46 +00:00
if [ [ " ${ RECEIVER_OS_CODE_NAME } " = = "focal" || " ${ RECEIVER_OS_CODE_NAME } " = = "bullseye" ] ] ; then
2024-06-14 21:02:23 +00:00
2024-07-23 21:39:20 +00:00
log_heading "Preparing the FlightAware tcltls-rebuild Git repository"
2024-07-19 21:00:17 +00:00
if [ [ -d $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild && -d $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild/.git ] ] ; then
2024-07-23 21:39:20 +00:00
log_message "Entering the tcltls-rebuild git repository directory"
2024-07-19 21:00:17 +00:00
cd $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild
2024-07-23 21:39:20 +00:00
log_message "Updating the local tcltls-rebuild git repository"
2024-07-19 21:00:17 +00:00
echo ""
2024-07-22 21:57:59 +00:00
git pull 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-07-19 21:00:17 +00:00
else
2024-07-23 21:39:20 +00:00
log_message "Creating the tcltls-rebuild build directory"
2024-07-22 21:57:59 +00:00
echo ""
mkdir -v $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild 2>& 1 | tee -a $RECEIVER_LOG_FILE
echo ""
2024-07-23 21:39:20 +00:00
log_message "Entering the tcltls-rebuild build directory"
2024-07-22 21:57:59 +00:00
cd $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild
2024-07-23 21:39:20 +00:00
log_message "Cloning the tcltls-rebuild git repository locally"
2024-07-19 21:00:17 +00:00
echo ""
2024-07-22 21:57:59 +00:00
git clone https://github.com/flightaware/tcltls-rebuild 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-07-19 21:00:17 +00:00
fi
2024-06-14 21:02:23 +00:00
echo ""
2024-06-18 20:37:40 +00:00
2024-06-30 03:49:36 +00:00
2024-07-19 21:00:17 +00:00
## BUILD AND INSTALL THE TCLTLS-REBUILD PACKAGE
2024-06-18 20:37:40 +00:00
2024-07-23 21:39:20 +00:00
log_heading "Beginning the FlightAware tcltls-rebuild installation process"
2024-06-14 21:02:23 +00:00
2024-07-23 21:39:20 +00:00
log_message "Checking if the FlightAware tcltls-rebuild is required"
2024-06-14 21:26:09 +00:00
2024-07-23 21:39:20 +00:00
log_message "Entering the tcltls-rebuild source directory"
2024-07-19 21:00:17 +00:00
cd $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild/tcltls-1.7.22
2024-07-23 21:39:20 +00:00
log_message "Building the tcltls-rebuild package"
2024-07-19 19:58:45 +00:00
echo ""
2024-07-22 21:57:59 +00:00
dpkg-buildpackage -b 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-07-19 19:58:45 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_message "Installing the tcltls-rebuild package"
2024-07-19 19:58:45 +00:00
echo ""
2024-07-22 21:57:59 +00:00
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild/tcl-tls_1.7.22-2+fa1_*.deb 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-07-19 19:58:45 +00:00
echo ""
2024-07-19 21:00:17 +00:00
2024-07-23 21:39:20 +00:00
log_message "Checking that the FlightAware tcltls-rebuild package was installed properly"
2024-07-19 21:00:17 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' tcltls 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ] ; then
2024-07-19 19:58:45 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_alert_heading "INSTALLATION HALTED"
2024-07-19 21:00:17 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_alert_message "FlightAware tcltls-rebuild package installation failed"
log_alert_message "Setup has been terminated"
2024-07-19 21:00:17 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_title_message "------------------------------------------------------------------------------"
"FlightAware PiAware client setup failed"
2024-07-19 21:00:17 +00:00
echo ""
read -p "Press enter to continue..." discard
exit 1
else
if [ [ ! -d $RECEIVER_BUILD_DIRECTORY /package-archive ] ] ; then
2024-07-23 21:39:20 +00:00
log_message "Creating the package archive directory"
2024-07-19 21:00:17 +00:00
echo ""
2024-07-22 21:57:59 +00:00
mkdir -v $RECEIVER_BUILD_DIRECTORY /package-archive 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-07-19 21:00:17 +00:00
echo ""
fi
2024-07-23 21:39:20 +00:00
log_message "Copying the FlightAware tcltls-rebuild Debian package into the archive directory"
2024-07-19 21:00:17 +00:00
echo ""
2024-07-22 21:57:59 +00:00
cp -vf $RECEIVER_BUILD_DIRECTORY /tcltls-rebuild/*.deb $RECEIVER_BUILD_DIRECTORY /package-archive/ 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-07-19 19:58:45 +00:00
fi
fi
2024-06-14 21:26:09 +00:00
2024-07-19 19:58:45 +00:00
## CLONE OR PULL THE PIAWARE_BUILDER GIT REPOSITORY
2017-10-02 19:36:29 +00:00
2024-07-23 21:39:20 +00:00
log_heading "Preparing the FlightAware piaware_builder Git repository"
2015-12-27 05:15:39 +00:00
2024-06-30 03:49:36 +00:00
if [ [ -d $RECEIVER_BUILD_DIRECTORY /piaware_builder && -d $RECEIVER_BUILD_DIRECTORY /piaware_builder/.git ] ] ; then
2024-07-23 21:39:20 +00:00
log_message "Entering the piaware_builder git repository directory"
2024-07-19 19:58:45 +00:00
cd $RECEIVER_BUILD_DIRECTORY /piaware_builder
2024-07-23 21:39:20 +00:00
log_message "Updating the local piaware_builder git repository"
2017-10-03 18:08:52 +00:00
echo ""
2024-07-22 21:57:59 +00:00
git pull 2>& 1 | tee -a $RECEIVER_LOG_FILE
2015-12-27 05:15:39 +00:00
else
2024-07-23 21:39:20 +00:00
log_message "Creating the FlightAware piaware_builder build directory"
2024-07-22 21:57:59 +00:00
echo ""
mkdir -v $RECEIVER_BUILD_DIRECTORY /piaware_builder 2>& 1 | tee -a $RECEIVER_LOG_FILE
echo ""
2024-07-23 21:39:20 +00:00
log_message "Entering the ADS-B Receiver Project build directory"
2024-07-19 19:58:45 +00:00
cd $RECEIVER_BUILD_DIRECTORY
2024-07-23 21:39:20 +00:00
log_message "Cloning the piaware_builder git repository locally"
2017-10-03 18:08:52 +00:00
echo ""
2024-07-23 21:50:50 +00:00
# --- START TEMPORARY NOBLE FIX ---
if [ [ " ${ RECEIVER_OS_CODE_NAME } " = = "noble" ] ] ; then
2024-10-18 19:43:04 +00:00
git clone -b trixie https://github.com/jprochazka/piaware_builder.git 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-07-23 21:50:50 +00:00
else
git clone https://github.com/flightaware/piaware_builder.git 2>& 1 | tee -a $RECEIVER_LOG_FILE
fi
#git clone https://github.com/flightaware/piaware_builder.git 2>&1 | tee -a $RECEIVER_LOG_FILE
# --- END TEMPORARY NOBLE FIX ---
2015-12-27 05:15:39 +00:00
fi
2015-11-04 04:48:08 +00:00
2024-06-30 03:49:36 +00:00
2024-07-19 21:00:17 +00:00
## BUILD AND INSTALL THE PIAWARE CLIENT PACKAGE
2015-11-04 04:48:08 +00:00
2024-07-23 21:39:20 +00:00
log_heading "Beginning the FlightAware PiAware installation process"
2017-10-02 19:36:29 +00:00
2024-07-23 21:39:20 +00:00
log_message "Entering the piaware_builder git repository directory"
2024-07-19 19:58:45 +00:00
cd $RECEIVER_BUILD_DIRECTORY /piaware_builder
2016-08-31 15:46:10 +00:00
2024-07-23 21:39:20 +00:00
log_message "Determining which piaware_builder build strategy should be use"
2024-06-30 03:49:36 +00:00
distro = "bookworm"
case $RECEIVER_OS_CODE_NAME in
2024-07-19 21:00:17 +00:00
focal)
2024-06-30 03:49:36 +00:00
distro = "buster"
2024-06-14 16:02:25 +00:00
; ;
2024-06-28 04:32:18 +00:00
bullseye | jammy)
2024-06-30 03:49:36 +00:00
distro = "bullseye"
2024-06-14 16:02:25 +00:00
; ;
2024-08-23 15:51:56 +00:00
bookworm | Focal)
2024-06-30 03:49:36 +00:00
distro = "bookworm"
2024-06-14 16:02:25 +00:00
; ;
2024-08-23 15:51:56 +00:00
noble)
distro = "trixie"
; ;
2024-06-14 16:02:25 +00:00
esac
2024-07-23 21:39:20 +00:00
log_message " Setting distribution to build for to ${ distro } "
2024-07-19 19:58:45 +00:00
2024-07-23 21:39:20 +00:00
log_message "Executing the FlightAware PiAware client build script"
2024-06-14 16:02:25 +00:00
echo ""
2024-07-22 21:57:59 +00:00
./sensible-build.sh $distro 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-06-14 16:02:25 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_message "Entering the FlightAware PiAware client build directory"
2024-07-19 19:58:45 +00:00
cd $RECEIVER_BUILD_DIRECTORY /piaware_builder/package-${ distro }
2024-07-23 21:39:20 +00:00
log_message "Building the FlightAware PiAware client package"
2024-06-14 16:02:25 +00:00
echo ""
2024-07-22 21:57:59 +00:00
dpkg-buildpackage -b 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-06-14 16:02:25 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_message "Installing the FlightAware PiAware client package"
2024-06-14 16:02:25 +00:00
echo ""
2024-07-22 21:57:59 +00:00
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY /piaware_builder/piaware_*.deb 2>& 1 | tee -a $RECEIVER_LOG_FILE
2024-06-14 16:02:25 +00:00
echo ""
2017-10-02 19:36:29 +00:00
2024-07-23 21:39:20 +00:00
log_message "Checking that the FlightAware PiAware client package was installed properly"
2024-06-30 03:49:36 +00:00
if [ [ $( dpkg-query -W -f= '${STATUS}' piaware 2>/dev/null | grep -c "ok installed" ) -eq 0 ] ] ; then
2024-07-23 21:39:20 +00:00
log_alert_heading "INSTALLATION HALTED"
2017-10-03 18:08:52 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_alert_message "FlightAware PiAware package installation failed"
log_alert_message "Setup has been terminated"
2017-10-03 18:08:52 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_title_message "------------------------------------------------------------------------------"
log_title_heading "FlightAware PiAware client setup failed"
2017-10-03 18:08:52 +00:00
echo ""
2024-06-30 03:49:36 +00:00
read -p "Press enter to continue..." discard
2024-06-14 16:02:25 +00:00
exit 1
else
2024-06-30 03:49:36 +00:00
if [ [ ! -d $RECEIVER_BUILD_DIRECTORY /package-archive ] ] ; then
2024-07-23 21:39:20 +00:00
log_message "Creating the package archive directory"
2017-10-03 18:08:52 +00:00
echo ""
2024-07-22 21:57:59 +00:00
mkdir -v $RECEIVER_BUILD_DIRECTORY /package-archive 2>& 1 | tee -a $RECEIVER_LOG_FILE
2017-10-03 18:08:52 +00:00
echo ""
2017-10-02 19:36:29 +00:00
fi
2024-07-23 21:39:20 +00:00
log_message "Copying the FlightAware PiAware client binary package into the archive directory"
2024-06-14 16:02:25 +00:00
echo ""
2024-07-22 21:57:59 +00:00
cp -vf $RECEIVER_BUILD_DIRECTORY /piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY /package-archive/ 2>& 1 | tee -a $RECEIVER_LOG_FILE
2016-08-31 15:46:10 +00:00
fi
2015-11-04 04:48:08 +00:00
2024-06-30 03:49:36 +00:00
2024-07-19 19:58:45 +00:00
## POST INSTALLATION OPERATIONS
2024-07-23 21:39:20 +00:00
log_heading "Performing post installation operations"
2017-09-28 02:02:45 +00:00
2024-07-23 21:39:20 +00:00
log_message "Displaying the message informing the user on how to claim their device"
2024-07-22 06:04:59 +00:00
whiptail --backtitle " ${ RECEIVER_PROJECT_TITLE } " \
--title "Claiming Your PiAware Device" \
--msgbox "FlightAware requires you claim your feeder online using the following URL:\n\n http://flightaware.com/adsb/piaware/claim\n\nTo claim your device simply visit the address listed above." \
12 78
2015-12-15 17:33:59 +00:00
2024-06-30 03:49:36 +00:00
## SETUP COMPLETE
2016-01-23 19:39:21 +00:00
2024-07-23 21:39:20 +00:00
log_message " Returning to ${ RECEIVER_PROJECT_TITLE } root directory "
2024-07-19 19:58:45 +00:00
cd $RECEIVER_ROOT_DIRECTORY
2015-11-04 04:48:08 +00:00
2017-10-03 18:08:52 +00:00
echo ""
2024-07-23 21:39:20 +00:00
log_title_message "------------------------------------------------------------------------------"
log_title_heading "FlightAware PiAware client setup is complete"
2017-10-03 18:08:52 +00:00
echo ""
2024-06-30 03:49:36 +00:00
read -p "Press enter to continue..." discard
2016-09-06 18:32:28 +00:00
2024-07-22 00:58:36 +00:00
exit 0