kopia lustrzana https://github.com/jprochazka/adsb-receiver
Tidy up of bash/image.sh and move LAT/LON questions before dump1090 install
rodzic
61c0c4622a
commit
5d4d80b0c6
|
|
@ -67,8 +67,10 @@ if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Project Im
|
|||
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m Your operating system should now be up to date.\e[39m"
|
||||
echo -e ""
|
||||
if [[ ! -z ${VERBOSE} ]] ; then
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
fi
|
||||
fi
|
||||
|
||||
### ASK USER TO CONFIRM RECIEVER LATITUDE AND LONGITUDE
|
||||
|
||||
|
|
@ -77,18 +79,30 @@ if [ -z $RECEIVERLATITUDE ] || [ -z $RECEIVERLONGITUDE ] ; then
|
|||
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Receiver Latitude and Longitude" --msgbox "Your receivers latitude and longitude are required for certain features to function properly. You will now be asked to supply the latitude and longitude for your receiver. If you do not have this information you get it by using the web based \"Geocode by Address\" utility hosted on another of my websites.\n\n https://www.swiftbyte.com/toolbox/geocode" 13 78
|
||||
RECEIVERLATITUDE_TITLE="Receiver Latitude"
|
||||
while [[ -z $RECEIVERLATITUDE ]] ; do
|
||||
RECEIVERLATITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLATITUDE_TITLE" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
|
||||
RECEIVERLATITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLATITUDE_TITLE" --nocancel --inputbox "\nEnter your receiver's latitude in decimal degrees.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
|
||||
RECEIVERLATITUDE_TITLE="Receiver Latitude (REQUIRED)"
|
||||
done
|
||||
RECEIVERLONGITUDE_TITLE="Receiver Longitude"
|
||||
while [[ -z $RECEIVERLONGITUDE ]] ; do
|
||||
RECEIVERLONGITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLONGITUDE_TITLE" --nocancel --inputbox "\nEnter your receeiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
|
||||
RECEIVERLONGITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLONGITUDE_TITLE" --nocancel --inputbox "\nEnter your receeiver's longitude in decimal degrees.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
|
||||
RECEIVERLONGITUDE_TITLE="Receiver Longitude (REQUIRED)"
|
||||
done
|
||||
# Can hopefully be derived
|
||||
RECEIVERALTITUDE_TITLE="Receiver Altitude"
|
||||
while [[ -z $RECEIVERALTITUDE ]] ; do
|
||||
RECEIVERALTITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERALTITUDE_TITLE" --nocancel --inputbox "\nEnter your receeiver's altitude in meters.\n(Example: XX)" 9 78 3>&1 1>&2 2>&3)
|
||||
RECEIVERALTITUDE_TITLE="Receiver Altitude (REQUIRED)"
|
||||
done
|
||||
fi
|
||||
|
||||
### DERIVE ELEVATION
|
||||
|
||||
|
||||
|
||||
### CONFIGURE DUMP1090
|
||||
|
||||
# Check at least one of dump1090-mutablity or dump1090-fa is installed.
|
||||
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ] || [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ] ; then
|
||||
clear
|
||||
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
|
||||
echo -e ""
|
||||
|
|
@ -97,7 +111,6 @@ echo -e "\e[93m-----------------------------------------------------------------
|
|||
echo -e ""
|
||||
|
||||
# If dump1090-mutability is installed...
|
||||
|
||||
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ] ; then
|
||||
echo -e "\e[94m Setting the receiver's latitude to $RECEIVERLATITUDE...\e[97m"
|
||||
ChangeConfig "LAT" $RECEIVERLATITUDE "/etc/default/dump1090-mutability"
|
||||
|
|
@ -117,8 +130,13 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
|
|||
echo -e "\e[94m Reloading dump1090-mutability...\e[97m"
|
||||
echo -e ""
|
||||
sudo /etc/init.d/dump1090-mutability force-reload
|
||||
# Or if dump1090-fa is installed...
|
||||
elif [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ] ; then
|
||||
echo -e "\e[94m dump1090-fa already installed...\e[97m"
|
||||
echo -e ""
|
||||
fi
|
||||
|
||||
# Post-install actions commmon to both dump1090-mutablity and dump1090-fa.
|
||||
# Download Heywhatsthat.com maximum range rings if the user wishes them to be displayed.
|
||||
if [ ! -f /usr/share/dump1090-mutability/html/upintheair.json ] || [ ! -f /usr/share/dump1090-fa/html/upintheair.json ] ; then
|
||||
if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Heywhaststhat.com Maimum Range Rings" --yesno "Maximum range rings can be added to dump1090-mutability usings data obtained from Heywhatsthat.com. In order to add these rings to your dump1090-mutability map you will first need to visit http://www.heywhatsthat.com and generate a new panarama centered on the location of your receiver. Once your panarama has been generated a link to the panarama will be displayed in the up left hand portion of the page. You will need the view id which is the series of letters and/or numbers after \"?view=\" in this URL.\n\nWould you like to add heywatsthat.com maximum range rings to your map?" 16 78); then
|
||||
|
|
@ -141,7 +159,7 @@ if [ ! -f /usr/share/dump1090-mutability/html/upintheair.json ] || [ ! -f /usr/s
|
|||
echo -e ""
|
||||
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ] ; then
|
||||
HTMLPATH="/usr/share/dump1090-mutability/html/upintheair.json"
|
||||
else
|
||||
elif [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ] ; then
|
||||
HTMLPATH="/usr/share/dump1090-fa/html/upintheair.json"
|
||||
fi
|
||||
sudo wget -O $HTMLPATH "http://www.heywhatsthat.com/api/upintheair.json?id=${HEYWHATSTHATID}&refraction=0.25&alts=$HEYWHATSTHATRINGONE,$HEYWHATSTHATRINGTWO"
|
||||
|
|
@ -153,8 +171,10 @@ echo -e ""
|
|||
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m Dump1090 configuration complete.\e[39m"
|
||||
echo -e ""
|
||||
if [[ ! -z ${VERBOSE} ]] ; then
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
# CONFIGURE PIAWARE IF NEEDED
|
||||
|
||||
|
|
@ -166,7 +186,7 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok instal
|
|||
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[96m"
|
||||
echo -e ""
|
||||
|
||||
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Claim Your PiAware Device" --msgbox "Please supply your FlightAware login in order to claim this device. After supplying your login PiAware will ask you to enter your password for verification. If you decide not to supply a login and password at this time you should still be able to claim your feeder by visting the page http://flightaware.com/adsb/piaware/claim." 11 78
|
||||
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Claim Your PiAware Device" --msgbox "Please supply your FlightAware login in order to claim this device. After supplying your login PiAware will ask you to enter your password for verification. If you decide not to supply a login and password at this time you should still be able to claim your feeder by visting this page:\n\n http://flightaware.com/adsb/piaware/claim" 11 78
|
||||
# Ask for the users FlightAware login.
|
||||
FLIGHTAWARELOGIN=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Your FlightAware Login" --nocancel --inputbox "\nEnter your FlightAware login.\nLeave this blank to manually claim your PiAware device." 9 78 3>&1 1>&2 2>&3)
|
||||
if [ ! $FLIGHTAWARELOGIN = "" ] ; then
|
||||
|
|
@ -209,7 +229,7 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok instal
|
|||
echo -e ""
|
||||
else
|
||||
# Display a message to the user stating they need to manually claim their device.
|
||||
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Claim Your PiAware Device" --msgbox "Since you did not supply a login you will need to claim this PiAware device manually by visiting the following URL.\n\nhttp://flightaware.com/adsb/piaware/claim." 10 78
|
||||
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Claim Your PiAware Device" --msgbox "Since you did not supply a login you will need to claim this PiAware device manually by visiting this page:\n\n http://flightaware.com/adsb/piaware/claim" 10 78
|
||||
fi
|
||||
|
||||
# PiAware configuration is now complete.
|
||||
|
|
@ -217,22 +237,31 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok instal
|
|||
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
|
||||
echo -e "\e[92m PiAware configuration complete.\e[39m"
|
||||
echo -e ""
|
||||
if [[ ! -z ${VERBOSE} ]] ; then
|
||||
read -p "Press enter to continue..." CONTINUE
|
||||
fi
|
||||
fi
|
||||
|
||||
### SETUP THE ADS-B RECIEVER PROJECT WEB PORTAL
|
||||
|
||||
chmod +x $BASHDIRECTORY/portal/install.sh
|
||||
$BASHDIRECTORY/portal/install.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
### CATCH EXIT
|
||||
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
### FINALIZE IMAGE SETUP
|
||||
|
||||
# remove the "image" file.
|
||||
rm -f image
|
||||
if [[ -f $PROJECTROOTDIRECTORY/image ]] ; then
|
||||
rm -f $PROJECTROOTDIRECTORY/image
|
||||
fi
|
||||
|
||||
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Project Image Setup" --msgbox "Image setup is now complete. If you have any questions or comments on the project let us know on our website.\n\n https://www.adsbreceiver.net\n\nRemember to install additional features simply run ./install.sh again." 12 78
|
||||
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Project Image Setup" --msgbox "Image setup is now complete. If you have any questions or comments on the project let us know on our website.\n\n ${PROJECT_WEBSITE} \n\nRemember to install additional features simply run ./install.sh again." 12 78
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue