kopia lustrzana https://github.com/jprochazka/adsb-receiver
Added untested Nobel support and logging foundations.
rodzic
7c91ec632b
commit
0bd32ef097
|
@ -1,38 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
## INCLUDE EXTERNAL SCRIPTS
|
||||
# THE FLIGHTAWARE PIAWARE CLIENT SETUP SCRIPT
|
||||
|
||||
|
||||
## PRE INSTALLATION OPERATIONS
|
||||
|
||||
source $RECEIVER_BASH_DIRECTORY/variables.sh
|
||||
source $RECEIVER_BASH_DIRECTORY/functions.sh
|
||||
|
||||
|
||||
## BEGIN SETUP
|
||||
|
||||
clear
|
||||
echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}"
|
||||
echo ""
|
||||
echo -e "\e[92m Setting up FlightAware PiAware client..."
|
||||
echo ""
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
|
||||
LogProjectName ${RECEIVER_PROJECT_TITLE}
|
||||
LogTitleHeading "Setting up the FlightAware PiAware Client"
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
echo ""
|
||||
|
||||
# Confirm component installation
|
||||
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
|
||||
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
|
||||
echo -e " Setup has been halted at the request of the user."
|
||||
LogAlertHeading "INSTALLATION HALTED"
|
||||
LogAlertMessage "Setup has been halted at the request of the user"
|
||||
echo ""
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m FlightAware PiAware client setup halted.\e[39m"
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "ADS-B Receiver Portal 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 fulfill dependencies for FlightAware PiAware client...\e[97m"
|
||||
echo ""
|
||||
LogHeading "Installing packages needed to fulfill dependencies for FlightAware PiAware client"
|
||||
|
||||
CheckPackage build-essential
|
||||
CheckPackage git
|
||||
CheckPackage devscripts
|
||||
|
@ -60,96 +56,109 @@ CheckPackage libssl-dev
|
|||
CheckPackage tcl-dev
|
||||
CheckPackage chrpath
|
||||
|
||||
# Some older distros may need different packages than newer ones
|
||||
case ${RECEIVER_OS_CODE_NAME} in
|
||||
focal)
|
||||
CheckPackage python3-dev
|
||||
;;
|
||||
*)
|
||||
CheckPackage python3-build
|
||||
;;
|
||||
esac
|
||||
if "${RECEIVER_OS_CODE_NAME}" == "noble"
|
||||
CheckPackage python3-pyasyncore
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
|
||||
## DOWNLOAD OR UPDATE THE TCLTLS REBUILD SOURCE
|
||||
|
||||
echo -e "\e[95m Preparing the tcltls rebuild Git repository...\e[97m"
|
||||
echo ""
|
||||
# Build the FlightAware version of tcl-tls to address network issues with the stock package
|
||||
if [[ -d $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild && -d $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/.git ]]; then
|
||||
# A directory with a git repository containing the source code already exists
|
||||
echo -e "\e[94m Entering the tcltls-rebuild git repository directory...\e[97m"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild 2>&1
|
||||
echo -e "\e[94m Updating the local tcltls-rebuild git repository...\e[97m"
|
||||
echo ""
|
||||
git pull 2>&1
|
||||
if "${RECEIVER_OS_CODE_NAME}" == "focal"
|
||||
CheckPackage python3-dev
|
||||
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 $RECEIVER_BUILD_DIRECTORY 2>&1
|
||||
echo -e "\e[94m Cloning the tcltls-rebuild git repository locally...\e[97m"
|
||||
CheckPackage python3-build
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
|
||||
## CLONE OR PULL THE TCLTLS REBUILD GIT REPOSITORY
|
||||
|
||||
LogHeading "Preparing the FlightAware tcltls-rebuild Git repository"
|
||||
|
||||
if [[ -d $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild && -d $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/.git ]]; then
|
||||
LogMessage "Entering the tcltls-rebuild git repository directory"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild
|
||||
LogMessage "Updating the local tcltls-rebuild git repository"
|
||||
echo ""
|
||||
git clone https://github.com/flightaware/tcltls-rebuild 2>&1
|
||||
git pull
|
||||
else
|
||||
LogMessage "Entering the ADS-B Receiver Project build directory"
|
||||
cd $RECEIVER_BUILD_DIRECTORY
|
||||
LogMessage "Cloning the tcltls-rebuild git repository locally"
|
||||
echo ""
|
||||
git clone https://github.com/flightaware/tcltls-rebuild
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
## BUILD AND INSTALL THE DUMP1090-FA PACKAGE
|
||||
## BUILD AND INSTALL THE TCLTLS-REBUILD PACKAGE
|
||||
|
||||
echo -e "\e[95m Building and installing the tcltls rebuild package...\e[97m"
|
||||
echo -e ""
|
||||
LogHeading "Beginning the FlightAware tcltls-rebuild installation process"
|
||||
|
||||
echo -e "\e[94m Entering the tcltls-rebuild source directory...\e[97m"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/tcltls-1.7.22 2>&1
|
||||
echo -e "\e[94m Building the tcltls-rebuild package...\e[97m"
|
||||
LogMessage "Entering the tcltls-rebuild source directory"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/tcltls-1.7.22
|
||||
LogMessage "Building the tcltls-rebuild package"
|
||||
echo ""
|
||||
dpkg-buildpackage -b 2>&1
|
||||
dpkg-buildpackage -b
|
||||
echo ""
|
||||
echo -e "\e[94m Installing the tcltls-rebuild package...\e[97m"
|
||||
LogMessage "Installing the tcltls-rebuild package"
|
||||
echo ""
|
||||
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/tcl-tls_1.7.22-2+fa1_*.deb 2>&1
|
||||
echo ""
|
||||
echo -e "\e[94m Moving the tcltls-rebuild binary package into the archive directory...\e[97m"
|
||||
echo ""
|
||||
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/ 2>&1
|
||||
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/tcl-tls_1.7.22-2+fa1_*.deb
|
||||
echo ""
|
||||
|
||||
LogMessage "Checking that the FlightAware tcltls-rebuild package was installed properly"
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' tcltls 2>/dev/null | grep -c "ok installed") -eq 0 ]]; then
|
||||
echo ""
|
||||
LogAlertHeading "INSTALLATION HALTED"
|
||||
echo ""
|
||||
LogAlertMessage "FlightAware tcltls-rebuild package installation failed"
|
||||
LogAlertMessage "Setup has been terminated"
|
||||
echo ""
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "FlightAware PiAware client setup failed"
|
||||
echo ""
|
||||
read -p "Press enter to continue..." discard
|
||||
exit 1
|
||||
else
|
||||
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
|
||||
LogMessage "Creating the package archive directory"
|
||||
echo ""
|
||||
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
|
||||
echo ""
|
||||
fi
|
||||
LogMessage "Copying the FlightAware tcltls-rebuild binary package into the archive directory"
|
||||
echo ""
|
||||
cp -vf $RECEIVER_BUILD_DIRECTORY/tcltls-rebuild/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
|
||||
echo ""
|
||||
fi
|
||||
|
||||
## START INSTALLATION
|
||||
|
||||
echo -e "\e[95m Begining the FlightAware PiAware client installation process...\e[97m"
|
||||
echo ""
|
||||
## CLONE OR PULL THE PIAWARE_BUILDER GIT REPOSITORY
|
||||
|
||||
LogHeading "Preparing the FlightAware piaware_builder Git repository"
|
||||
|
||||
if [[ -d $RECEIVER_BUILD_DIRECTORY/piaware_builder && -d $RECEIVER_BUILD_DIRECTORY/piaware_builder/.git ]]; then
|
||||
# A directory with a git repository containing the source code already exists
|
||||
echo -e "\e[94m Entering the piaware_builder git repository directory...\e[97m"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/piaware_builder 2>&1
|
||||
echo -e "\e[94m Updating the local piaware_builder git repository...\e[97m"
|
||||
LogMessage "Entering the piaware_builder git repository directory"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/piaware_builder
|
||||
LogMessage "Updating the local piaware_builder git repository"
|
||||
echo ""
|
||||
git pull 2>&1
|
||||
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 $RECEIVER_BUILD_DIRECTORY 2>&1
|
||||
echo -e "\e[94m Cloning the piaware_builder git repository locally...\e[97m"
|
||||
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/piaware_builder.git 2>&1
|
||||
git clone https://github.com/flightaware/piaware_builder.git
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
## BUILD AND INSTALL THE COMPONENT PACKAGE
|
||||
## BUILD AND INSTALL THE PIAWARE PACKAGE
|
||||
|
||||
echo -e "\e[95m Building and installing the FlightAware PiAware client package...\e[97m"
|
||||
echo ""
|
||||
LogHeading "Beginning the FlightAware PiAware installation process"
|
||||
|
||||
# Change to the component build directory
|
||||
echo -e "\e[94m Entering the piaware_builder git repository directory...\e[97m"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/piaware_builder 2>&1
|
||||
LogMessage "Entering the piaware_builder git repository directory"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/piaware_builder
|
||||
|
||||
# Execute build script
|
||||
LogMessage "Determining which piaware_builder build strategy should be use"
|
||||
distro="bookworm"
|
||||
case $RECEIVER_OS_CODE_NAME in
|
||||
buster | focal)
|
||||
|
@ -158,79 +167,69 @@ case $RECEIVER_OS_CODE_NAME in
|
|||
bullseye | jammy)
|
||||
distro="bullseye"
|
||||
;;
|
||||
bookworm)
|
||||
bookworm | noble)
|
||||
distro="bookworm"
|
||||
;;
|
||||
esac
|
||||
echo -e "\e[94m Executing the FlightAware PiAware client build script...\e[97m"
|
||||
|
||||
LogMessage "Executing the FlightAware PiAware client build script"
|
||||
echo ""
|
||||
./sensible-build.sh $distro
|
||||
echo ""
|
||||
|
||||
# Change to build script directory
|
||||
echo -e "\e[94m Entering the FlightAware PiAware client build directory...\e[97m"
|
||||
cd $RECEIVER_BUILD_DIRECTORY/piaware_builder/package-${distro} 2>&1
|
||||
|
||||
# Build binary package
|
||||
echo -e "\e[94m Building the FlightAware PiAware client package...\e[97m"
|
||||
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 2>&1
|
||||
dpkg-buildpackage -b
|
||||
echo ""
|
||||
|
||||
# Install binary package
|
||||
echo -e "\e[94m Installing the FlightAware PiAware client package...\e[97m"
|
||||
LogMessage "Installing the FlightAware PiAware client package"
|
||||
echo ""
|
||||
sudo dpkg -i $RECEIVER_BUILD_DIRECTORY/piaware_builder/piaware_*.deb 2>&1
|
||||
echo ""
|
||||
|
||||
# Check that the component package was installed successfully.
|
||||
echo -e "\e[94m Checking that the FlightAware PiAware client package was installed properly...\e[97m"
|
||||
|
||||
LogMessage "Checking that the FlightAware PiAware client package was installed properly"
|
||||
if [[ $(dpkg-query -W -f='${STATUS}' piaware 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 \"piaware\" could not be installed.\e[39m"
|
||||
LogAlertMessage "FlightAware PiAware package installation failed"
|
||||
LogAlertMessage "Setup has been terminated"
|
||||
echo ""
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m FlightAware PiAware client setup halted.\e[39m"
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "FlightAware PiAware client setup failed"
|
||||
echo ""
|
||||
read -p "Press enter to continue..." discard
|
||||
exit 1
|
||||
else
|
||||
# Create binary package archive directory.
|
||||
if [[ ! -d $RECEIVER_BUILD_DIRECTORY/package-archive ]]; then
|
||||
echo -e "\e[94m Creating package archive directory...\e[97m"
|
||||
LogMessage "Creating the package archive directory"
|
||||
echo ""
|
||||
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive 2>&1
|
||||
mkdir -vp $RECEIVER_BUILD_DIRECTORY/package-archive
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Archive binary package.
|
||||
echo -e "\e[94m Moving the FlightAware PiAware client binary package into the archive directory...\e[97m"
|
||||
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/ 2>&1
|
||||
cp -vf $RECEIVER_BUILD_DIRECTORY/piaware_builder/*.deb $RECEIVER_BUILD_DIRECTORY/package-archive/
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
||||
## COMPONENT POST INSTALL ACTIONS
|
||||
## POST INSTALLATION OPERATIONS
|
||||
|
||||
# Instruct the user as to how they can claim their receiver online.
|
||||
LogHeading "Performing post installation operations"
|
||||
|
||||
LogMessage "Displaying the message informing the user on how to claim their device"
|
||||
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
|
||||
|
||||
|
||||
## SETUP COMPLETE
|
||||
|
||||
# Return to the project root directory.
|
||||
echo -e "\e[94m Returning to ${RECEIVER_PROJECT_TITLE} root directory...\e[97m"
|
||||
cd $RECEIVER_ROOT_DIRECTORY 2>&1
|
||||
LogMessage "Returning to ${RECEIVER_PROJECT_TITLE} root directory"
|
||||
cd $RECEIVER_ROOT_DIRECTORY
|
||||
|
||||
echo ""
|
||||
echo -e "\e[93m ------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m FlightAware PiAware client setup is complete.\e[39m"
|
||||
LogTitleMessage "------------------------------------------------------------------------------"
|
||||
LogTitleHeading "FlightAware PiAware client setup is complete"
|
||||
echo ""
|
||||
read -p "Press enter to continue..." discard
|
||||
|
||||
|
|
|
@ -98,3 +98,54 @@ function UncommentConfig {
|
|||
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}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Logs a "HEADING" to the console
|
||||
function LogHeading {
|
||||
echo ""
|
||||
echo -e "${DISPLAY_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Logs a "MESSAGE" to the console
|
||||
function LogMessage {
|
||||
echo -e "${DISPLAY_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an alert "HEADING" to the console
|
||||
function LogAlertHeading {
|
||||
echo -e "${DISPLAY_ALERT_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an alert "MESSAGE" to the console
|
||||
function LogAlertMessage {
|
||||
echo -e "${DISPLAY_ALERT_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an title "HEADING" to the console
|
||||
function LogTitleHeading {
|
||||
echo -e "${DISPLAY_TITLE_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs an title "MESSAGE" to the console
|
||||
function LogTitleMessage {
|
||||
echo -e "${DISPLAY_TITLE_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs a warning "HEADING" to the console
|
||||
function LogWarningHeading {
|
||||
echo -e "${DISPLAY_WARNING_HEADING} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
||||
|
||||
# Logs a warning "MESSAGE" to the console
|
||||
function LogWarningMessage {
|
||||
echo -e "${DISPLAY_WARNING_MESSAGE} ${1}${DISPLAY_DEFAULT}"
|
||||
}
|
Ładowanie…
Reference in New Issue