diff --git a/bash/feeders/adsbexchange.sh b/bash/feeders/adsbexchange.sh index d6b2806..b5ca7d2 100755 --- a/bash/feeders/adsbexchange.sh +++ b/bash/feeders/adsbexchange.sh @@ -197,29 +197,32 @@ echo "" # Ask the user for the user name for this receiver. RECEIVER_NAME_TITLE="Receiver Name" -while [[ -z ${RECEIVERNAME} ]] ; do - RECEIVERNAME=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_NAME_TITLE}" --nocancel --inputbox "\nPlease enter a name for this receiver.\n\nIf you have more than one receiver, this name should be unique.\nExample: \"username-01\", \"username-02\", etc." 12 78 3>&1 1>&2 2>&3) +while [[ -z ${RECEIVER_NAME} ]] ; do + RECEIVER_NAME=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_NAME_TITLE}" --nocancel --inputbox "\nPlease enter a name for this receiver.\n\nIf you have more than one receiver, this name should be unique.\nExample: \"username-01\", \"username-02\", etc." 12 78 3>&1 1>&2 2>&3) RECEIVER_NAME_TITLE="Receiver Name (REQUIRED)" done # Ask the user to confirm the receivers latitude, this will be prepopulated by the latitude assigned dump1090-mutability. RECEIVER_LATITUDE_TITLE="Receiver Latitude" while [[ -z ${RECEIVER_LATITUDE} ]] ; do - RECEIVER_LATITUDE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_LATITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's latitude." 9 78 "`GetConfig "LAT" "/etc/default/dump1090-mutability"`" 3>&1 1>&2 2>&3) + DUMP1090_LATITUDE=$(GetConfig "LAT" "/etc/default/dump1090-mutability") + RECEIVER_LATITUDE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_LATITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's latitude." 9 78 "${DUMP1090_LATITUDE=}" 3>&1 1>&2 2>&3) RECEIVER_LATITUDE_TITLE="Receiver Latitude (REQUIRED)" done # Ask the user to confirm the receivers longitude, this will be prepopulated by the longitude assigned dump1090-mutability. RECEIVER_LONGITUDE_TITLE="Receiver Longitude" while [[ -z ${RECEIVER_LONGITUDE} ]] ; do - RECEIVER_LONGITUDE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_LONGITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's longitude." 9 78 "`GetConfig "LON" "/etc/default/dump1090-mutability"`" 3>&1 1>&2 2>&3) + DUMP1090_LONGITUDE=$(GetConfig "LON" "/etc/default/dump1090-mutability") + RECEIVER_LONGITUDE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_LONGITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's longitude." 9 78 "${DUMP1090_LONGITUDE}" 3>&1 1>&2 2>&3) RECEIVER_LONGITUDE_TITLE="Receiver Longitude (REQUIRED)" done # Ask the user to confirm the receivers altitude, this will be prepopulated by the altitude returned from the Google Maps API. RECEIVER_ALTITUDE_TITLE="Receiver Altitude" while [[ -z ${RECEIVER_ALTITUDE} ]] ; do - RECEIVER_ALTITUDE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_ALTITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's altitude." 9 78 "`curl -s https://maps.googleapis.com/maps/api/elevation/json?locations=${RECEIVER_LATITUDE},${RECEIVER_LONGITUDE} | python -c "import json,sys;obj=json.load(sys.stdin);print obj['results'][0]['elevation'];"`" 3>&1 1>&2 2>&3) + DERIVED_ALTITUDE=$(curl -s https://maps.googleapis.com/maps/api/elevation/json?locations=${RECEIVER_LATITUDE},${RECEIVER_LONGITUDE} | python -c "import json,sys;obj=json.load(sys.stdin);print obj['results'][0]['elevation'];") + RECEIVER_ALTITUDE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_ALTITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's altitude." 9 78 "${DERIVED_ALTITUDE}" 3>&1 1>&2 2>&3) RECEIVER_ALTITUDE_TITLE="Receiver Altitude (REQUIRED)" done @@ -246,7 +249,7 @@ tee ${ADSB_EXCHANGE_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh > /dev/null << #! /bin/sh while true do - /usr/bin/mlat-client --input-type dump1090 --input-connect ${ADSB_EXCHANGE_MLAT_SRC_HOST}:${ADSB_EXCHANGE_MLAT_SRC_PORT} --lat ${RECEIVER_LATITUDE} --lon ${RECEIVER_LONGITUDE} --alt ${RECEIVER_ALTITUDE} --user ${RECEIVERNAME} --server ${ADSB_EXCHANGE_MLAT_DST_HOST}:${ADSB_EXCHANGE_MLAT_DST_PORT} --no-udp --results beast,connect,${ADSB_EXCHANGE_MLAT_SRC_HOST}:${ADSB_EXCHANGE_MLAT_RETURN_PORT} + /usr/bin/mlat-client --input-type dump1090 --input-connect ${ADSB_EXCHANGE_MLAT_SRC_HOST}:${ADSB_EXCHANGE_MLAT_SRC_PORT} --lat ${RECEIVER_LATITUDE} --lon ${RECEIVER_LONGITUDE} --alt ${RECEIVER_ALTITUDE} --user ${RECEIVER_NAME} --server ${ADSB_EXCHANGE_MLAT_DST_HOST}:${ADSB_EXCHANGE_MLAT_DST_PORT} --no-udp --results beast,connect,${ADSB_EXCHANGE_MLAT_SRC_HOST}:${ADSB_EXCHANGE_MLAT_RETURN_PORT} sleep 30 done EOF