Work continues.

pull/222/head
Joe Prochazka 2016-09-01 09:15:46 -04:00
rodzic 59b7ee07cb
commit 72b2036d8b
1 zmienionych plików z 40 dodań i 144 usunięć

Wyświetl plik

@ -79,7 +79,7 @@ CheckPackage fakeroot
## DOWNLOAD OR UPDATE THE DUMP1090-MUTABILITY SOURCE ## DOWNLOAD OR UPDATE THE DUMP1090-MUTABILITY SOURCE
echo "" echo ""
echo -e "\e[95m Prepare the dump1090-mutability Git repository...\e[97m" echo -e "\e[95m Preparing the dump1090-mutability Git repository...\e[97m"
echo "" echo ""
if [ -d $DUMP1090BUILDDIRECTORY ] && [ -d $DUMP1090BUILDDIRECTORY/.git ]; then if [ -d $DUMP1090BUILDDIRECTORY ] && [ -d $DUMP1090BUILDDIRECTORY/.git ]; then
# A directory with a git repository containing the source code already exists. # A directory with a git repository containing the source code already exists.
@ -118,173 +118,69 @@ echo -e "\e[95m Installing the dump1090-mutability package...\e[97m"
echo "" echo ""
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m" echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
cd $BUILDDIRECTORY cd $BUILDDIRECTORY
echo -e "\e[94m Installing the dump1090-mutability package......\e[97m" echo -e "\e[94m Installing the dump1090-mutability package...\e[97m"
echo "" echo ""
sudo dpkg -i dump1090-mutability_1.15~dev_*.deb sudo dpkg -i dump1090-mutability_1.15~dev_*.deb
#########################
echo ""
echo -e "\e[93m------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-mutability setup is complete.\e[39m"
echo -e "\e[97m"
cd $PROJECTROOTDIRECTORY
exit 0
#########################
## CHECK THAT THE PACKAGE INSTALLED ## CHECK THAT THE PACKAGE INSTALLED
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 0 ]; then if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "\033[31m" # If the dump1090-mutability package could not be installed halt setup.
echo "#########################################"
echo "# INSTALLATION HALTED! #"
echo "# UNABLE TO INSTALL A REQUIRED PACKAGE. #"
echo "#########################################"
echo "" echo ""
echo "The dump1090-mutability package did not install properly!" echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m
echo -e "\033[33m" echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE."
echo "This script has exited due to the error encountered." echo -e " SETUP HAS BEEN TERMINATED!"
echo "Please read over the above output in order to determine what went wrong."
echo "" echo ""
kill -9 `ps --pid $$ -oppid=`; exit echo -e "\e[93mThe package \"dump1090-mutability\" could not be installed.\e[39m"
fi echo ""
#kill -9 `ps --pid $$ -oppid=`; exit
## CONFIGURE THE WEB SERVER exit 1
if [[ $WEBSERVER != "2" ]]; then
echo -e "\033[33m"
echo "Configuring lighttpd..."
echo -e "\033[37m"
sudo lighty-enable-mod dump1090
sudo /etc/init.d/lighttpd force-reload
else
echo -e "\033[33m"
echo "Configuring nginx..."
echo -e "\033[37m"
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/dump1090-mutability /etc/nginx/sites-enabled/dump1090-mutability
sudo /etc/init.d/nginx force-reload
fi fi
## DUMP1090-MUTABILITY POST INSTALLATION CONFIGURATION ## DUMP1090-MUTABILITY POST INSTALLATION CONFIGURATION
# Set the receiver's latitude and longitude if it is not already set in the dump1090-mutibility configuration file.
echo ""
echo -e "\e[95m Begining post installation configuration...\e[97m"
echo ""
if [[ `GetConfig "LAT" "/etc/default/dump1090-mutability"` == "" ]] || [[ `GetConfig "LON" "/etc/default/dump1090-mutability"` == "" ]]; then if [[ `GetConfig "LAT" "/etc/default/dump1090-mutability"` == "" ]] || [[ `GetConfig "LON" "/etc/default/dump1090-mutability"` == "" ]]; then
whiptail --title "Receiver Latitude and Longitude" --msgbox "" 8 78
# Set latitude and longitude. RECEIVERLATITUDE=$(whiptail --title "Receiver Latitude" --nocancel --inputbox "Enter your receiver's latitude." 8 78 3>&1 1>&2 2>&3)
echo -e "\033[31m" RECEIVERLONGITUDE=$(whiptail --title "Receiver Longitude" --nocancel --inputbox "Enter your receeiver's longitude." 8 78 3>&1 1>&2 2>&3)
echo "SET THE LATITUDE AND LONGITUDE OF YOUR FEEDER" echo -e "\e[94m Setting the receiver's latitude to $RECEIVERLATITUDE...\e[97m"
echo -e "\033[33m" ChangeConfig "LAT" $RECEIVERLATITUDE "/etc/default/dump1090-mutability"
echo "In order for some performance graphs to work properly you will need to" echo -e "\e[94m Setting the receiver's longitude to $RECEIVERLONGITUDE...\e[97m"
echo "set the latitude and longitude of your feeder. If you do not know the" ChangeConfig "LON" $RECEIVERLONGITUDE "/etc/default/dump1090-mutability"
echo "latitude and longitude of your feeder you can find out this information"
echo "by using Geocode by Address tool found on my web site."
echo ""
echo " https://www.swiftbyte.com/toolbox/geocode"
echo ""
echo "NOT SETTING LATITUDE AND LONGITUDE WILL BREAK THE RANGE PERFORMANCE GRAPH"
echo -e "\033[37m"
read -p "Feeder Latitude: (Decimal Degrees XX-XXXXXXX) " FEEDERLAT
read -p "Feeder Longitude: (Decimal Degrees XX-XXXXXXX) " FEEDERLON
echo ""
ChangeConfig "LAT" $FEEDERLAT "/etc/default/dump1090-mutability"
ChangeConfig "LON" $FEEDERLON "/etc/default/dump1090-mutability"
fi fi
# Set dump190-mutability's BEAST_INPUT_PORT to 30104.
echo -e "\033[33m"
echo "Configuring dump1090-mutability to listen for BEAST input on port 30104..."
echo -e "\033[37m"
ChangeConfig "BEAST_INPUT_PORT" "30104" "/etc/default/dump1090-mutability"
# Ask if dump1090-mutability should bind on all IP addresses. # Ask if dump1090-mutability should bind on all IP addresses.
if (whiptail --title "Bind To All IP Addresses" --yesno "" 8 78) then
echo -e "\033[33m"
echo "By default dump1090-mutability binds to the localhost IP address of 127.0.0.1 which is a good thing."
echo ""
echo "However..."
echo "Some people like for dump1090-mutability to bind to all available IP addresses for a multitude of reasons."
echo "The scripts can bind dump190-mutability to all available IP addresses however this is not recommended"
echo "unless you understand the possible consequences of doing so."
echo -e "\033[37m"
read -p "Would you like dump1090-mutability to bind to all available IP addresses? [y/N] " BINDTOALLIPS
if [[ $BINDTOALLIPS =~ ^[yY]$ ]]; then
echo ""
ChangeConfig "NET_BIND_ADDRESS" "0.0.0.0" "/etc/default/dump1090-mutability" ChangeConfig "NET_BIND_ADDRESS" "0.0.0.0" "/etc/default/dump1090-mutability"
fi fi
## HEYWHATSTHAT.COM TERRAIN LIMIT RINGS # Download Heywhatsthat.com maximum range rings.
if [ ! -f /usr/share/dump1090-mutability/html/upintheair.json ] && (whiptail --title "Heywhaststhat.com Maimum Range Rings" --yesno "" 8 78); then
# Check if the heywhatsthis.com range position file has already been downloaded. HEYWHATSTHATID=$(whiptail --title "Heywhatsthat.com Panarama ID" --nocancel --inputbox "Enter your Heywhatsthat.com panarama ID." 8 78 3>&1 1>&2 2>&3)
if [ ! -f /usr/share/dump1090-mutability/html/upintheair.json ]; then HEYWHATSTHATRINGONE=$(whiptail --title "Heywhatsthat.com Panarama ID" --nocancel --inputbox "Enter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
echo -e "\033[33m" HEYWHATSTHATRINGTWO=$(whiptail --title "Heywhatsthat.com Panarama ID" --nocancel --inputbox "Enter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
echo "Dump1090-mutability is able to display terrain limit rings using data obtained" echo "\e[94m Downloading JSON data pertaining to the supplied panorama ID...\e[97m"
echo "from the website http://www.heywhatsthat.com. Some work will be required on your" sudo wget -O /usr/share/dump1090-mutability/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=${HEYWHATSTHATID}&refraction=0.25&alts=$HEYWHATSTHATRINGONE,$HEYWHATSTHATRINGTWO"
echo "part including visiting http://www.heywhatsthat.com and generating a new"
echo "panorama set to your location."
echo -e "\033[37m"
read -p "Do you wish to add terrain limit rings to the dump1090 map? [Y/n] " ADDTERRAINRINGS
if [[ ! $ADDTERRAINRINGS =~ ^[Nn]$ ]]; then
echo -e "\033[31m"
echo "READ THE FOLLOWING INSTRUCTION CAREFULLY!"
echo -e "\033[33m"
echo "To set up terrain limit rings you will need to first generate a panorama on the website"
echo "heywhatsthat.com. To do so visit the following URL:"
echo ""
echo " http://www.heywhatsthat.com"
echo ""
echo "Once the webpage has loaded click on the tab titled New panorama. Fill out the required"
echo "information in the form to the left of the map."
echo ""
echo "After submitting the form your request will be put into a queue to be generated shortly."
echo "You will be informed when the generation of your panorama has been completed."
echo ""
echo "Once generated visit your newly created panorama. Near the top left of the page you will"
echo "see a URL displayed which will point you to your newly created panorama. Within this URL's"
echo "query string you will see ?view=XXXXXXXX where XXXXXXXX is the identifier for this panorama."
echo "Enter below the letters and numbers making up the view identifier displayed there."
echo ""
echo "Positions for terrain rings for both 10,000 and 40,000 feet will be downloaded by this"
echo "script once the panorama has been generated and you are ready to continue."
echo -e "\033[37m"
read -p "Your heywhatsthat.com view identifier: " HEYWHATSTHATVIEWID
read -e -p "First ring altitude in meters (default 3048 meters or 10000 feet): " -i "3048" HEYWHATSTHATRINGONE
read -e -p "Second ring altitude in meters (default 12192 meters or 40000 feet): " -i "12192" HEYWHATSTHATRINGTWO
# Download the generated panoramas JSON data.
echo -e "\033[33m"
echo "Downloading JSON data pertaining to the panorama ID you supplied..."
echo -e "\033[37m"
sudo wget -O /usr/share/dump1090-mutability/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=${HEYWHATSTHATVIEWID}&refraction=0.25&alts=$HEYWHATSTHATRINGONE,$HEYWHATSTHATRINGTWO"
fi
else
# Heywhatsthis.com upintheair.json file already exists.
echo -e "\033[33m"
echo "Exisitng heywhatsthat.com position data found."
echo -e "Skipping terrain limit ring setup...\033[37m"
fi fi
## START DUMP1090-MUTABILITY # Reload dump1090-mutability to ensure all changes take effect.
echo "\e[94m Reloading dump1090-mutability...\e[97m"
sudo /etc/init.d/dump1090-mutability force-reload
echo -e "\033[33m" ## DUMP1090-MUTABILITY SETUP COMPLETE
echo "Startng dump1090-mutability..."
echo -e "\033[37m"
sudo /etc/init.d/dump1090-mutability start
## DISPLAY MESSAGE STATING DUMP1090-MUTABILITY SETUP IS COMPLETE # Enter into the project root directory.
echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m"
cd $PROJECTROOTDIRECTORY
echo -e "\033[33m"
echo "Installation of dump-1090-mutability is now complete."
echo "Please look over the output generated to be sure no errors were encountered."
echo "" echo ""
echo "After setup has completed you can run the following command to configure" echo -e "\e[93m------------------------------------------------------------------------------"
echo "other dump1090-mutability options." echo -e "\e[92m Dump1090-mutability setup is complete.\e[39m"
echo -e "\033[32m"
echo "sudo dpkg-reconfigure dump1090-mutability"
echo "" echo ""
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE read -p "Press enter to continue..." CONTINUE
exit 0