This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
553650d
commit 6ef9681
Showing
1 changed file
with
13 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,17 @@ | ||
#!/bin/bash | ||
|
||
clear | ||
|
||
echo -e "\033[31m" | ||
echo "-----------------------------------------------------" | ||
echo " ADS-B Exchange Feeder Setup Script." | ||
echo "-----------------------------------------------------" | ||
echo -e "\033[33m" | ||
echo "ADSBexchange.com is a co-op of ADS-B/Mode S/MLAT feeders from around the world." | ||
echo "This script will setup your current PiAware installation to share your data with ADS-B Exchange as well." | ||
echo "PiAware is required to be installed in order to use this script to setup the feed to ADS-B Exchange." | ||
echo "" | ||
echo "https://github.com/jprochazka/adsb-exchange" | ||
echo "http://www.adsbexchange.com/how-to-feed/" | ||
echo "http://www.adsbexchange.com/forums/topic/ads-b-exchange-setup-script/" | ||
echo -e "\033[37m" | ||
read -p "Continue setup? [Y/n] " CONTINUE | ||
|
||
if [[ $CONTINUE == "" ]]; then CONTINUE="Y"; fi | ||
if [[ ! $CONTINUE =~ ^[Yy]$ ]]; then | ||
echo "" | ||
exit 0 | ||
fi | ||
|
||
## ASSIGN THE SCRIPTDIR VARIABLE WHICH SHOULD BE THE DIRECTORY CONTAINING THIS SCRIPT | ||
|
||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
## CONFIGURE PIAWARE TO FEED ADS-B EXCHANGE | ||
|
||
echo -e "\033[33m" | ||
echo "Adding the ADS-B Exchange feed to PiAware's configuration..." | ||
ORIGINALFORMAT=`sudo piaware-config -show | grep mlatResultsFormat | sed 's/mlatResultsFormat //g'` | ||
MLATRESULTS=`sed 's/[{}]//g' <<< $ORIGINALFORMAT` | ||
CLEANFORMAT=`sed 's/ beast,connect,feed.adsbexchange.com:30005//g' <<< $MLATRESULTS` | ||
sudo piaware-config -mlatResultsFormat "${CLEANFORMAT} beast,connect,feed.adsbexchange.com:30005" | ||
echo -e "\033[33m" | ||
echo "Restarting PiAware so new configuration takes effect..." | ||
echo -e "\033[37m" | ||
sudo piaware-config -restart | ||
echo "" | ||
|
||
## SET PERMISSIONS ON THE ADS-B EXCHANGE MAINTAINANCE SCRIPT | ||
|
||
echo -e "\033[33mSetting permissions on the ADS-B Exchange maintainance script..." | ||
echo -e "\033[37m" | ||
chmod 755 $SCRIPTDIR/adsbexchange-maint.sh | ||
##################################################################### | ||
## THIS IS A TEMPORARY FILE ## | ||
##-----------------------------------------------------------------## | ||
## This file will be removed once the installation instructions on ## | ||
## ADS-B Exchange have been modified to reflect the the new usage ## | ||
## instructions contained in this version of the README.md file. ## | ||
##################################################################### | ||
|
||
## ADD ADS-B EXCHANGE MAINTAINANCE SCRIPT TO RC.LOCAL | ||
## EXECUTE THE PROPER SETUP SCRIPT | ||
|
||
if ! grep -Fxq "${SCRIPTDIR}/adsbexchange-maint.sh &" /etc/rc.local; then | ||
echo -e "\033[33mAdding ADS-B Exchange maintainance script startup command to rc.local..." | ||
echo -e "\033[37m" | ||
lnum=($(sed -n '/exit 0/=' /etc/rc.local)) | ||
((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i ${SCRIPTDIR}/adsbexchange-maint.sh &\n" /etc/rc.local | ||
fi | ||
|
||
## KILL ANY CURRENTLY RUNNING INSTANCES OF THE ADS-B EXCHANGE MAINTAINANCE SCRIPT | ||
|
||
echo -e "\033[33mKilling any adsbexchange-maint.sh processes currently running..." | ||
PIDS=`ps -efww | grep -w "adsbexchange-maint.sh" | awk -vpid=$$ '$2 != pid { print $2 }'` | ||
if [ ! -z "$PIDS" ]; then | ||
echo -e "\033[37m" | ||
sudo kill $PIDS | ||
sleep 5 | ||
sudo kill -9 $PIDS | ||
fi | ||
|
||
## RUN THE ADS-B EXCHANGE MAINTAINANCE SCRIPT | ||
|
||
echo -e "\033[33mRunning ADS-B Exchange maintainance script..." | ||
echo -e "\033[37m" | ||
sudo $SCRIPTDIR/adsbexchange-maint.sh & | ||
|
||
## DISPLAY SETUP COMPLETE MESSAGE | ||
|
||
echo -e "\033[33mConfiguration of the ADS-B Exchange feed is now complete." | ||
echo "Please look over the output generated to be sure no errors were encountered." | ||
echo "Also make sure to leave the files and folders contained here in place." | ||
echo -e "\033[37m" | ||
read -p "Press enter to exit this script..." CONTINUE | ||
echo "" | ||
|
||
exit 0 | ||
SCRIPTDIR=${PWD} | ||
clear | ||
echo "Executing setup.sh..." | ||
chmod +x setup.sh | ||
sudo $SCRIPTDIR/setup.sh |