Haromonise variable quoting and formatting

pull/289/head
romeo-golf 2017-01-30 02:40:19 +00:00
rodzic 39a1eda8f8
commit e539114dd4
22 zmienionych plików z 802 dodań i 802 usunięć

Wyświetl plik

@ -50,15 +50,15 @@ fi
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
clear
echo -e "\n\e[91m $RECEIVER_PROJECT_TITLE"
echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}"
fi
echo -e ""
echo -e "\e[92m Setting up dump1090-fa..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump1090-fa Setup" --yesno "Dump 1090 is a Mode-S decoder specifically designed for RTL-SDR devices. Dump1090-fa is a fork of the dump1090-mutability version of dump1090 that is specifically designed for FlightAware's PiAware software.\n\nIn order to use this version of dump1090 FlightAware's PiAware software must be installed as well.\n\n https://github.com/flightaware/dump1090\n\nContinue setup by installing dump1090-fa?" 14 78
if [ $? -eq 1 ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090-fa Setup" --yesno "Dump 1090 is a Mode-S decoder specifically designed for RTL-SDR devices. Dump1090-fa is a fork of the dump1090-mutability version of dump1090 that is specifically designed for FlightAware's PiAware software.\n\nIn order to use this version of dump1090 FlightAware's PiAware software must be installed as well.\n\n https://github.com/flightaware/dump1090\n\nContinue setup by installing dump1090-fa?" 14 78
if [[ $? -eq 1 ]] ; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
@ -93,18 +93,18 @@ CheckPackage dh-systemd
echo -e ""
echo -e "\e[95m Preparing the dump1090-fa Git repository...\e[97m"
echo -e ""
if [ -d $RECEIVER_BUILD_DIRECTORY/dump1090/dump1090 ] && [ -d $RECEIVER_BUILD_DIRECTORY/dump1090/dump1090/.git ]; then
if [[ -d "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090" ]] && [[ -d "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090/.git" ]] ; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the dump1090-fa git repository directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump1090/dump1090
cd ${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090
echo -e "\e[94m Updating the local dump1090-fa git repository...\e[97m"
echo -e ""
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"
mkdir -p $RECEIVER_BUILD_DIRECTORY/dump1090
cd $RECEIVER_BUILD_DIRECTORY/dump1090
mkdir -p ${RECEIVER_BUILD_DIRECTORY}/dump1090
cd ${RECEIVER_BUILD_DIRECTORY}/dump1090
echo -e "\e[94m Cloning the dump1090-fa git repository locally...\e[97m"
echo -e ""
git clone https://github.com/flightaware/dump1090.git
@ -116,16 +116,16 @@ fi
echo -e ""
echo -e "\e[95m Building and installing the dump1090-fa package...\e[97m"
echo -e ""
if [ ! "$PWD" = $RECEIVER_BUILD_DIRECTORY/dump1090/dump1090 ]; then
if [[ ! "${PWD}" = "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090" ]] ; then
echo -e "\e[94m Entering the dump1090-fa git repository directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump1090/dump1090
cd ${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090
fi
echo -e "\e[94m Building the dump1090-fa package...\e[97m"
echo -e ""
dpkg-buildpackage -b
echo -e ""
echo -e "\e[94m Entering the dump1090-fa build directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump1090
cd ${RECEIVER_BUILD_DIRECTORY}/dump1090
echo -e "\e[94m Installing the dump1090-fa package...\e[97m"
echo -e ""
sudo dpkg -i dump1090-fa_${PIAWAREVERSION}_*.deb
@ -133,7 +133,7 @@ sudo dpkg -i dump1090-fa_${PIAWAREVERSION}_*.deb
# Check that the package was installed.
echo -e ""
echo -e "\e[94m Checking that the dump1090-fa package was installed properly...\e[97m"
if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# If the dump1090-fa package could not be installed halt setup.
echo -e ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
@ -152,54 +152,54 @@ fi
## DUMP1090-FA POST INSTALLATION CONFIGURATION
# Ask for a Bing Maps API key.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
DUMP1090_BING_MAPS_KEY=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Bing Maps API Key" --nocancel --inputbox "\nProvide a Bing Maps API key here to enable the Bing imagery layer.\nYou can obtain a free key at https://www.bingmapsportal.com/\n\nProviding a Bing Maps API key is not required to continue." 11 78 "$DUMP1090_BING_MAPS_KEY" 3>&1 1>&2 2>&3)
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
DUMP1090_BING_MAPS_KEY=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Bing Maps API Key" --nocancel --inputbox "\nProvide a Bing Maps API key here to enable the Bing imagery layer.\nYou can obtain a free key at https://www.bingmapsportal.com/\n\nProviding a Bing Maps API key is not required to continue." 11 78 "${DUMP1090_BING_MAPS_KEY}" 3>&1 1>&2 2>&3)
fi
if [ -n $DUMP1090_BING_MAPS_KEY ]; then
echo -e "\e[94m Setting the Bing Maps API Key to $DUMP1090_BING_MAPS_KEY...\e[97m"
ChangeConfig "BingMapsAPIKey" "$DUMP1090_BING_MAPS_KEY" "/usr/share/dump1090-fa/html/config.js"
if [[ -n "${DUMP1090_BING_MAPS_KEY}" ]] ; then
echo -e "\e[94m Setting the Bing Maps API Key to ${DUMP1090_BING_MAPS_KEY}...\e[97m"
ChangeConfig "BingMapsAPIKey" "${DUMP1090_BING_MAPS_KEY}" "/usr/share/dump1090-fa/html/config.js"
fi
# Ask for a Mapzen API key.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
DUMP1090_MAPZEN_KEY=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Mapzen API Key" --nocancel --inputbox "\nProvide a Mapzen API key here to enable the Mapzen vector tile layer within the dump1090-mutability map. You can obtain a free key at https://mapzen.com/developers/\n\nProviding a Mapzen API key is not required to continue." 13 78 $DUMP1090_MAPZEN_KEY 3>&1 1>&2 2>&3)
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
DUMP1090_MAPZEN_KEY=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Mapzen API Key" --nocancel --inputbox "\nProvide a Mapzen API key here to enable the Mapzen vector tile layer within the dump1090-mutability map. You can obtain a free key at https://mapzen.com/developers/\n\nProviding a Mapzen API key is not required to continue." 13 78 ${DUMP1090_MAPZEN_KEY} 3>&1 1>&2 2>&3)
fi
if [ -n $DUMP1090_MAPZEN_KEY ]; then
echo -e "\e[94m Setting the Mapzen API Key to $DUMP1090_MAPZEN_KEY...\e[97m"
ChangeConfig "MapzenAPIKey" "$DUMP1090_MAPZEN_KEY" "/usr/share/dump1090-fa/html/config.js"
if [[ -n "${DUMP1090_MAPZEN_KEY}" ]] ; then
echo -e "\e[94m Setting the Mapzen API Key to ${DUMP1090_MAPZEN_KEY}...\e[97m"
ChangeConfig "MapzenAPIKey" "${DUMP1090_MAPZEN_KEY}" "/usr/share/dump1090-fa/html/config.js"
fi
# Download Heywhatsthat.com maximum range rings.
if [ ! -f /usr/share/dump1090-fa/html/upintheair.json ]; then
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if (whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Heywhaststhat.com Maimum Range Rings" --yesno "Maximum range rings can be added to dump1090-fa usings data obtained from Heywhatsthat.com. In order to add these rings to your dump1090-fa 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
if [[ ! -f "/usr/share/dump1090-fa/html/upintheair.json" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
if (whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Heywhaststhat.com Maimum Range Rings" --yesno "Maximum range rings can be added to dump1090-fa usings data obtained from Heywhatsthat.com. In order to add these rings to your dump1090-fa 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
# Set the DUMP1090_HEYWHATSTHAT_INSTALL variable to true.
DUMP1090_HEYWHATSTHAT_INSTALL="true"
# Ask the user for the Heywhatsthat.com panarama ID.
DUMP1090_HEYWHATSTHAT_ID_TITLE="Heywhatsthat.com Panarama ID"
while [[ -z $DUMP1090_HEYWHATSTHAT_ID ]]; do
DUMP1090_HEYWHATSTHAT_ID=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$DUMP1090_HEYWHATSTHAT_ID_TITLE" --nocancel --inputbox "\nEnter your Heywhatsthat.com panarama ID." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DUMP1090_HEYWHATSTHAT_ID}" ]] ; do
DUMP1090_HEYWHATSTHAT_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_ID_TITLE}" --nocancel --inputbox "\nEnter your Heywhatsthat.com panarama ID." 8 78 3>&1 1>&2 2>&3)
DUMP1090_HEYWHATSTHAT_ID_TITLE="Heywhatsthat.com Panarama ID (REQUIRED)"
done
# Ask the user what altitude in meters to set the first range ring.
DUMP1090_HEYWHATSTHAT_RING_ONE_TITLE="Heywhatsthat.com First Ring Altitude"
while [ -z $DUMP1090_HEYWHATSTHAT_RING_ONE ]; do
DUMP1090_HEYWHATSTHAT_RING_ONE=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$DUMP1090_HEYWHATSTHAT_RING_ONE_TITLE" --nocancel --inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
while [[ -z "${DUMP1090_HEYWHATSTHAT_RING_ONE}" ]] ; do
DUMP1090_HEYWHATSTHAT_RING_ONE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_RING_ONE_TITLE}" --nocancel --inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
DUMP1090_HEYWHATSTHAT_RING_ONE_TITLE="Heywhatsthat.com First Ring Altitude (REQUIRED)"
done
# Ask the user what altitude in meters to set the second range ring.
DUMP1090_HEYWHATSTHAT_RING_TWO_TITLE="Heywhatsthat.com Second Ring Altitude"
while [ -z $DUMP1090_HEYWHATSTHAT_RING_TWO ]; do
DUMP1090_HEYWHATSTHAT_RING_TWO=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$DUMP1090_HEYWHATSTHAT_RING_TWO_TITLE" --nocancel --inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
while [[ -z "${DUMP1090_HEYWHATSTHAT_RING_TWO}" ]] ; do
DUMP1090_HEYWHATSTHAT_RING_TWO=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_RING_TWO_TITLE}" --nocancel --inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
DUMP1090_HEYWHATSTHAT_RING_TWO_TITLE="Heywhatsthat.com Second Ring Altitude (REQUIRED)"
done
fi
fi
# If the Heywhatsthat.com maximum range rings are to be added download them now.
if [ "$DUMP1090_HEYWHATSTHAT_INSTALL" = "true" ]; then
if [[ "${DUMP1090_HEYWHATSTHAT_INSTALL}" = "true" ]] ; then
echo -e "\e[94m Downloading JSON data pertaining to the supplied panorama ID...\e[97m"
echo -e ""
sudo wget -O /usr/share/dump1090-fa/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=${DUMP1090_HEYWHATSTHAT_ID}&refraction=0.25&alts=$DUMP1090_HEYWHATSTHAT_RING_ONE,$DUMP1090_HEYWHATSTHAT_RING_TWO"
sudo wget -O /usr/share/dump1090-fa/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=${DUMP1090_HEYWHATSTHAT_ID}&refraction=0.25&alts=${DUMP1090_HEYWHATSTHAT_RING_ONE},${DUMP1090_HEYWHATSTHAT_RING_TWO}"
fi
fi
@ -213,7 +213,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-fa setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -60,9 +60,9 @@ echo -e ""
echo -e "\e[92m Setting up dump1090-mutability..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090-mutability Setup" --yesno "Dump 1090 is a Mode-S decoder specifically designed for RTL-SDR devices. Dump1090-mutability is a fork of MalcolmRobb's version of dump1090 that adds new functionality and is designed to be built as a Debian/Raspbian package.\n\n https://github.com/mutability/dump1090\n\nContinue setup by installing dump1090-mutability?" 14 78
if [ $? -eq 1 ]; then
if [[ $? -eq 1 ]] ; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
@ -95,7 +95,7 @@ CheckPackage fakeroot
echo -e ""
echo -e "\e[95m Preparing the dump1090-mutability Git repository...\e[97m"
echo -e ""
if [ -d "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090" ] && [ -d "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090/.git" ]; then
if [[ -d "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090" ]] && [[ -d "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090/.git" ]] ; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the dump1090-mutability git repository directory...\e[97m"
cd ${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090
@ -117,7 +117,7 @@ fi
echo -e ""
echo -e "\e[95m Building and installing the dump1090-mutability package...\e[97m"
echo -e ""
if [ ! "${PWD}" = ${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090 ]; then
if [[ ! "${PWD}" = "${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090" ]] ; then
echo -e "\e[94m Entering the dump1090-mutability git repository directory...\e[97m"
cd ${RECEIVER_BUILD_DIRECTORY}/dump1090/dump1090
fi
@ -134,7 +134,7 @@ sudo dpkg -i dump1090-mutability_1.15~dev_*.deb
# Check that the package was installed.
echo -e ""
echo -e "\e[94m Checking that the dump1090-mutability package was installed properly...\e[97m"
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
# If the dump1090-mutability package could not be installed halt setup.
echo -e ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
@ -156,17 +156,17 @@ fi
echo -e ""
echo -e "\e[95m Begining post installation configuration...\e[97m"
echo -e ""
if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Explain to the user that the receiver's latitude and longitude is required.
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --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
# Ask the user for the receiver's latitude.
RECEIVER_LATITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Receiver Latitude" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 " ${RECEIVER_LATITUDE}" 3>&1 1>&2 2>&3)
while [ -z "${RECEIVER_LATITUDE}" ]; do
while [[ -z "${RECEIVER_LATITUDE}" ]] ; do
RECEIVER_LATITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Receiver Latitude (REQUIRED)" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 " ${RECEIVER_LATITUDE}" 3>&1 1>&2 2>&3)
done
# Ask the user for the receiver's longitude.
RECEIVER_LONGITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Receiver Longitude" --nocancel --inputbox "\nEnter your receeiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 " ${RECEIVER_LONGITUDE}" 3>&1 1>&2 2>&3)
while [ -z "${RECEIVER_LONGITUDE}" ]; do
while [[ -z "${RECEIVER_LONGITUDE}" ]] ; do
RECEIVER_LONGITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Receiver Longitude (REQUIRED)" --nocancel --inputbox "\nEnter your receeiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 " ${RECEIVER_LONGITUDE}" 3>&1 1>&2 2>&3)
done
fi
@ -176,25 +176,25 @@ echo -e "\e[94m Setting the receiver's longitude to ${RECEIVER_LONGITUDE}...\e[
#ChangeConfig "LON" "$(sed -e 's/[[:space:]]*$//' <<<${RECEIVER_LONGITUDE})" "${DUMP1090_CONFIGURATION_FILE}"
# Ask for a Bing Maps API key.
if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
DUMP1090_BING_MAPS_KEY=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Bing Maps API Key" --nocancel --inputbox "\nProvide a Bing Maps API key here to enable the Bing imagery layer.\nYou can obtain a free key at https://www.bingmapsportal.com/\n\nProviding a Bing Maps API key is not required to continue." 11 78 "${DUMP1090_BING_MAPS_KEY}" 3>&1 1>&2 2>&3)
fi
if [ -n "${DUMP1090_BING_MAPS_KEY}" ]; then
if [[ -n "${DUMP1090_BING_MAPS_KEY}" ]] ; then
echo -e "\e[94m Setting the Bing Maps API Key to ${DUMP1090_BING_MAPS_KEY}...\e[97m"
ChangeConfig "BingMapsAPIKey" "${DUMP1090_BING_MAPS_KEY}" "/usr/share/dump1090-fa/html/config.js"
fi
# Ask for a Mapzen API key.
if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
DUMP1090_MAPZEN_KEY=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Mapzen API Key" --nocancel --inputbox "\nProvide a Mapzen API key here to enable the Mapzen vector tile layer within the dump1090-mutability map. You can obtain a free key at https://mapzen.com/developers/\n\nProviding a Mapzen API key is not required to continue." 13 78 ${DUMP1090_MAPZEN_KEY} 3>&1 1>&2 2>&3)
fi
if [ -n "${DUMP1090_MAPZEN_KEY}" ]; then
if [[ -n "${DUMP1090_MAPZEN_KEY}" ]] ; then
echo -e "\e[94m Setting the Mapzen API Key to ${DUMP1090_MAPZEN_KEY}...\e[97m"
ChangeConfig "MapzenAPIKey" "${DUMP1090_MAPZEN_KEY}" "/usr/share/dump1090-fa/html/config.js"
fi
# Ask if dump1090-mutability should bind on all IP addresses.
if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Bind Dump1090-mutability To All IP Addresses" --yesno "By default dump1090-mutability is bound only to the local loopback IP address(s) for security reasons. However some people wish to make dump1090-mutability's data accessable externally by other devices. To allow this dump1090-mutability can be configured to listen on all IP addresses bound to this device. It is recommended that unless you plan to access this device from an external source that dump1090-mutability remain bound only to the local loopback IP address(s).\n\nWould you like dump1090-mutability to listen on all IP addesses?" 15 78
case $? in
0)
@ -205,7 +205,7 @@ if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
;;
esac
fi
if [ "${DUMP1090_BIND_TO_ALL_IPS}" = "true" ]; then
if [[ "${DUMP1090_BIND_TO_ALL_IPS}" = "true" ]] ; then
echo -e "\e[94m Binding dump1090-mutability to all available IP addresses...\e[97m"
CommentConfig "NET_BIND_ADDRESS" "${DUMP1090_CONFIGURATION_FILE}"
else
@ -220,7 +220,7 @@ if [[ `grep "MAX_RANGE" ${DUMP1090_CONFIGURATION_FILE} | awk -F \" '{print $2}'
fi
# Ask if dump1090-mutability measurments should be displayed using imperial or metric.
if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Unit of Measurement" --nocancel --menu "\nChoose unit of measurement to be used by dump1090-mutbility." 11 78 2 "Imperial" "" "Metric" ""
case $? in
"Imperial")
@ -231,7 +231,7 @@ if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
;;
esac
fi
if [ "${DUMP1090_UNIT_OF_MEASURMENT}" = "metric" ]; then
if [[ "${DUMP1090_UNIT_OF_MEASURMENT}" = "metric" ]] ; then
echo -e "\e[94m Setting dump1090-mutability unit of measurement to Metric...\e[97m"
ChangeConfig "Metric" "true;" "/usr/share/dump1090-mutability/html/config.js"
else
@ -240,33 +240,33 @@ else
fi
# Download Heywhatsthat.com maximum range rings.
if [ ! -f /usr/share/dump1090-fa/html/upintheair.json ]; then
if [ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]; then
if [[ ! -f "/usr/share/dump1090-fa/html/upintheair.json" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
if (whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Heywhaststhat.com Maimum Range Rings" --yesno "Maximum range rings can be added to dump1090-fa usings data obtained from Heywhatsthat.com. In order to add these rings to your dump1090-fa 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
# Set the DUMP1090_HEYWHATSTHAT_INSTALL variable to true.
DUMP1090_HEYWHATSTHAT_INSTALL="true"
# Ask the user for the Heywhatsthat.com panarama ID.
DUMP1090_HEYWHATSTHAT_ID_TITLE="Heywhatsthat.com Panarama ID"
while [[ -z "${DUMP1090_HEYWHATSTHAT_ID}" ]]; do
DUMP1090_HEYWHATSTHAT_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_ID}_TITLE" --nocancel --inputbox "\nEnter your Heywhatsthat.com panarama ID." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DUMP1090_HEYWHATSTHAT_ID}" ]] ; do
DUMP1090_HEYWHATSTHAT_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_ID_TITLE}" --nocancel --inputbox "\nEnter your Heywhatsthat.com panarama ID." 8 78 3>&1 1>&2 2>&3)
DUMP1090_HEYWHATSTHAT_ID_TITLE="Heywhatsthat.com Panarama ID (REQUIRED)"
done
# Ask the user what altitude in meters to set the first range ring.
DUMP1090_HEYWHATSTHAT_RING_ONE_TITLE="Heywhatsthat.com First Ring Altitude"
while [ -z "${DUMP1090_HEYWHATSTHAT_RING_ONE}" ]; do
DUMP1090_HEYWHATSTHAT_RING_ONE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_RING_ONE}_TITLE" --nocancel --inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
while [[ -z "${DUMP1090_HEYWHATSTHAT_RING_ONE}" ]] ; do
DUMP1090_HEYWHATSTHAT_RING_ONE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_RING_ONE_TITLE}" --nocancel --inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
DUMP1090_HEYWHATSTHAT_RING_ONE_TITLE="Heywhatsthat.com First Ring Altitude (REQUIRED)"
done
# Ask the user what altitude in meters to set the second range ring.
DUMP1090_HEYWHATSTHAT_RING_TWO_TITLE="Heywhatsthat.com Second Ring Altitude"
while [ -z "${DUMP1090_HEYWHATSTHAT_RING_TWO}" ]; do
DUMP1090_HEYWHATSTHAT_RING_TWO=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_RING_TWO}_TITLE" --nocancel --inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
while [[ -z "${DUMP1090_HEYWHATSTHAT_RING_TWO}" ]] ; do
DUMP1090_HEYWHATSTHAT_RING_TWO=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUMP1090_HEYWHATSTHAT_RING_TWO_TITLE}" --nocancel --inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
DUMP1090_HEYWHATSTHAT_RING_TWO_TITLE="Heywhatsthat.com Second Ring Altitude (REQUIRED)"
done
fi
fi
# If the Heywhatsthat.com maximum range rings are to be added download them now.
if [ "${DUMP1090_HEYWHATSTHAT_INSTALL}" = "true" ]; then
if [[ "${DUMP1090_HEYWHATSTHAT_INSTALL}" = "true" ]] ; then
echo -e "\e[94m Downloading JSON data pertaining to the supplied panorama ID...\e[97m"
echo -e ""
sudo wget -O /usr/share/dump1090-fa/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=${DUMP1090_HEYWHATSTHAT_ID}&refraction=0.25&alts=${DUMP1090_HEYWHATSTHAT_RING_ONE},${DUMP1090_HEYWHATSTHAT_RING_TWO}"

Wyświetl plik

@ -47,15 +47,15 @@ fi
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
clear
echo -e "\n\e[91m $RECEIVER_PROJECT_TITLE"
echo -e "\n\e[91m ${RECEIVER_PROJECT_TITLE}"
fi
echo -e ""
echo -e "\e[92m Setting up dump978..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump1090-mutability Setup" --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals.\n\n https://github.com/mutability/dump978\n\nWould you like to continue setup by installing dump978?" 9 78
if [ $? -eq 1 ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090-mutability Setup" --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals.\n\n https://github.com/mutability/dump978\n\nWould you like to continue setup by installing dump978?" 9 78
if [[ $? -eq 1 ]] ; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
@ -88,15 +88,15 @@ echo -e "\e[95m Preparing the dump978 Git repository...\e[97m"
echo -e ""
# Remove the existing dumpp978 build directory if it exists.
if [ -d $RECEIVER_BUILD_DIRECTORY/dump978 ]; then
if [[ -d "${RECEIVER_BUILD_DIRECTORY}/dump978" ]] ; then
# Delete the current dump978 build directory if it already exists.
echo -e "\e[94m Deleting the existing dump978 Git repository directory...\e[97m"
rm -rf $RECEIVER_BUILD_DIRECTORY/dump978
rm -rf ${RECEIVER_BUILD_DIRECTORY}/dump978
fi
# Clone the dump978 Git repository.
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY
cd ${RECEIVER_BUILD_DIRECTORY}
echo -e "\e[94m Cloning the dump978 Git repository locally...\e[97m"
echo -e ""
git clone https://github.com/mutability/dump978.git
@ -107,9 +107,9 @@ echo -e ""
echo -e "\e[95m Building the dump978 binaries...\e[97m"
echo -e ""
# Enter the dump978 repository if we are not already in it.
if [ ! "$PWD" = $RECEIVER_BUILD_DIRECTORY/dump978 ]; then
if [[ ! "${PWD}" = "${RECEIVER_BUILD_DIRECTORY}/dump978" ]] ; then
echo -e "\e[94m Entering the dump978 Git repository directory...\e[97m"
cd $RECEIVER_BUILD_DIRECTORY/dump978
cd ${RECEIVER_BUILD_DIRECTORY}/dump978
fi
# Build the dump978 binaries from source.
echo -e "\e[94m Building the dump978 binaries...\e[97m"
@ -119,7 +119,7 @@ echo -e ""
# Check that the dump978 binaries were built.
echo -e "\e[94m Checking that the dump978 binaries were built...\e[97m"
if [ ! -f $RECEIVER_BUILD_DIRECTORY/dump978/dump978 ] || [ ! -f $RECEIVER_BUILD_DIRECTORY/dump978/uat2esnt ] || [ ! -f $RECEIVER_BUILD_DIRECTORY/dump978/uat2json ] || [ ! -f $RECEIVER_BUILD_DIRECTORY/dump978/uat2text ]; then
if [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978" ]] || [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2esnt" ]] || [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2json" ]] || [[ ! -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2text" ]] ; then
# If the dump978 binaries could not be found halt setup.
echo -e ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
@ -157,24 +157,24 @@ echo -e ""
# Check if the dump1090-mutability package is installed.
echo -e "\e[94m Checking if the dump1090-mutability package is installed...\e[97m"
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
# The dump1090-mutability package appear to be installed.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "RTL-SDR Dongle Assignments" --msgbox "It appears the dump1090-mutability package is installed on this device. In order to run dump978 in tandem with dump1090-mutability you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run both decoders on a single device you will need to have two separate RTL-SDR devices connected to your device." 12 78
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR Dongle Assignments" --msgbox "It appears the dump1090-mutability package is installed on this device. In order to run dump978 in tandem with dump1090-mutability you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run both decoders on a single device you will need to have two separate RTL-SDR devices connected to your device." 12 78
# Ask the user which USB device is to be used for dump1090.
DUMP1090_DEVICE_ID=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump1090 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
while [ -z $DUMP1090_DEVICE_ID ]; do
DUMP1090_DEVICE_ID=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump1090 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
DUMP1090_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DUMP1090_DEVICE_ID}" ]] ; do
DUMP1090_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
done
# Ask the user which USB device is to be use for dump978.
DUMP978_DEVICE_ID=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump978 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
while [ -z $DUMP978_DEVICE_ID ]; do
DUMP978_DEVICE_ID=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump978 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
DUMP978_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DUMP978_DEVICE_ID}" ]] ; do
DUMP978_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
done
fi
# Assign the specified RTL-SDR dongle to dump1090-mutability.
echo -e "\e[94m Assigning RTL-SDR dongle \"$DUMP1090DEVICE\" to dump1090-mutability...\e[97m"
ChangeConfig "DEVICE" $DUMP1090_DEVICE_ID "/etc/default/dump1090-mutability"
echo -e "\e[94m Assigning RTL-SDR dongle \"${DUMP1090_DEVICE_ID}\" to dump1090-mutability...\e[97m"
ChangeConfig "DEVICE" ${DUMP1090_DEVICE_ID} "/etc/default/dump1090-mutability"
echo -e "\e[94m Restarting dump1090-mutability...\e[97m"
echo -e ""
sudo /etc/init.d/dump1090-mutability restart
@ -188,7 +188,7 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
fi
# If a device has not yet been assigned to dump978 assign the first available.
if [ -z $DUMP978_DEVICE_ID ]; then
if [[ -z "${DUMP978_DEVICE_ID}" ]] ; then
echo -e "\e[94m Assigning RTL-SDR dongle \"0\" to dump978...\e[97m"
DUMP978_DEVICE_ID="0"
fi
@ -196,54 +196,54 @@ fi
# Declare the LIGHTTPD_DOCUMENT_ROOT_DIRECTORY variable.
echo -e "\e[94m Getting the path to Lighttpd's document root...\e[97m"
LIGHTTPD_DOCUMENT_ROOT_SETTING=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root`
LIGHTTPD_DOCUMENT_ROOT_DIRECTORY=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< $LIGHTTPD_DOCUMENT_ROOT_SETTING`
LIGHTTPD_DOCUMENT_ROOT_DIRECTORY=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< ${LIGHTTPD_DOCUMENT_ROOT_SETTING}`
# Set the receivers latitude and longitude.
if [ -z $RECEIVER_LATITUDE ] && [ -z $RECEIVER_LONGITUDE ] && [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ -z "${RECEIVER_LATITUDE}" ]] && [[ -z "${RECEIVER_LONGITUDE}" ]] && [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# If the receiver's' latitude has not yet been set ask for it.
RECEIVER_LATITUDE_TITLE="Receiver Latitude"
while [ -z $RECEIVER_LATITUDE ]; do
RECEIVER_LATITUDE=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$RECEIVER_LATITUDE_TITLE" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
while [[ -z "${RECEIVER_LATITUDE}" ]] ; do
RECEIVER_LATITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${RECEIVER_LATITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
RECEIVER_LATITUDE_TITLE="Receiver Latitude (REQUIRED)"
done
# If the receiver's' longitude has not yet been set ask for it.
RECEIVER_LONGITUDE_TITLE="Receiver Longitude"
while [ -z $RECEIVER_LONGITUDE ]; do
RECEIVER_LONGITUDE=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$RECEIVER_LONGITUDE_TITLE" --nocancel --inputbox "\nEnter your receiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
while [[ -z "${RECEIVER_LONGITUDE}" ]] ; do
RECEIVER_LONGITUDE=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${RECEIVER_LONGITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
RECEIVER_LONGITUDE_TITLE="Receiver Latitude (REQUIRED)"
done
fi
# Finally set the reciver's latitude and longitude if these variables were supplied.
if [ -n $RECEIVER_LATITUDE ] && [ -n $RECEIVER_LONGITUDE ]; then
echo -e "\e[94m Setting the receiver's latitude to $RECEIVER_LATITUDE...\e[97m"
ChangeConfig "SiteLat" "$RECEIVER_LATITUDE" "$LIGHTTPD_DOCUMENT_ROOT_DIRECTORY/dump978/config.js"
echo -e "\e[94m Setting the receiver's longitude to $RECEIVER_LONGITUDE...\e[97m"
ChangeConfig "SiteLon" "$RECEIVER_LONGITUDE" "$LIGHTTPD_DOCUMENT_ROOT_DIRECTORY/dump978/config.js"
if [[ -n "${RECEIVER_LATITUDE}" ]] && [[ -n "${RECEIVER_LONGITUDE}" ]] ; then
echo -e "\e[94m Setting the receiver's latitude to ${RECEIVER_LATITUDE}...\e[97m"
ChangeConfig "SiteLat" "${RECEIVER_LATITUDE}" "${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/config.js"
echo -e "\e[94m Setting the receiver's longitude to ${RECEIVER_LONGITUDE}...\e[97m"
ChangeConfig "SiteLon" "${RECEIVER_LONGITUDE}" "${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/config.js"
fi
# Create the dump978 JSON directory in Lighttpd's document root.
echo -e "\e[94m Creating the dump978 JSON data directory within Lighttpd's document root...\e[97m"
sudo mkdir -p $LIGHTTPD_DOCUMENT_ROOT_DIRECTORY/dump978/data
sudo mkdir -p ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/data
echo -e "\e[94m Setting permissions for the dump978 JSON data directory within Lighttpd's document root...\e[97m"
sudo chmod +w $LIGHTTPD_DOCUMENT_ROOT_DIRECTORY/dump978/data
sudo chmod +w ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/data
# Create the dump978 maintenance script.
echo -e "\e[94m Creating the dump978 maintenance script...\e[97m"
tee $RECEIVER_BUILD_DIRECTORY/dump978/dump978-maint.sh > /dev/null <<EOF
tee ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh > /dev/null <<EOF
#!/bin/bash
# Start dump978 without logging.
while true; do
rtl_sdr -d $DUMP978DEVICE -f 978000000 -s 2083334 -g 48 - | $DUMP978BUILDDIRECTORY/dump978 | tee >($DUMP978BUILDDIRECTORY/uat2json $LIGHTTPDDOCUMENTROOTDIRECTORY/dump978/data) | $DUMP978BUILDDIRECTORY/uat2esnt | /bin/nc -q1 127.0.0.1 30001
rtl_sdr -d ${DUMP978_DEVICE_ID} -f 978000000 -s 2083334 -g 48 - | ${RECEIVER_BUILD_DIRECTORY}/dump978 | tee >(${RECEIVER_BUILD_DIRECTORY}/uat2json ${LIGHTTPD_DOCUMENT_ROOT_DIRECTORY}/dump978/data) | ${RECEIVER_BUILD_DIRECTORY}/uat2esnt | /bin/nc -q1 127.0.0.1 30001
sleep 15
done
EOF
echo -e "\e[94m Setting permissions on the dump978 maintenance script...\e[97m"
chmod +x $RECEIVER_BUILD_DIRECTORY/dump978/dump978-maint.sh
chmod +x ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh
# Add the dump978 maintenance script to /etc/rc.local.
echo -e "\e[94m Checking if the file /etc/rc.local is already set to execute the dump978 maintenance script...\e[97m"
if [[ `grep -cFx "$RECEIVER_BUILD_DIRECTORY/dump978/dump978-maint.sh &" /etc/rc.local` -eq 0 ]] ; then
if [[ `grep -cFx "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh &" /etc/rc.local` -eq 0 ]] ; then
echo -e "\e[94m Adding a line to execute the dump978 maintenance script to the file /etc/rc.local...\e[97m"
LINENUMBER=($(sed -n '/exit 0/=' /etc/rc.local))
((LINENUMBER>0)) && sudo sed -i "${LINENUMBER[$((${#LINENUMBER[@]}-1))]}i ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh &\n" /etc/rc.local
@ -255,7 +255,7 @@ echo -e ""
echo -e "\e[95m Starting dump978...\e[97m"
echo -e ""
echo -e "\e[94m Starting dump978 by executing the dump978 maintenance script...\e[97m"
sudo nohup $RECEIVER_BUILD_DIRECTORY/dump978/dump978-maint.sh > /dev/null 2>&1 &
sudo nohup ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978-maint.sh > /dev/null 2>&1 &
### SETUP COMPLETE
@ -267,7 +267,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Dump978 setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -54,7 +54,7 @@ echo -e "\e[92m Setting up RTL-SDR OGN...\e[97m"
echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR OGN Setup" --yesno "The objective of the Open Glider Network is to create and maintain a unified tracking platform for gliders and other GA aircraft. Currently OGN focuses on tracking aircraft equipped with FLARM, FLARM-compatible devices or OGN tracker.\n\nPlease note you will need a dedicated RTL-SDR dongle to use this software.\n\n http://wiki.glidernet.org\n\nContinue setup by installing RTL-SDR OGN?" 14 78
if [[ $? -eq 1 ]] ; then
# Setup has been halted by the user.
@ -86,7 +86,7 @@ fi
# Check if the dump978 binaries exist.
echo -e "\e[94m Checking if the dump978 binaries exist on this device...\e[97m"
if [[ -f ${RECEIVER_BUILD_DIRECTORY}/dump978/dump978 ]] && [[ -f ${RECEIVER_BUILD_DIRECTORY}/dump978/uat2text ]] && [[ -f ${RECEIVER_BUILD_DIRECTORY}/dump978/uat2esnt ]] && [[ -f ${RECEIVER_BUILD_DIRECTORY}/dump978/uat2json ]] ; then
if [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2text" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2esnt" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2json" ]] ; then
DUMP978_IS_INSTALLED="true"
else
DUMP978_IS_INSTALLED="false"
@ -97,10 +97,10 @@ if [[ ${DUMP1090_IS_INSTALLED} = "true" ]] || [[${DUMP978_IS_INSTALLED} = "true"
# Check if Dump1090 is installed.
if [[ ${DUMP1090_IS_INSTALLED} = "true" ]] ; then
# The dump1090-mutability package appear to be installed.
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask the user which USB device is to be used for dump1090.
DUMP1090_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
while [[ -z ${DUMP1090_DEVICE_ID} ]] ; do
while [[ -z "${DUMP1090_DEVICE_ID}" ]] ; do
DUMP1090_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump1090 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
done
else
@ -111,10 +111,10 @@ if [[ ${DUMP1090_IS_INSTALLED} = "true" ]] || [[${DUMP978_IS_INSTALLED} = "true"
# Check if Dump978 is installed.
if [[ ${DUMP978_IS_INSTALLED} = "true" ]] ; then
# The dump978 binaries appear to exist on this device.
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask the user which USB device is to be use for dump978.
DUMP978_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
while [[ -z ${DUMP978_DEVICE_ID} ]] ; do
while [[ -z "${DUMP978_DEVICE_ID}" ]] ; do
DUMP978_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your dump978 RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
done
else
@ -123,10 +123,10 @@ if [[ ${DUMP1090_IS_INSTALLED} = "true" ]] || [[${DUMP978_IS_INSTALLED} = "true"
fi
fi
#
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask the user which USB device is to be use for RTL-SDR OGN.
RTLSDROGN_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR OGN RTL-SDR Dongle" --nocancel --inputbox "\nEnter the ID for your RTL-SDR OGN RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
while [[ -z ${DUMP978_DEVICE_ID} ]] ; do
while [[ -z "${DUMP978_DEVICE_ID}" ]] ; do
RTLSDROGN_DEVICE_ID=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR OGN RTL-SDR Dongle (REQUIRED)" --nocancel --inputbox "\nEnter the ID for your RTL-SDR OGN RTL-SDR dongle." 8 78 3>&1 1>&2 2>&3)
done
else
@ -134,7 +134,7 @@ if [[ ${DUMP1090_IS_INSTALLED} = "true" ]] || [[${DUMP978_IS_INSTALLED} = "true"
true
fi
# Assign the specified RTL-SDR dongle to dump1090.
if [[ ${DUMP1090_IS_INSTALLED} = "true" ]] && [[ -n ${DUMP1090_DEVICE_ID} ]] ; then
if [[ "${DUMP1090_IS_INSTALLED}" = "true" ]] && [[ -n "${DUMP1090_DEVICE_ID}" ]] ; then
echo -e "\e[94m Assigning RTL-SDR dongle \"DUMP1090_DEVICE_ID\" to dump1090-mutability...\e[97m"
ChangeConfig "DEVICE" ${DUMP1090_DEVICE_ID} "/etc/default/dump1090-mutability"
echo -e "\e[94m Reloading dump1090-mutability...\e[97m"
@ -143,7 +143,7 @@ if [[ ${DUMP1090_IS_INSTALLED} = "true" ]] || [[${DUMP978_IS_INSTALLED} = "true"
echo -e ""
fi
# Assign the specified RTL-SDR dongle to dump978
if [[ ${DUMP978_IS_INSTALLED} = "true" ]] && [[ -n ${DUMP978_DEVICE_ID} ]] ; then
if [[ "${DUMP978_IS_INSTALLED}" = "true" ]] && [[ -n "${DUMP978_DEVICE_ID}" ]] ; then
echo -e "\e[94m Assigning RTL-SDR dongle \"${DUMP978_DEVICE_ID}\" to dump978...\e[97m"
### ADD DEVICE TO MAINTENANCE SCRIPT...
echo -e "\e[94m Reloading dump978...\e[97m"
@ -180,7 +180,7 @@ echo -e ""
### BLACKLIST UNWANTED RTL-SDR MODULES FROM BEING LOADED
if [[ ! -f /etc/modprobe.d/rtlsdr-blacklist.conf ]] ; then
if [[ ! -f "/etc/modprobe.d/rtlsdr-blacklist.conf" ]] ; then
echo -e "\e[94m Stopping unwanted kernel modules from being loaded...\e[97m"
echo -e ""
sudo tee /etc/modprobe.d/rtlsdr-blacklist.conf > /dev/null <<EOF
@ -196,7 +196,7 @@ fi
### CHECK FOR EXISTING INSTALL AND IF SO STOP IT
if [[ -f /etc/init.d/rtlsdr-ogn ]] ; then
if [[ -f "/etc/init.d/rtlsdr-ogn" ]] ; then
echo -e "\e[94m Stopping the RTL-SDR OGN service...\e[97m"
sudo service rtlsdr-ogn stop
fi
@ -204,7 +204,7 @@ fi
### DOWNLOAD AND SET UP THE BINARIES
# Create build directory if not already present.
if [[ ! -d ${RECEIVER_BUILD_DIRECTORY}/rtlsdr-ogn ]] ; then
if [[ ! -d "${RECEIVER_BUILD_DIRECTORY}/rtlsdr-ogn" ]] ; then
echo -e "\e[94m Creating the directory (${RECEIVER_BUILD_DIRECTORY}/rtlsdr-ogn)...\e[97m"
mkdir ${RECEIVER_BUILD_DIRECTORY}/rtlsdr-ogn
fi
@ -263,7 +263,7 @@ echo -e "\e[94m Entering the directory containing the RTL-SDR binaries...\e[97m
cd ${RECEIVER_BUILD_DIRECTORY}/rtlsdr-ogn/rtlsdr-ogn
# Create named pipe if required.
if [[ ! -p ogn-rf.fifo ]] ; then
if [[ ! -p "ogn-rf.fifo" ]] ; then
echo -e "\e[94m Creating named pipe...\e[97m"
sudo mkfifo ogn-rf.fifo
fi
@ -278,7 +278,7 @@ sudo chown root rtlsdr-ogn
sudo chmod a+s rtlsdr-ogn
# Creat GPU device if required.
if [[ ! -c gpu_dev ]] ; then
if [[ ! -c "gpu_dev" ]] ; then
# Check if kernel v4.1 or higher is being used.
echo -e "\e[94m Getting the version of the kernel currently running...\e[97m"
KERNEL=`uname -r`
@ -345,7 +345,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------\n"
echo -e "\e[92m RTL-SDR OGN setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -117,7 +117,7 @@ else
fi
else
# If the user elected to not compile the PhantomJS binary if needed in the installation configuration file exit now.
if [[ ! ${ABOVETUSTIN_COMPILE_IF_NEEDED} = "true" ]] ; then
if [[ ! "${ABOVETUSTIN_COMPILE_IF_NEEDED}" = "true" ]] ; then
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo " A prebuilt PhantomJS binary is not available for this system."
echo -e ""
@ -201,7 +201,7 @@ fi
# If any exist assign the current Twitter keys and access tokens to variables.
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
TWITTER_ACCESS_TOKEN_TITLE="Twitter Access Token"
while [[ -z ${TWITTER_ACCESS_TOKEN} ]] ; do
while [[ -z "${TWITTER_ACCESS_TOKEN}" ]] ; do
if [[ `grep -c "^access_token =" ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini` -gt 0 ]] ; then
TWITTER_ACCESS_TOKEN=$(grep "^access_token =" "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini" | awk '{print $3}')
fi
@ -210,7 +210,7 @@ if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
done
#
TWITTER_ACCESS_TOKEN_SECRET_TITLE="Twitter Access Token Secret"
while [[ -z ${TWITTER_ACCESS_TOKEN_SECRET} ]] ; do
while [[ -z "${TWITTER_ACCESS_TOKEN_SECRET}" ]] ; do
if [[ `grep -c "^access_token_secret =" ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini` -gt 0 ]] ; then
TWITTER_ACCESS_TOKEN_SECRET=$(grep "^access_token_secret =" "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini" | awk '{print $3}')
fi
@ -219,7 +219,7 @@ if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
done
#
TWITTER_CONSUMER_KEY_TITLE="Twitter Consumer Key"
while [[ -z ${TWITTER_CONSUMER_KEY} ]] ; do
while [[ -z "${TWITTER_CONSUMER_KEY}" ]] ; do
if [[ `grep -c "^consumer_key =" ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini` -gt 0 ]] ; then
TWITTER_CONSUMER_KEY=$(grep "^consumer_key =" "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini" | awk '{print $3}')
fi
@ -228,7 +228,7 @@ if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
done
#
TWITTER_CONSUMER_SECRET_TITLE="Twitter Consumer Secret"
while [[ -z ${TWITTER_CONSUMER_SECRET} ]] ; do
while [[ -z "${TWITTER_CONSUMER_SECRET}" ]] ; do
if [[ `grep -c "^consumer_secret =" ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini` -gt 0 ]] ; then
TWITTER_CONSUMER_SECRET=$(grep "^consumer_secret =" "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini" | awk '{print $3}')
fi
@ -248,7 +248,7 @@ if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
if [[ `grep -c "^latitude =" ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini` -gt 0 ]] ; then
RECEIVER_LATITUDE=$(grep "^latitude =" "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini" | awk '{print $3}')
RECEIVER_LATITUDE_SOURCE=", the value below is configured in AboveTustin"
elif [[ -s /etc/default/dump1090-mutability ]] && [[ `grep -c "^LAT =" /etc/default/dump1090-mutability` -gt 0 ]] ; then
elif [[ -s "/etc/default/dump1090-mutability" ]] && [[ `grep -c "^LAT =" /etc/default/dump1090-mutability` -gt 0 ]] ; then
RECEIVER_LATITUDE=$(grep "^LAT" "/etc/default/dump1090-mutability" | awk '{print $3}')
RECEIVER_LATITUDE_SOURCE=", the value below is configured in Dump1090"
fi
@ -262,7 +262,7 @@ if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
if [[ `grep -c "^longitude =" ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini` -gt 0 ]] ; then
RECEIVER_LONGITUDE=$(grep "^longitude =" "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini" | awk '{print $3}')
RECEIVER_LONGITUDE_SOURCE=", the value below is configured in AboveTustin"
elif [[ -s /etc/default/dump1090-mutability ]] && [[ `grep -c "^LON =" /etc/default/dump1090-mutability` -gt 0 ]] ; then
elif [[ -s "/etc/default/dump1090-mutability" ]] && [[ `grep -c "^LON =" /etc/default/dump1090-mutability` -gt 0 ]] ; then
RECEIVER_LONGITUDE=$(grep "^LON" "/etc/default/dump1090-mutability" | awk '{print $3}')
RECEIVER_LONGITUDE_SOURCE=", the value below is configured in Dump1090"
fi
@ -278,7 +278,7 @@ echo -e "\e[95m Commencing installation...\e[97m"
echo -e ""
# Confirm timezone.
if [[ -z ${TIME_ZONE} ]] ; then
if [[ -z "${TIME_ZONE}" ]] ; then
echo -e "\e[94m Confirming time zone...\e[97m"
TIME_ZONE=`cat /etc/timezone 2>&1`
TIME_ZONE_ESCAPED=`echo ${TIME_ZONE} | sed -e 's/\\//\\\\\//g'`
@ -382,7 +382,7 @@ if [[ "${PHANTOMJS_EXISTS}" = "false" ]] ; then
echo -e ""
echo -e "\e[95m Preparing the PhantomJS Git repository...\e[97m"
echo -e ""
if [[ -d ${COMPONENT_BUILD_DIRECTORY}/phantomjs ]] && [[ -d ${COMPONENT_BUILD_DIRECTORY}/phantomjs/.git ]] ; then
if [[ -d "${COMPONENT_BUILD_DIRECTORY}/phantomjs" ]] && [[ -d "${COMPONENT_BUILD_DIRECTORY}/phantomjs/.git" ]] ; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the PhantomJS git repository directory...\e[97m"
cd ${COMPONENT_BUILD_DIRECTORY}/phantomjs 2>&1
@ -407,7 +407,7 @@ if [[ "${PHANTOMJS_EXISTS}" = "false" ]] ; then
fi
# Enter the PhantomJS build directory if not already there.
if [[ ! "${PWD}" = ${COMPONENT_BUILD_DIRECTORY}/phantomjs ]] ; then
if [[ ! "${PWD}" = "${COMPONENT_BUILD_DIRECTORY}/phantomjs" ]] ; then
echo -e "\e[94m Entering the PhantomJS Git repository directory...\e[97m"
cd ${COMPONENT_BUILD_DIRECTORY}/phantomjs 2>&1
fi
@ -501,7 +501,7 @@ echo -e "\e[95m Downloading and configuring ${COMPONENT_NAME}...\e[97m"
echo -e ""
echo -e "\e[94m Checking if the Git repository has been cloned...\e[97m"
if [[ -d ${COMPONENT_BUILD_DIRECTORY}/AboveTustin ]] && [[ -d ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/.git ]] ; then
if [[ -d "${COMPONENT_BUILD_DIRECTORY}/AboveTustin" ]] && [[ -d "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/.git" ]] ; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the local ${COMPONENT_NAME} git repository directory...\e[97m"
cd ${COMPONENT_BUILD_DIRECTORY}/AboveTustin 2>&1
@ -532,7 +532,7 @@ fi
# Copy the file config.sample.ini to config.ini
if [[ -s "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini" ]] ; then
echo -e "\e[94m Found existing configuration file config.ini...\e[97m"
elif [[ -s "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.sample.ini" ]]; then
elif [[ -s "${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.sample.ini" ]] ; then
echo -e "\e[94m Copying the file config.sample.ini to the file config.ini...\e[97m"
cp -v ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.sample.ini ${COMPONENT_BUILD_DIRECTORY}/AboveTustin/config.ini 2>&1
else
@ -616,7 +616,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m ${COMPONENT_NAME} setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -93,13 +93,13 @@ if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask the beast-splitter listen port.
BEASTSPLITTER_LISTEN_PORT_TITLE="Listen Port"
while [[ -z "${BEASTSPLITTER_LISTEN_PORT}" ]] ; do
BEASTSPLITTER_LISTEN_PORT=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${BEASTSPLITTER_LISTEN_PORT}_TITLE" --nocancel --inputbox "\nPlease enter the port ${COMPONENT_NAME} will listen on.\nThis must be a port which is currently not in use." 10 78 "30005" 3>&1 1>&2 2>&3)
BEASTSPLITTER_LISTEN_PORT=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${BEASTSPLITTER_LISTEN_PORT_TITLE}" --nocancel --inputbox "\nPlease enter the port ${COMPONENT_NAME} will listen on.\nThis must be a port which is currently not in use." 10 78 "30005" 3>&1 1>&2 2>&3)
BEASTSPLITTER_LISTEN_PORT_TITLE="Listen Port (REQUIRED)"
done
# Ask the beast-splitter connect port.
BEASTSPLITTER_CONNECT_PORT_TITLE="Connect Port"
while [[ -z "${BEASTSPLITTER_CONNECT_PORT}" ]] ; do
BEASTSPLITTER_CONNECT_PORT=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${BEASTSPLITTER_CONNECT_PORT}_TITLE" --nocancel --inputbox "\nPlease enter the port ${COMPONENT_NAME} will connect to.\nThis is generally port 30104 on dump1090." 10 78 "30104" 3>&1 1>&2 2>&3)
BEASTSPLITTER_CONNECT_PORT=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${BEASTSPLITTER_CONNECT_PORT_TITLE}" --nocancel --inputbox "\nPlease enter the port ${COMPONENT_NAME} will connect to.\nThis is generally port 30104 on dump1090." 10 78 "30104" 3>&1 1>&2 2>&3)
BEASTSPLITTER_CONNECT_PORT_TITLE="Connect Port (REQUIRED)"
done
fi
@ -127,7 +127,7 @@ echo -e "\e[95m Downloading and configuring ${COMPONENT_NAME}...\e[97m"
echo -e ""
echo -e "\e[94m Checking if the Git repository has been cloned...\e[97m"
if [[ -d ${COMPONENT_BUILD_DIRECTORY}/beast-splitter ]] && [[ -d ${COMPONENT_BUILD_DIRECTORY}/beast-splitter/.git ]] ; then
if [[ -d "${COMPONENT_BUILD_DIRECTORY}/beast-splitter" ]] && [[ -d "${COMPONENT_BUILD_DIRECTORY}/beast-splitter/.git" ]] ; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the local ${COMPONENT_NAME} git repository directory...\e[97m"
cd ${COMPONENT_BUILD_DIRECTORY}/beast-splitter 2>&1
@ -156,7 +156,7 @@ fi
echo -e ""
echo -e "\e[95m Building and installing the ${COMPONENT_NAME} package...\e[97m"
echo -e ""
if [[ ! "${PWD}" = ${COMPONENT_BUILD_DIRECTORY}/beast-splitter ]] ; then
if [[ ! "${PWD}" = "${COMPONENT_BUILD_DIRECTORY}/beast-splitter" ]] ; then
echo -e "\e[94m Entering the ${COMPONENT_NAME} git repository directory...\e[97m"
cd ${COMPONENT_BUILD_DIRECTORY}/beast-splitter 2>&1
fi
@ -225,7 +225,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m ${COMPONENT_NAME} setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -88,13 +88,13 @@ CheckPackage curl
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask for the user sub domain to be assigned to this device.
DUCKDNS_DOMAIN_TITLE="Duck DNS Sub Domain"
while [[ -z ${DUCKDNS_DOMAIN} ]]; do
while [[ -z "${DUCKDNS_DOMAIN}" ]] ; do
DUCKDNS_DOMAIN=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUCKDNS_DOMAIN_TITLE}" --nocancel --inputbox "\nPlease enter the Duck DNS sub domain you selected after registering.\nIf you do not have one yet visit http://www.ducknds.org to obtain one." 9 78 3>&1 1>&2 2>&3)
DUCKDNS_DOMAIN_TITLE="Duck DNS Sub Domain (REQUIRED)"
done
# Ask for the Duck DNS token to be assigned to this receiver.
DUCKDNS_TOKEN_TITLE="Duck DNS Token"
while [[ -z ${DUCKDNS_TOKEN} ]]; do
while [[ -z "${DUCKDNS_TOKEN}" ]] ; do
DUCKDNS_TOKEN=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "${DUCKDNS_TOKEN_TITLE}" --nocancel --inputbox "\nPlease enter your Duck DNS token." 8 78 3>&1 1>&2 2>&3)
DUCKDNS_TOKEN_TITLE="Duck DNS Token (REQUIRED)"
done
@ -174,7 +174,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m ${COMPONENT_NAME} setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -70,7 +70,7 @@ fi
## BEGIN SETUP
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
clear
echo -e "\n\e[91m ${ADSB_PROJECTTITLE}"
fi
@ -79,7 +79,7 @@ echo -e "\e[92m Setting up the ADS-B Exchange feed..."
echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "ADS-B Exchange Feed Setup" --yesno "ADS-B Exchange is a co-op of ADS-B/Mode S/MLAT feeders from around the world, and the worlds largest source of unfiltered flight data.\n\n http://www.adsbexchange.com/how-to-feed/\n\nContinue setting up the ADS-B Exchange feed?" 12 78
if [[ $? -eq 1 ]] ; then
# Setup has been halted by the user.
@ -167,7 +167,7 @@ if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# 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
if [[ -n ${RECEIVER_LATITUDE} ]] && [[ -n ${RECEIVER_LONGITUDE} ]] ; then
if [[ -n "${RECEIVER_LATITUDE}" ]] && [[ -n "${RECEIVER_LONGITUDE}" ]] ; then
RECEIVER_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'];" | awk '{printf("%.2f\n", $1)}')
RECEIVER_ALTITUDE_SOURCE=", the below value is obtained from google but should be increased to reflect your antennas height above ground level"
fi
@ -196,7 +196,7 @@ else
fi
# Establish if MLAT results should be fed back into local dump1090 instance.
if [[ -n ${FEEDER_MLAT_RETURN_PORT} ]] ; then
if [[ -n "${FEEDER_MLAT_RETURN_PORT}" ]] ; then
FEEDER_MLAT_RETURN_RESULTS="--results beast,connect,${FEEDER_MLAT_SRC_HOST}:${FEEDER_MLAT_RETURN_PORT}"
else
FEEDER_MLAT_RETURN_RESULTS=""
@ -208,7 +208,7 @@ if [[ ${FEEDER_MLAT_ENABLED} = "true" ]] ; then
echo -e ""
echo -e "\e[95m Preparing the mlat-client Git repository...\e[97m"
echo -e ""
if [[ -d ${MLAT_CLIENT_BUILD_DIRECTORY} ]] && [[ -d ${MLAT_CLIENT_BUILD_DIRECTORY}/.git ]] ; then
if [[ -d "${MLAT_CLIENT_BUILD_DIRECTORY}" ]] && [[ -d "${MLAT_CLIENT_BUILD_DIRECTORY}/.git" ]] ; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the mlat-client git repository directory...\e[97m"
cd ${MLAT_CLIENT_BUILD_DIRECTORY} 2>&1
@ -229,7 +229,7 @@ if [[ ${FEEDER_MLAT_ENABLED} = "true" ]] ; then
echo -e ""
echo -e "\e[95m Building and installing the mlat-client package...\e[97m"
echo -e ""
if [[ ! "${PWD}" = ${MLAT_CLIENT_BUILD_DIRECTORY} ]] ; then
if [[ ! "${PWD}" = "${MLAT_CLIENT_BUILD_DIRECTORY}" ]] ; then
echo -e "\e[94m Entering the mlat-client git repository directory...\e[97m"
echo -e ""
cd ${MLAT_CLIENT_BUILD_DIRECTORY} 2>&1
@ -273,7 +273,7 @@ if [[ ${FEEDER_MLAT_ENABLED} = "true" ]] ; then
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Exchange feed setup halted.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
@ -422,7 +422,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Exchange feed setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -33,27 +33,27 @@
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
FR24BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build/flightradar24"
PROJECTROOTDIRECTORY="${PWD}"
BASHDIRECTORY="${PROJECTROOTDIRECTORY}/bash"
BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build"
FR24BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build/flightradar24"
## INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
source ${BASHDIRECTORY}/variables.sh
source ${BASHDIRECTORY}/functions.sh
## BEGIN SETUP
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo -e "\n\e[91m ${ADSB_PROJECTTITLE}"
echo -e ""
echo -e "\e[92m Setting up the Flightradar24 feeder client..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Flightradar24 Feeder Client Setup" --yesno "The Flightradar24's feeder client can track flights within 200-400 miles and will automatically share data with Flightradar24. You can track flights directly off your device or via Flightradar24.com.\n\n http://www.flightradar24.com/share-your-data\n\nContinue setup by installing the Flightradar24 feeder client?" 13 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Flightradar24 Feeder Client Setup" --yesno "The Flightradar24's feeder client can track flights within 200-400 miles and will automatically share data with Flightradar24. You can track flights directly off your device or via Flightradar24.com.\n\n http://www.flightradar24.com/share-your-data\n\nContinue setup by installing the Flightradar24 feeder client?" 13 78
CONTINUESETUP=$?
if [ "$CONTINUESETUP" = 1 ]; then
if [[ "${CONTINUESETUP}" = 1 ]] ; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
@ -61,7 +61,7 @@ if [ "$CONTINUESETUP" = 1 ]; then
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup halted.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
@ -71,8 +71,8 @@ fi
echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m"
echo -e ""
if [[ `uname -m` = "x86_64" ]]; then
if [ $(dpkg --print-foreign-architectures $1 2>/dev/null | grep -c "i386") -eq 0 ]; then
if [[ `uname -m` = "x86_64" ]] ; then
if [[ $(dpkg --print-foreign-architectures $1 2>/dev/null | grep -c "i386") -eq 0 ]] ; then
echo -e "\e[94m Adding the i386 architecture...\e[97m"
sudo dpkg --add-architecture i386
echo -e "\e[94m Downloading latest package lists for enabled repositories and PPAs...\e[97m"
@ -100,17 +100,17 @@ echo -e ""
echo -e "\e[95m Begining the installation process...\e[97m"
echo -e ""
# Create the flightradar24 build directory if it does not exist.
if [ ! -d $FR24BUILDDIRECTORY ]; then
if [[ ! -d "${FR24BUILDDIRECTORY}" ]] ; then
echo -e "\e[94m Creating the Flightradar24 feeder client build directory...\e[97m"
mkdir $FR24BUILDDIRECTORY
mkdir ${FR24BUILDDIRECTORY}
fi
echo -e "\e[94m Entering the Flightradar24 feeder client build directory...\e[97m"
cd $FR24BUILDDIRECTORY
if [[ `uname -m` = "armv7l" ]] || [[ `uname -m` = "armv6l" ]] || [[ `uname -m` = "aarch64" ]]; then
cd ${FR24BUILDDIRECTORY}
if [[ `uname -m` = "armv7l" ]] || [[ `uname -m` = "armv6l" ]] || [[ `uname -m` = "aarch64" ]] ; then
## ARM INSTALLATION
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Plane Finder ADS-B Client Setup Instructions" --msgbox "This script will now download and execute the official Flightradar24 setup script. Follow the instructions provided and supply the required information when ask for by the script.\n\nOnce finished the ADS-B Receiver Project scripts will continue." 11 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Plane Finder ADS-B Client Setup Instructions" --msgbox "This script will now download and execute the official Flightradar24 setup script. Follow the instructions provided and supply the required information when ask for by the script.\n\nOnce finished the ADS-B Receiver Project scripts will continue." 11 78
echo -e "\e[94m Detected the device architecture as ARM...\e[97m"
echo -e "\e[94m Downloading the executing the Flightradar24 Pi24 installation script...\e[97m"
echo -e ""
@ -123,20 +123,20 @@ else
echo -e "\e[94m Detected the device architecture as I386...\e[97m"
echo -e "\e[94m Downloading the Flightradar24 feeder client package...\e[97m"
echo -e ""
wget http://feed.flightradar24.com/linux/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb -O $FR24BUILDDIRECTORY/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
wget http://feed.flightradar24.com/linux/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb -O ${FR24BUILDDIRECTORY}/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
echo -e "\e[94m Installing the Flightradar24 feeder client package...\e[97m"
if [[ `lsb_release -si` = "Debian" ]]; then
if [[ `lsb_release -si` = "Debian" ]] ; then
# Force architecture if this is Debian.
echo -e "\e[94m NOTE: dpkg executed with added flag --force-architecture.\e[97m"
echo -e ""
sudo dpkg -i --force-architecture $FR24BUILDDIRECTORY/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
sudo dpkg -i --force-architecture ${FR24BUILDDIRECTORY}/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
else
echo -e ""
sudo dpkg -i $FR24BUILDDIRECTORY/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
sudo dpkg -i ${FR24BUILDDIRECTORY}/fr24feed_${FR24CLIENTVERSIONI386}_i386.deb
fi
echo -e ""
echo -e "\e[94m Checking that the fr24feed package was installed properly...\e[97m"
if [ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# If the fr24feed package could not be installed halt setup.
echo -e ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
@ -148,7 +148,7 @@ else
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup halted.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
@ -165,7 +165,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Flightradar24 feeder client setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -33,27 +33,27 @@
## VAARIABLES
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
PIAWAREBUILDDIRECTORY="$PROJECTROOTDIRECTORY/build/piaware_builder"
PROJECTROOTDIRECTORY="${PWD}"
BASHDIRECTORY="${PROJECTROOTDIRECTORY}/bash"
BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build"
PIAWAREBUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build/piaware_builder"
## INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
source ${BASHDIRECTORY}/variables.sh
source ${BASHDIRECTORY}/functions.sh
## BEGIN SETUP
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo -e "\n\e[91m ${ADSB_PROJECTTITLE}"
echo -e ""
echo -e "\e[92m Setting up FlightAware's PiAware..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "PiAware Setup" --yesno "PiAware is a package used to forward data read from an ADS-B receiver to FlightAware. It does this using a program, piaware, while aided by other support programs.\n\n https://github.com/flightaware/piaware\n\nContinue setup by installing FlightAware's PiAware?" 13 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "PiAware Setup" --yesno "PiAware is a package used to forward data read from an ADS-B receiver to FlightAware. It does this using a program, piaware, while aided by other support programs.\n\n https://github.com/flightaware/piaware\n\nContinue setup by installing FlightAware's PiAware?" 13 78
CONTINUESETUP=$?
if [ "$CONTINUESETUP" = 1 ]; then
if [[ "${CONTINUESETUP}" = 1 ]] ; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
@ -61,7 +61,7 @@ if [ "$CONTINUESETUP" = 1 ]; then
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090-mutability setup halted.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
@ -91,17 +91,17 @@ CheckPackage itcl3
echo -e ""
echo -e "\e[95m Preparing the piaware_builder Git repository...\e[97m"
echo -e ""
if [ -d $PIAWAREBUILDDIRECTORY ] && [ -d $PIAWAREBUILDDIRECTORY/.git ]; then
if [[ -d "${PIAWAREBUILDDIRECTORY}" ]] && [[ -d "${PIAWAREBUILDDIRECTORY}/.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 $PIAWAREBUILDDIRECTORY
cd ${PIAWAREBUILDDIRECTORY}
echo -e "\e[94m Updating the local piaware_builder git repository...\e[97m"
echo -e ""
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 $BUILDDIRECTORY
cd ${BUILDDIRECTORY}
echo -e "\e[94m Cloning the piaware_builder git repository locally...\e[97m"
echo -e ""
git clone https://github.com/flightaware/piaware_builder.git
@ -112,28 +112,28 @@ fi
echo -e ""
echo -e "\e[95m Building and installing the PiAware package...\e[97m"
echo -e ""
if [ ! "$PWD" = $PIAWAREBUILDDIRECTORY ]; then
if [[ ! "${PWD}" = "${PIAWAREBUILDDIRECTORY}" ]] ; then
echo -e "\e[94m Entering the piaware_builder git repository directory...\e[97m"
cd $PIAWAREBUILDDIRECTORY
cd ${PIAWAREBUILDDIRECTORY}
fi
echo -e "\e[94m Executing the PiAware build script...\e[97m"
echo -e ""
./sensible-build.sh jessie
echo -e ""
echo -e "\e[94m Entering the PiAware build directory...\e[97m"
cd $PIAWAREBUILDDIRECTORY/package-jessie
cd ${PIAWAREBUILDDIRECTORY}/package-jessie
echo -e "\e[94m Building the PiAware package...\e[97m"
echo -e ""
dpkg-buildpackage -b
echo -e ""
echo -e "\e[94m Installing the PiAware package...\e[97m"
echo -e ""
sudo dpkg -i $PIAWAREBUILDDIRECTORY/piaware_*.deb
sudo dpkg -i ${PIAWAREBUILDDIRECTORY}/piaware_*.deb
# Check that the PiAware package was installed successfully.
echo -e ""
echo -e "\e[94m Checking that the piaware package was installed properly...\e[97m"
if [ $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# If the piaware package could not be installed halt setup.
echo -e ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
@ -145,60 +145,60 @@ if [ $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed"
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m PiAware setup halted.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
fi
# Move the .deb package into another directory simply to keep it for historical reasons.
if [ ! -d $PIAWAREBUILDDIRECTORY/packages ]; then
if [[ ! -d "${PIAWAREBUILDDIRECTORY}/packages" ]] ; then
echo -e "\e[94m Making the PiAware package archive directory...\e[97m"
mkdir $PIAWAREBUILDDIRECTORY/packages
mkdir ${PIAWAREBUILDDIRECTORY}/packages
fi
echo -e "\e[94m Moving the PiAware package into the package archive directory...\e[97m"
mv $PIAWAREBUILDDIRECTORY/piaware_*.deb $PIAWAREBUILDDIRECTORY/packages/
mv ${PIAWAREBUILDDIRECTORY}/piaware_*.deb ${PIAWAREBUILDDIRECTORY}/packages/
echo -e "\e[94m Moving the PiAware package changes file into the package archive directory...\e[97m"
mv $PIAWAREBUILDDIRECTORY/piaware_*.changes $PIAWAREBUILDDIRECTORY/packages/
mv ${PIAWAREBUILDDIRECTORY}/piaware_*.changes ${PIAWAREBUILDDIRECTORY}/packages/
## CONFIGURE FLIGHTAWARE
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 the page 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
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
# If the user supplied their FlightAware login continue with the device claiming process.
FLIGHTAWAREPASSWORD1_TITLE="Your FlightAware Password"
while [[ -z $FLIGHTAWAREPASSWORD1 ]]; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD1_TITLE" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD1}" ]] ; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD1_TITLE}" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
FLIGHTAWAREPASSWORD2_TITLE="Confirm Your FlightAware Password"
while [[ -z $FLIGHTAWAREPASSWORD2 ]]; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD2_TITLE" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD2}" ]] ; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD2_TITLE}" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
while [ ! $FLIGHTAWAREPASSWORD1 = $FLIGHTAWAREPASSWORD2 ]; do
while [[ ! "${FLIGHTAWAREPASSWORD1}" = "${FLIGHTAWAREPASSWORD2}" ]] ; do
FLIGHTAWAREPASSWORD1=""
FLIGHTAWAREPASSWORD2=""
# Display an error message if the passwords did not match.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Claim Your PiAware Device" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Claim Your PiAware Device" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
FLIGHTAWAREPASSWORD1_TITLE="Your FlightAware Password (REQUIRED)"
while [[ -z $FLIGHTAWAREPASSWORD1 ]]; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD1_TITLE" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD1}" ]] ; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD1_TITLE}" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
FLIGHTAWAREPASSWORD2_TITLE="Confirm Your FlightAware Password (REQUIRED)"
while [[ -z $FLIGHTAWAREPASSWORD2 ]]; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD2_TITLE" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD2}" ]] ; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD2_TITLE}" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
done
# Set the supplied user name and password in the configuration.
echo -e "\e[94m Setting the flightaware-user setting using piaware-config...\e[97m"
echo -e ""
sudo piaware-config flightaware-user $FLIGHTAWARELOGIN
sudo piaware-config flightaware-user ${FLIGHTAWARELOGIN}
echo -e ""
echo -e "\e[94m Setting the flightaware-password setting using piaware-config...\e[97m"
echo -e ""
sudo piaware-config flightaware-password $FLIGHTAWAREPASSWORD1
sudo piaware-config flightaware-password ${FLIGHTAWAREPASSWORD1}
echo -e ""
echo -e "\e[94m Restarting PiAware to ensure changes take effect...\e[97m"
echo -e ""
@ -206,7 +206,7 @@ if [ ! "$FLIGHTAWARELOGIN" = "" ]; then
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 the following URL.\n\nhttp://flightaware.com/adsb/piaware/claim." 10 78
fi
### SETUP COMPLETE
@ -219,7 +219,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m PiAware setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -33,28 +33,28 @@
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
PLANEFINDERBUILDDIRECTORY="$PROJECTROOTDIRECTORY/build/planefinder"
PROJECTROOTDIRECTORY="${PWD}"
BASHDIRECTORY="${PROJECTROOTDIRECTORY}/bash"
BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build"
PLANEFINDERBUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build/planefinder"
DEVICEIPADDRESS=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'`
## INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
source ${BASHDIRECTORY}/variables.sh
source ${BASHDIRECTORY}/functions.sh
## BEGIN SETUP
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo -e "\n\e[91m ${ADSB_PROJECTTITLE}"
echo -e ""
echo -e "\e[92m Setting up the Plane Finder ADS-B Client..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Plane Finder ADS-B Client Setup" --yesno "The Plane Finder ADS-B Client is an easy and accurate way to share your ADS-B and MLAT data with Plane Finder. It comes with a beautiful user interface that helps you explore and interact with your data in realtime.\n\n https://planefinder.net/sharing/client\n\nContinue setup by installing the Plane Finder ADS-B Client?" 13 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Plane Finder ADS-B Client Setup" --yesno "The Plane Finder ADS-B Client is an easy and accurate way to share your ADS-B and MLAT data with Plane Finder. It comes with a beautiful user interface that helps you explore and interact with your data in realtime.\n\n https://planefinder.net/sharing/client\n\nContinue setup by installing the Plane Finder ADS-B Client?" 13 78
CONTINUESETUP=$?
if [ "$CONTINUESETUP" = 1 ]; then
if [[ "${CONTINUESETUP}" = 1 ]] ; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
@ -62,7 +62,7 @@ if [ "$CONTINUESETUP" = 1 ]; then
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Plane Finder ADS-B Client setup halted.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
@ -72,8 +72,8 @@ fi
echo -e "\e[95m Installing packages needed to build and fulfill dependencies...\e[97m"
echo -e ""
if [[ `uname -m` = "x86_64" ]]; then
if [ $(dpkg --print-foreign-architectures $1 2>/dev/null | grep -c "i386") -eq 0 ]; then
if [[ `uname -m` = "x86_64" ]] ; then
if [[ $(dpkg --print-foreign-architectures $1 2>/dev/null | grep -c "i386") -eq 0 ]] ; then
echo -e "\e[94m Adding the i386 architecture...\e[97m"
sudo dpkg --add-architecture i386
echo -e "\e[94m Downloading latest package lists for enabled repositories and PPAs...\e[97m"
@ -93,19 +93,19 @@ echo -e ""
echo -e "\e[95m Downloading the Plane Finder ADS-B Client package...\e[97m"
echo -e ""
# Create the planefinder build directory if it does not exist.
if [ ! -d $PLANEFINDERBUILDDIRECTORY ]; then
if [[ ! -d "${PLANEFINDERBUILDDIRECTORY}" ]] ; then
echo -e "\e[94m Creating the Plane Finder ADS-B Client build directory...\e[97m"
mkdir $PLANEFINDERBUILDDIRECTORY
mkdir ${PLANEFINDERBUILDDIRECTORY}
fi
# Download the appropriate package depending on the devices architecture.
if [[ `uname -m` = "armv7l" ]] || [[ `uname -m` = "armv6l" ]]; then
echo -e "\e[94m Downloading the Plane Finder ADS-B Client v$PFCLIENTVERSIONARM for ARM devices...\e[97m"
if [[ `uname -m` = "armv7l" ]] || [[ `uname -m` = "armv6l" ]] ; then
echo -e "\e[94m Downloading the Plane Finder ADS-B Client v${PFCLIENTVERSIONARM} for ARM devices...\e[97m"
echo -e ""
wget http://client.planefinder.net/pfclient_${PFCLIENTVERSIONARM}_armhf.deb -O $PLANEFINDERBUILDDIRECTORY/pfclient_${PFCLIENTVERSIONARM}_armhf.deb
wget http://client.planefinder.net/pfclient_${PFCLIENTVERSIONARM}_armhf.deb -O ${PLANEFINDERBUILDDIRECTORY}/pfclient_${PFCLIENTVERSIONARM}_armhf.deb
else
echo -e "\e[94m Downloading the Plane Finder ADS-B Client v$PFCLIENTVERSIONI386 for I386 devices...\e[97m"
echo -e "\e[94m Downloading the Plane Finder ADS-B Client v${PFCLIENTVERSIONI386} for I386 devices...\e[97m"
echo -e ""
wget http://client.planefinder.net/pfclient_${PFCLIENTVERSIONI386}_i386.deb -O $PLANEFINDERBUILDDIRECTORY/pfclient_${PFCLIENTVERSIONI386}_i386.deb
wget http://client.planefinder.net/pfclient_${PFCLIENTVERSIONI386}_i386.deb -O ${PLANEFINDERBUILDDIRECTORY}/pfclient_${PFCLIENTVERSIONI386}_i386.deb
fi
## INSTALL THE PLANEFINDER ADS-B CLIENT PACKAGE
@ -113,28 +113,28 @@ fi
echo -e "\e[95m Installing the Plane Finder ADS-B Client package...\e[97m"
echo -e ""
echo -e "\e[94m Entering the Plane Finder ADS-B Client build directory...\e[97m"
cd $PLANEFINDERBUILDDIRECTORY
cd ${PLANEFINDERBUILDDIRECTORY}
# Install the proper package depending on the devices architecture.
if [[ `uname -m` = "armv7l" ]] || [[ `uname -m` = "armv6l" ]] || [[ `uname -m` = "aarch64" ]]; then
echo -e "\e[94m Installing the Plane Finder ADS-B Client v$PFCLIENTVERSIONARM for ARM devices package...\e[97m"
if [[ `uname -m` = "armv7l" ]] || [[ `uname -m` = "armv6l" ]] || [[ `uname -m` = "aarch64" ]] ; then
echo -e "\e[94m Installing the Plane Finder ADS-B Client v${PFCLIENTVERSIONARM} for ARM devices package...\e[97m"
echo -e ""
sudo dpkg -i $PLANEFINDERBUILDDIRECTORY/pfclient_${PFCLIENTVERSIONARM}_armhf.deb
sudo dpkg -i ${PLANEFINDERBUILDDIRECTORY}/pfclient_${PFCLIENTVERSIONARM}_armhf.deb
else
echo -e "\e[94m Installing the Plane Finder ADS-B Client v$PFCLIENTVERSIONI386 for I386 devices package...\e[97m"
if [[ `lsb_release -si` = "Debian" ]]; then
echo -e "\e[94m Installing the Plane Finder ADS-B Client v${PFCLIENTVERSIONI386} for I386 devices package...\e[97m"
if [[ `lsb_release -si` = "Debian" ]] ; then
# Force architecture if this is Debian.
echo -e "\e[94m NOTE: dpkg executed with added flag --force-architecture.\e[97m"
echo -e ""
sudo dpkg -i --force-architecture $PLANEFINDERBUILDDIRECTORY/pfclient_${PFCLIENTVERSIONI386}_i386.deb
sudo dpkg -i --force-architecture ${PLANEFINDERBUILDDIRECTORY}/pfclient_${PFCLIENTVERSIONI386}_i386.deb
else
echo -e ""
sudo dpkg -i $PLANEFINDERBUILDDIRECTORY/pfclient_${PFCLIENTVERSIONI386}_i386.deb
sudo dpkg -i ${PLANEFINDERBUILDDIRECTORY}/pfclient_${PFCLIENTVERSIONI386}_i386.deb
fi
fi
# Check that the Plane Finder ADS-B Client package was installed successfully.
echo -e ""
echo -e "\e[94m Checking that the pfclient package was installed properly...\e[97m"
if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# If the pfclient package could not be installed halt setup.
echo -e ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
@ -146,7 +146,7 @@ if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Plane Finder ADS-B Client setup halted.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
@ -154,7 +154,7 @@ fi
## DISPLAY FINAL SETUP INSTRUCTIONS WHICH CONNOT BE HANDLED BY THIS SCRIPT
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Plane Finder ADS-B Client Setup Instructions" --msgbox "At this point the Plane Finder ADS-B Client should be installed and running howeverThis script is only capable of installing the Plane Finder ADS-B Client. There are stilla few steps left which you must manually do through the Plane Finder ADS-B Client itself.\n\nVisit the following URL: http://${DEVICEIPADDRESS}:30053\n\nThe follow the instructions supplied by the Plane Finder ADS-B Client.\n\nUse the following settings when asked for them.\n\nData Format: Beast\nTcp Address: 127.0.0.1\nTcp Port: 30005" 20 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Plane Finder ADS-B Client Setup Instructions" --msgbox "At this point the Plane Finder ADS-B Client should be installed and running howeverThis script is only capable of installing the Plane Finder ADS-B Client. There are stilla few steps left which you must manually do through the Plane Finder ADS-B Client itself.\n\nVisit the following URL: http://${DEVICEIPADDRESS}:30053\n\nThe follow the instructions supplied by the Plane Finder ADS-B Client.\n\nUse the following settings when asked for them.\n\nData Format: Beast\nTcp Address: 127.0.0.1\nTcp Port: 30005" 20 78
### SETUP COMPLETE
@ -166,7 +166,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Plane Finder ADS-B Client setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -39,29 +39,29 @@ function CheckPackage {
MAXATTEMPTS=5
WAITTIME=5
while (( $ATTEMPT -le `(($MAXATTEMPTS + 1))` )); do
while (( ${ATTEMPT} -le `(($MAXATTEMPTS + 1))` )); do
# If the maximum attempts has been reached...
if [ $ATTEMPT -gt $MAXATTEMPTS ]; then
if [[ "${ATTEMPT}" -gt "${MAXATTEMPTS}" ]] ; then
echo -e ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " UNABLE TO INSTALL A REQUIRED PACKAGE."
echo -e " SETUP HAS BEEN TERMINATED!"
echo -e ""
echo -e "\e[93mThe package \"$1\" could not be installed in $MAXATTEMPTS attempts.\e[39m"
echo -e "\e[93mThe package \"$1\" could not be installed in ${MAXATTEMPTS} attempts.\e[39m"
echo -e ""
exit 1
fi
# Check if the package is already installed.
printf "\e[94m Checking if the package $1 is installed..."
if [ $(dpkg-query -W -f='${STATUS}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# If this is not the first attempt at installing this package...
if [ $ATTEMPT -gt 1 ]; then
if [[ ${ATTEMPT} -gt 1 ]] ; then
echo -e "\e[91m \e[5m[INSTALLATION ATTEMPT FAILED]\e[25m"
echo -e "\e[94m Attempting to Install the package $1 again in $WAITTIME seconds (ATTEMPT $ATTEMPT OF $MAXATTEMPTS)..."
sleep $WAITTIME
echo -e "\e[94m Attempting to Install the package $1 again in ${WAITTIME} seconds (ATTEMPT ${ATTEMPT} OF ${MAXATTEMPTS})..."
sleep ${WAITTIME}
else
echo -e "\e[91m [NOT INSTALLED]"
echo -e "\e[94m Installing the package $1..."

Wyświetl plik

@ -33,27 +33,27 @@
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
PROJECTROOTDIRECTORY="${PWD}"
BASHDIRECTORY="${PROJECTROOTDIRECTORY}/bash"
## INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
source ${BASHDIRECTORY}/variables.sh
source ${BASHDIRECTORY}/functions.sh
# Assign the Lighthttpd document root directory to a variable.
RAWDOCUMENTROOT=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root`
DOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< $RAWDOCUMENTROOT`
DOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< ${RAWDOCUMENTROOT}`
## WELCOME MESSAGE
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Project Image Setup" --msgbox "Thank you for choosing to use the ADS-B Receiver Project image.\n\nDuring this setup process the preinstalled dump1090-mutability installation will be configured and the ADS-B Project Web Portal will be installed. If you would like to add additional features to your receiver simply execute ./install.sh again after this initial setup process has been completed." 13 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "ADS-B Receiver Project Image Setup" --msgbox "Thank you for choosing to use the ADS-B Receiver Project image.\n\nDuring this setup process the preinstalled dump1090-mutability installation will be configured and the ADS-B Project Web Portal will be installed. If you would like to add additional features to your receiver simply execute ./install.sh again after this initial setup process has been completed." 13 78
## ASK TO UPDATE THE OPERATING SYSTEM
if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Project Image Setup" --yesno "The image comes with the latest updates to Raspbian as of it's release. However updates may have been released for the operating system since the image was released. This being said it is highly recommended you allow the script to check for additional updates now in order to ensure you are in fact running the latest software available.\n\nWould you like the script to check for and install updates now?" 13 78) then
if (whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "ADS-B Receiver Project Image Setup" --yesno "The image comes with the latest updates to Raspbian as of it's release. However updates may have been released for the operating system since the image was released. This being said it is highly recommended you allow the script to check for additional updates now in order to ensure you are in fact running the latest software available.\n\nWould you like the script to check for and install updates now?" 13 78) then
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo -e "\n\e[91m ${ADSB_PROJECTTITLE}"
echo -e ""
echo -e "\e[92m Downloading and installing the latest updates for your operating system..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[97m"
@ -64,7 +64,7 @@ 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 [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
fi
@ -72,7 +72,7 @@ fi
## CONFIGURE DUMP1090
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo -e "\n\e[91m ${ADSB_PROJECTTITLE}"
echo -e ""
echo -e "\e[92m Configure dump1090..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
@ -80,26 +80,26 @@ 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
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
# Set the receivers latitude and longitude.
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
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)
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_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)
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_TITLE="Receiver Longitude (REQUIRED)"
done
echo -e "\e[94m Setting the receiver's latitude to $RECEIVERLATITUDE...\e[97m"
ChangeConfig "LAT" $RECEIVERLATITUDE "/etc/default/dump1090-mutability"
echo -e "\e[94m Setting the receiver's longitude to $RECEIVERLONGITUDE...\e[97m"
ChangeConfig "LON" $RECEIVERLONGITUDE "/etc/default/dump1090-mutability"
echo -e "\e[94m Setting the receiver's latitude to ${RECEIVERLATITUDE}...\e[97m"
ChangeConfig "LAT" ${RECEIVERLATITUDE} "/etc/default/dump1090-mutability"
echo -e "\e[94m Setting the receiver's longitude to ${RECEIVERLONGITUDE}...\e[97m"
ChangeConfig "LON" ${RECEIVERLONGITUDE} "/etc/default/dump1090-mutability"
# Ask if dump1090-mutability should bind on all IP addresses.
if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Bind Dump1090-mutability To All IP Addresses" --defaultno --yesno "By default dump1090-mutability is bound only to the local loopback IP address(s) for security reasons. However some people wish to make dump1090-mutability's data accessable externally by other devices. To allow this dump1090-mutability can be configured to listen on all IP addresses bound to this device. It is recommended that unless you plan to access this device from an external source that dump1090-mutability remain bound only to the local loopback IP address(s).\n\nWould you like dump1090-mutability to listen on all IP addesses?" 15 78) then
if (whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Bind Dump1090-mutability To All IP Addresses" --defaultno --yesno "By default dump1090-mutability is bound only to the local loopback IP address(s) for security reasons. However some people wish to make dump1090-mutability's data accessable externally by other devices. To allow this dump1090-mutability can be configured to listen on all IP addresses bound to this device. It is recommended that unless you plan to access this device from an external source that dump1090-mutability remain bound only to the local loopback IP address(s).\n\nWould you like dump1090-mutability to listen on all IP addesses?" 15 78) then
echo -e "\e[94m Binding dump1090-mutability to all available IP addresses...\e[97m"
CommentConfig "NET_BIND_ADDRESS" "/etc/default/dump1090-mutability"
else
@ -114,31 +114,31 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
fi
# 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 "Heywhatsthat.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 heywhatsthat.com maximum range rings to your map?" 16 78); then
if [[ ! -f "/usr/share/dump1090-mutability/html/upintheair.json" ]] || [[ ! -f "/usr/share/dump1090-fa/html/upintheair.json" ]] ; then
if (whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Heywhatsthat.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 heywhatsthat.com maximum range rings to your map?" 16 78); then
HEYWHATSTHATID_TITLE="Heywhatsthat.com Panarama ID"
while [[ -z $HEYWHATSTHATID ]]; do
HEYWHATSTHATID=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$HEYWHATSTHATID_TITLE" --nocancel --inputbox "\nEnter your Heywhatsthat.com panarama ID." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${HEYWHATSTHATID}" ]] ; do
HEYWHATSTHATID=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${HEYWHATSTHATID_TITLE}" --nocancel --inputbox "\nEnter your Heywhatsthat.com panarama ID." 8 78 3>&1 1>&2 2>&3)
HEYWHATSTHATID_TITLE="Heywhatsthat.com Panarama ID (REQUIRED)"
done
HEYWHATSTHATRINGONE_TITLE="Heywhatsthat.com First Ring Altitude"
while [[ -z $HEYWHATSTHATRINGONE ]]; do
HEYWHATSTHATRINGONE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$HEYWHATSTHATRINGONE_TITLE" --nocancel --inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
while [[ -z "${HEYWHATSTHATRINGONE}" ]] ; do
HEYWHATSTHATRINGONE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${HEYWHATSTHATRINGONE_TITLE}" --nocancel --inputbox "\nEnter the first ring's altitude in meters.\n(default 3048 meters or 10000 feet)" 8 78 "3048" 3>&1 1>&2 2>&3)
HEYWHATSTHATRINGONE_TITLE="Heywhatsthat.com First Ring Altitude (REQUIRED)"
done
HEYWHATSTHATRINGTWO_TITLE="Heywhatsthat.com Second Ring Altitude"
while [[ -z $HEYWHATSTHATRINGTWO ]]; do
HEYWHATSTHATRINGTWO=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$HEYWHATSTHATRINGTWO_TITLE" --nocancel --inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
while [[ -z "${HEYWHATSTHATRINGTWO}" ]] ; do
HEYWHATSTHATRINGTWO=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${HEYWHATSTHATRINGTWO_TITLE}" --nocancel --inputbox "\nEnter the second ring's altitude in meters.\n(default 12192 meters or 40000 feet)" 8 78 "12192" 3>&1 1>&2 2>&3)
HEYWHATSTHATRINGTWO_TITLE="Heywhatsthat.com Second Ring Altitude (REQUIRED)"
done
echo -e "\e[94m Downloading JSON data pertaining to the supplied panorama ID...\e[97m"
echo -e ""
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
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
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"
sudo wget -O ${HTMLPATH} "http://www.heywhatsthat.com/api/upintheair.json?id=${HEYWHATSTHATID}&refraction=0.25&alts=${HEYWHATSTHATRINGONE},${HEYWHATSTHATRINGTWO}"
fi
fi
@ -147,57 +147,57 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Dump1090 configuration complete.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
# CONFIGURE PIAWARE IF NEEDED
if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
if [[ $(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 "\n\e[91m ${ADSB_PROJECTTITLE}"
echo -e ""
echo -e "\e[92m Configure PiAware..."
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 the page 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
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
# If the user supplied their FlightAware login continue with the device claiming process.
FLIGHTAWAREPASSWORD1_TITLE="Your FlightAware Password"
while [[ -z $FLIGHTAWAREPASSWORD1 ]]; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD1_TITLE" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD1}" ]] ; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD1_TITLE}" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
FLIGHTAWAREPASSWORD2_TITLE="Confirm Your FlightAware Password"
while [[ -z $FLIGHTAWAREPASSWORD2 ]]; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD2_TITLE" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD2}" ]] ; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD2_TITLE}" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
while [ ! $FLIGHTAWAREPASSWORD1 = $FLIGHTAWAREPASSWORD2 ]; do
while [[ ! "${FLIGHTAWAREPASSWORD1}" = "${FLIGHTAWAREPASSWORD2}" ]] ; do
FLIGHTAWAREPASSWORD1=""
FLIGHTAWAREPASSWORD2=""
# Display an error message if the passwords did not match.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Claim Your PiAware Device" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Claim Your PiAware Device" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
FLIGHTAWAREPASSWORD1_TITLE="Your FlightAware Password (REQUIRED)"
while [[ -z $FLIGHTAWAREPASSWORD1 ]]; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD1_TITLE" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD1}" ]] ; do
FLIGHTAWAREPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD1_TITLE}" --nocancel --passwordbox "\nEnter your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
FLIGHTAWAREPASSWORD2_TITLE="Confirm Your FlightAware Password (REQUIRED)"
while [[ -z $FLIGHTAWAREPASSWORD2 ]]; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$FLIGHTAWAREPASSWORD2_TITLE" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${FLIGHTAWAREPASSWORD2}" ]] ; do
FLIGHTAWAREPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${FLIGHTAWAREPASSWORD2_TITLE}" --nocancel --passwordbox "\nConfirm your FlightAware password." 8 78 3>&1 1>&2 2>&3)
done
done
# Set the supplied user name and password in the configuration.
echo -e "\e[94m Setting the flightaware-user setting using piaware-config...\e[97m"
echo -e ""
sudo piaware-config flightaware-user $FLIGHTAWARELOGIN
sudo piaware-config flightaware-user ${FLIGHTAWARELOGIN}
echo -e ""
echo -e "\e[94m Setting the flightaware-password setting using piaware-config...\e[97m"
echo -e ""
sudo piaware-config flightaware-password $FLIGHTAWAREPASSWORD1
sudo piaware-config flightaware-password ${FLIGHTAWAREPASSWORD1}
echo -e ""
echo -e "\e[94m Restarting PiAware to ensure changes take effect...\e[97m"
echo -e ""
@ -205,7 +205,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 the following URL.\n\nhttp://flightaware.com/adsb/piaware/claim." 10 78
fi
# PiAware configuration is now complete.
@ -213,16 +213,16 @@ 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 [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
fi
## SETUP THE ADS-B RECEIVER PROJECT WEB PORTAL
chmod +x $BASHDIRECTORY/portal/install.sh
$BASHDIRECTORY/portal/install.sh
if [ $? -ne 0 ]; then
chmod +x ${BASHDIRECTORY}/portal/install.sh
${BASHDIRECTORY}/portal/install.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
@ -231,6 +231,6 @@ fi
# remove the "image" file.
rm -f image
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 https://www.adsbreceiver.net\n\nRemember to install additional features simply run ./install.sh again." 12 78
exit 0

Wyświetl plik

@ -33,11 +33,11 @@
## CHECK IF THIS IS THE FIRST RUN USING THE IMAGE RELEASE
if [ -f $RECEIVER_ROOT_DIRECTORY/image ]; then
if [[ -f "${RECEIVER_ROOT_DIRECTORY}/image" ]] ; then
# Execute image setup script.
chmod +x $RECEIVER_BASH_DIRECTORY/image.sh
$RECEIVER_BASH_DIRECTORY/image.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/image.sh
${RECEIVER_BASH_DIRECTORY}/image.sh
if [[ $? -ne 0 ]] ; then
echo -e ""
echo -e " \e[91m IMAGE SETUP HAS BEEN TERMINISTED.\e[39m"
echo -e ""
@ -48,7 +48,7 @@ fi
## INCLUDE EXTERNAL SCRIPTS
source $RECEIVER_BASH_DIRECTORY/functions.sh
source ${RECEIVER_BASH_DIRECTORY}/functions.sh
## SET VARIABLES
@ -59,7 +59,7 @@ TITLE="\e[1mThe ADS-B Receiver Project Preliminary Setup Process\e[0m"
# Update repository package lists.
function AptUpdate() {
clear
echo -e "\n\e[91m $TITLE"
echo -e "\n\e[91m ${TITLE}"
echo -e ""
echo -e "\e[92m Downloading the latest package lists for all enabled repositories and PPAs..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[97m"
@ -68,7 +68,7 @@ function AptUpdate() {
echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Finished downloading and updating package lists.\e[39m"
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
echo -e ""
read -p "Press enter to continue..." CONTINUE
fi
@ -76,9 +76,9 @@ function AptUpdate() {
# Check that the packages required by these scripts are installed.
function CheckPrerequisites() {
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
clear
echo -e "\n\e[91m $TITLE"
echo -e "\n\e[91m ${TITLE}"
fi
echo -e ""
echo -e "\e[92m Checking to make sure the whiptail and git packages are installed..."
@ -89,7 +89,7 @@ function CheckPrerequisites() {
echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m The whiptail and git packages are installed.\e[39m"
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
echo -e ""
read -p "Press enter to continue..." CONTINUE
fi
@ -100,56 +100,56 @@ function UpdateRepository() {
# Update lcoal branches which are set to track remote.
ACTION=$(git remote update 2>&1)
# Check if local branch is behind remote.
if [[ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]] && [[ `git status | grep -c "untracked files present"` -gt 0 ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] && [[ `git status | grep -c "untracked files present"` -gt 0 ]] ; then
# Local branch has untracked files.
clear
# Ask if the user wishes to save any changes made to any core files before resetting them.
whiptail --backtitle "$TITLE" --title "Backup Current $RECEIVER_PROJECT_BRANCH Branch State" --defaultno --yesno "This script will now reset your local copy of the $RECEIVER_PROJECT_BRANCH branch. Once this has been done any changes to the files making up this project will be replaced by untouched files from the project's repository.\n\nIf you would like to retain a copy of your current branch's state this script can do so now by migrating it to a new branch.\n\nCreate a new branch containing this branch's current state?" 14 78
whiptail --backtitle "${TITLE}" --title "Backup Current ${RECEIVER_PROJECT_BRANCH} Branch State" --defaultno --yesno "This script will now reset your local copy of the ${RECEIVER_PROJECT_BRANCH} branch. Once this has been done any changes to the files making up this project will be replaced by untouched files from the project's repository.\n\nIf you would like to retain a copy of your current branch's state this script can do so now by migrating it to a new branch.\n\nCreate a new branch containing this branch's current state?" 14 78
case $? in
0) BACKUP_BRANCH_STATE="true" ;;
1) BACKUP_BRANCH_STATE="false" ;;
esac
if [ $BACKUP_BRANCH_STATE = "true" ]; then
if [[ "${BACKUP_BRANCH_STATE}" = "true" ]] ; then
# If the user wishes to create a new branch containing the current branches state ask for a name for this new branch.
BACKUP_BRANCH_NAME_TITLE="Name Of Backup Branch"
while [[ -z $BACKUP_BRANCH_NAME ]]; do
BACKUP_BRANCH_NAME=$(whiptail --backtitle "$TITLE" --title "$BACKUP_BRANCH_NAME_TITLE" --nocancel --inputbox "\nPlease enter a name for this new branch." 10 78 3>&1 1>&2 2>&3)
while [[ -z "${BACKUP_BRANCH_NAME}" ]] ; do
BACKUP_BRANCH_NAME=$(whiptail --backtitle "${TITLE}" --title "${BACKUP_BRANCH_NAME_TITLE}" --nocancel --inputbox "\nPlease enter a name for this new branch." 10 78 3>&1 1>&2 2>&3)
BACKUP_BRANCH_NAME_TITLE="Name Of Backup Branch (REQUIRED)"
done
fi
fi
echo -e "\n\e[91m $TITLE"
echo -e "\n\e[91m ${TITLE}"
echo -e ""
echo -e "\e[92m Pulling the latest version of the ADS-B Receiver Project repository..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[97m"
echo -e ""
echo -e "\e[94m Switching to branch $RECEIVER_PROJECT_BRANCH...\e[97m"
echo -e "\e[94m Switching to branch ${RECEIVER_PROJECT_BRANCH}...\e[97m"
echo -e ""
git checkout $RECEIVER_PROJECT_BRANCH
git checkout ${RECEIVER_PROJECT_BRANCH}
echo -e ""
# Save the current branch state if the user wished to do so.
if [ "$BACKUP_BRANCH_STATE" = "true" ]; then
echo -e "\e[94m Creating a new branch named $NEW_BRANCH_NAME containing the current state of the $RECEIVER_PROJECT_BRANCH branch...\e[97m"
if [[ "${BACKUP_BRANCH_STATE}" = "true" ]] ; then
echo -e "\e[94m Creating a new branch named ${NEW_BRANCH_NAME} containing the current state of the ${RECEIVER_PROJECT_BRANCH} branch...\e[97m"
echo -e ""
git commit -a -m "Saving current branch state."
git branch $BACKUP_BRANCH_NAME
git branch ${BACKUP_BRANCH_NAME}
echo -e ""
fi
echo -e "\e[94m Fetching branch $RECEIVER_PROJECT_BRANCH from origin...\e[97m"
echo -e "\e[94m Fetching branch ${RECEIVER_PROJECT_BRANCH} from origin...\e[97m"
echo -e ""
git fetch origin
echo -e ""
echo -e "\e[94m Performing hard reset of branch $RECEIVER_PROJECT_BRANCH so it matches origin/$RECEIVER_PROJECT_BRANCH...\e[97m"
echo -e "\e[94m Performing hard reset of branch ${RECEIVER_PROJECT_BRANCH} so it matches origin/${RECEIVER_PROJECT_BRANCH}...\e[97m"
echo -e ""
git reset --hard origin/$RECEIVER_PROJECT_BRANCH
git reset --hard origin/${RECEIVER_PROJECT_BRANCH}
echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Finished pulling the latest version of the ADS-B Receiver Project repository....\e[39m"
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
echo -e ""
read -p "Press enter to continue..." CONTINUE
fi
@ -157,9 +157,9 @@ function UpdateRepository() {
# Update the operating system.
function UpdateOperatingSystem() {
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
clear
echo -e "\n\e[91m $TITLE"
echo -e "\n\e[91m ${TITLE}"
fi
echo -e ""
echo -e "\e[92m Downloading and installing the latest updates for your operating system..."
@ -169,7 +169,7 @@ function UpdateOperatingSystem() {
echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Your operating system should now be up to date.\e[39m"
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
echo -e ""
read -p "Press enter to continue..." CONTINUE
fi
@ -177,7 +177,7 @@ function UpdateOperatingSystem() {
## Update the repository packages and check that prerequisite packages are installed.
# Only call AptUpdate if last update was more than $APT_UPDATE_THRESHOLD seconds ago.
# Only call AptUpdate if last update was more than ${APT_UPDATE_THRESHOLD} seconds ago.
APT_UPDATE_THRESHOLD="1800"
APT_UPDATE_CURRENT_EPOCH=`date +%s`
APT_UPDATE_LAST_EPOCH=`stat -c %Y /var/cache/apt/pkgcache.bin`
@ -190,10 +190,10 @@ CheckPrerequisites
## DISPLAY WELCOME SCREEN
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "The ADS-B Receiver Project" --title "The ADS-B Receiver Project" --yesno "Thanks for choosing The ADS-B Receiver Project to setup your receiver.\n\nMore information on this project as well as news, support, and discussions can be found on the projects official website located at:\n\n https://www.adsbreceiver.net\n\nWould you like to continue setup?" 14 78
CONTINUE_SETUP=$?
if [ "$CONTINUE_SETUP" = 1 ]; then
if [[ "${CONTINUE_SETUP}" = 1 ]] ; then
# Setup has been halted by the user.
echo -e ""
echo -e "\e[91m \e[5mSETUP HALTED!\e[25m"
@ -210,14 +210,14 @@ UpdateRepository
## ASK IF OPERATING SYSTEM SHOULD BE UPDATED
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$TITLE" --title "Operating System Updates" --yesno "It is recommended that you update your system before building and/or installing any ADS-B receiver related packages. This script can do this for you at this time if you like.\n\nWould you like to update your operating system now?" 11 78
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${TITLE}" --title "Operating System Updates" --yesno "It is recommended that you update your system before building and/or installing any ADS-B receiver related packages. This script can do this for you at this time if you like.\n\nWould you like to update your operating system now?" 11 78
case $? in
0) UPDATE_OPERATING_SYSTEM="true" ;;
1) UPDATE_OPERATING_SYSTEM="false" ;;
esac
fi
if [ "$UPDATE_OPERATING_SYSTEM" = "true" ]; then
if [[ "${UPDATE_OPERATING_SYSTEM}" = "true" ]] ; then
UpdateOperatingSystem
fi
@ -229,9 +229,9 @@ fi
## EXECUTE BASH/MAIN.SH
chmod +x $RECEIVER_BASH_DIRECTORY/main.sh
$RECEIVER_BASH_DIRECTORY/main.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/main.sh
${RECEIVER_BASH_DIRECTORY}/main.sh
if [[ $? -ne 0 ]] ; then
echo -e " \e[91m ANY FURTHER SETUP AND/OR INSTALLATION REQUESTS HAVE BEEN TERMINIATED\e[39m"
echo -e ""
exit 1
@ -240,8 +240,8 @@ fi
## INSTALLATION COMPLETE
# Display the installation complete message box.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$TITLE" --title "Software Installation Complete" --msgbox "INSTALLATION COMPLETE\n\nDO NOT DELETE THIS DIRECTORY!\n\nFiles needed for certain items to run properly are contained within this directory. Deleting this directory may result in your receiver not working properly.\n\nHopefully, these scripts and files were found useful while setting up your ADS-B Receiver. Feedback regarding this software is always welcome. If you have any issues or wish to submit feedback, feel free to do so on GitHub.\n\nhttps://github.com/jprochazka/adsb-receiver" 20 65
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${TITLE}" --title "Software Installation Complete" --msgbox "INSTALLATION COMPLETE\n\nDO NOT DELETE THIS DIRECTORY!\n\nFiles needed for certain items to run properly are contained within this directory. Deleting this directory may result in your receiver not working properly.\n\nHopefully, these scripts and files were found useful while setting up your ADS-B Receiver. Feedback regarding this software is always welcome. If you have any issues or wish to submit feedback, feel free to do so on GitHub.\n\nhttps://github.com/jprochazka/adsb-receiver" 20 65
fi
echo -e "\e[32m"

Wyświetl plik

@ -33,16 +33,16 @@
## INCLUDE EXTERNAL SCRIPTS
source $RECEIVER_BASH_DIRECTORY/variables.sh
source $RECEIVER_BASH_DIRECTORY/functions.sh
source ${RECEIVER_BASH_DIRECTORY}/variables.sh
source ${RECEIVER_BASH_DIRECTORY}/functions.sh
# Source the automated install configuration file if this is an automated installation.
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "true" ]] && [[ -s "${RECEIVER_CONFIGURATION_FILE}" ]] ; then
source $RECEIVER_CONFIGURATION_FILE
source ${RECEIVER_CONFIGURATION_FILE}
fi
## Set the project title variable.
export RECEIVER_PROJECT_TITLE="The ADS-B Receiver Project v$PROJECTVERSION Installer"
export RECEIVER_PROJECT_TITLE="The ADS-B Receiver Project v${PROJECTVERSION} Installer"
###############
## FUNCTIONS
@ -51,36 +51,36 @@ export RECEIVER_PROJECT_TITLE="The ADS-B Receiver Project v$PROJECTVERSION Insta
# Execute the dump1090-mutability setup script.
function InstallDump1090Mutability() {
chmod +x $RECEIVER_BASH_DIRECTORY/decoders/dump1090-mutability.sh
$RECEIVER_BASH_DIRECTORY/decoders/dump1090-mutability.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/dump1090-mutability.sh
${RECEIVER_BASH_DIRECTORY}/decoders/dump1090-mutability.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the dump1090-fa setup script.
function InstallDump1090Fa() {
chmod +x $RECEIVER_BASH_DIRECTORY/decoders/dump1090-fa.sh
$RECEIVER_BASH_DIRECTORY/decoders/dump1090-fa.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/dump1090-fa.sh
${RECEIVER_BASH_DIRECTORY}/decoders/dump1090-fa.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the dump978 setup script.
function InstallDump978() {
chmod +x $RECEIVER_BASH_DIRECTORY/decoders/dump978.sh
$RECEIVER_BASH_DIRECTORY/decoders/dump978.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/dump978.sh
${RECEIVER_BASH_DIRECTORY}/decoders/dump978.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the RTL-SDR OGN setup script.
function InstallRtlsdrOgn() {
chmod +x $RECEIVER_BASH_DIRECTORY/decoders/rtlsdr-ogn.sh
$RECEIVER_BASH_DIRECTORY/decoders/rtlsdr-ogn.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/decoders/rtlsdr-ogn.sh
${RECEIVER_BASH_DIRECTORY}/decoders/rtlsdr-ogn.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
@ -89,36 +89,36 @@ function InstallRtlsdrOgn() {
# Execute the PiAware setup script
function InstallPiAware() {
chmod +x $RECEIVER_BASH_DIRECTORY/feeders/piaware.sh
$RECEIVER_BASH_DIRECTORY/feeders/piaware.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/piaware.sh
${RECEIVER_BASH_DIRECTORY}/feeders/piaware.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the Plane Finder ADS-B Client setup script.
function InstallPlaneFinder() {
chmod +x $RECEIVER_BASH_DIRECTORY/feeders/planefinder.sh
$RECEIVER_BASH_DIRECTORY/feeders/planefinder.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/planefinder.sh
${RECEIVER_BASH_DIRECTORY}/feeders/planefinder.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the Flightradar24 Feeder client setup script.
function InstallFlightradar24() {
chmod +x $RECEIVER_BASH_DIRECTORY/feeders/flightradar24.sh
$RECEIVER_BASH_DIRECTORY/feeders/flightradar24.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/flightradar24.sh
${RECEIVER_BASH_DIRECTORY}/feeders/flightradar24.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the ADS-B Exchange setup script.
function InstallAdsbExchange() {
chmod +x $RECEIVER_BASH_DIRECTORY/feeders/adsbexchange.sh
$RECEIVER_BASH_DIRECTORY/feeders/adsbexchange.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/feeders/adsbexchange.sh
${RECEIVER_BASH_DIRECTORY}/feeders/adsbexchange.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
@ -127,9 +127,9 @@ function InstallAdsbExchange() {
# Execute the ADS-B Receiver Project Web Portal setup script.
function InstallWebPortal() {
chmod +x $RECEIVER_BASH_DIRECTORY/portal/install.sh
$RECEIVER_BASH_DIRECTORY/portal/install.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/portal/install.sh
${RECEIVER_BASH_DIRECTORY}/portal/install.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
@ -138,27 +138,27 @@ function InstallWebPortal() {
# Execute the AboveTustin setup script.
function InstallAboveTustin() {
chmod +x $RECEIVER_BASH_DIRECTORY/extras/abovetustin.sh
$RECEIVER_BASH_DIRECTORY/extras/abovetustin.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/extras/abovetustin.sh
${RECEIVER_BASH_DIRECTORY}/extras/abovetustin.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the beast-splitter setup script.
function InstallBeastSplitter() {
chmod +x $RECEIVER_BASH_DIRECTORY/extras/beeastsplitter.sh
$RECEIVER_BASH_DIRECTORY/extras/beastsplitter.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/extras/beeastsplitter.sh
${RECEIVER_BASH_DIRECTORY}/extras/beastsplitter.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
# Execute the Duck DNS setup script.
function InstallDuckDns() {
chmod +x $RECEIVER_BASH_DIRECTORY/extras/duckdns.sh
$RECEIVER_BASH_DIRECTORY/extras/duckdns.sh
if [ $? -ne 0 ]; then
chmod +x ${RECEIVER_BASH_DIRECTORY}/extras/duckdns.sh
${RECEIVER_BASH_DIRECTORY}/extras/duckdns.sh
if [[ $? -ne 0 ]] ; then
exit 1
fi
}
@ -169,13 +169,13 @@ function InstallDuckDns() {
## Decoders
# Check if the dump1090-mutability package is installed.
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
DUMP1090_FORK="mutability"
DUMP1090_INSTALLED="true"
# Skip over this dialog if this installation is set to be automated.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask if dump1090-mutability should be reinstalled.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump1090-mutability Installed" --defaultno --yesno "The dump1090-mutability package appears to be installed on your device, however...\n\nThe dump1090-mutability v1.15~dev source code is regularly updated without a change made to the version numbering. To ensure you are running the latest version of dump1090-mutability you may opt to rebuild and reinstall this package.\n\nDownload, build, and reinstall this package?" 16 65
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump1090-mutability Installed" --defaultno --yesno "The dump1090-mutability package appears to be installed on your device, however...\n\nThe dump1090-mutability v1.15~dev source code is regularly updated without a change made to the version numbering. To ensure you are running the latest version of dump1090-mutability you may opt to rebuild and reinstall this package.\n\nDownload, build, and reinstall this package?" 16 65
case $? in
0)
DUMP1090_DO_UPGRADE="true"
@ -186,7 +186,7 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
esac
else
# Refer to the installation configuration to decide if dump1090-mutability is to be reinstalled or not.
if [ "$DUMP1090_UPGRADE" = "true" ]; then
if [[ "${DUMP1090_UPGRADE}" = "true" ]] ; then
DUMP1090_DO_UPGRADE="true"
else
DUMP1090_DO_UPGRADE="false"
@ -195,12 +195,12 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
fi
# Check if the dump1090-fa package is installed.
if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
DUMP1090_FORK="fa"
DUMP1090_INSTALLED="true"
# Check if a newer version can be installed.
if [ $(sudo dpkg -s dump1090-fa 2>/dev/null | grep -c "Version: $PIAWARE_VERSION") -eq 0 ]; then
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ $(sudo dpkg -s dump1090-fa 2>/dev/null | grep -c "Version: ${PIAWARE_VERSION}") -eq 0 ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "RECEIVER_PROJECT_TITLE" --title "Dump1090-fa Upgrade Available" --defaultno --yesno "An updated version of dump1090-fa is available.\n\nWould you like to download, build, then install the new version?" 16 65
case $? in
0)
@ -212,7 +212,7 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok instal
esac
else
# If a newer version of dump1090-fa is available refer to the installation configuration to decide if it should be upgraded or not.
if [ "$DUMP1090_UPGRADE" = "true" ]; then
if [[ "${DUMP1090_UPGRADE}" = "true" ]] ; then
DUMP1090_DO_UPGRADE="true"
else
DUMP1090_DO_UPGRADE="false"
@ -222,10 +222,10 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok instal
fi
# If no dump1090 fork is installed then attempt to install one.
if [[ ! "$DUMP1090_INSTALLED" = "true" ]] ; then
if [[ ! "${DUMP1090_INSTALLED}" = "true" ]] ; then
# If this is not an automated installation ask the user which one to install.
if [[ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]] ; then
DUMP1090_OPTION=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Choose Dump1090 Version To Install" --radiolist "The dump1090-mutability or dump1090-fa package does not appear to be installed on this device. In order to continue setup one of the following packages need to be installed. Please select your prefered dump1090 version from the list below.\n\nPlease note that in order to run dump1090-fa PiAware will need to be installed as well." 16 65 2 "dump1090-mutability" "(Mutability)" ON "dump1090-fa" "(FlightAware)" OFF 3>&1 1>&2 2>&3)
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
DUMP1090_OPTION=$(whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Choose Dump1090 Version To Install" --radiolist "The dump1090-mutability or dump1090-fa package does not appear to be installed on this device. In order to continue setup one of the following packages need to be installed. Please select your prefered dump1090 version from the list below.\n\nPlease note that in order to run dump1090-fa PiAware will need to be installed as well." 16 65 2 "dump1090-mutability" "(Mutability)" ON "dump1090-fa" "(FlightAware)" OFF 3>&1 1>&2 2>&3)
case ${DUMP1090_OPTION} in
"dump1090-mutability")
DUMP1090_FORK="mutability"
@ -250,15 +250,15 @@ if [[ ! "$DUMP1090_INSTALLED" = "true" ]] ; then
fi
# If the FlightAware fork of dump1090 is or has been chosen to be installed PiAware must be installed.
if [ "$DUMP1090_FORK" = "fa" ] && [ "$DUMP1090_DO_UPGRADE" = "true" ] || [ "$DUMP1090_INSTALLED" = "false" ]; then
if [[ "${DUMP1090_FORK}" = "fa" ]] && [[ "${DUMP1090_DO_UPGRADE}" = "true" ]] || [[ "${DUMP1090_INSTALLED}" = "false" ]] ; then
FORCE_PIAWARE_INSTALL="true"
fi
# Check if the dump978 binaries exist.
if [ -f $RECEIVER_BUILD_DIRECTORY/dump978/dump978 ] && [ -f $RECEIVER_BUILD_DIRECTORY/dump978/uat2text ] && [ -f $RECEIVER_BUILD_DIRECTORY/dump978/uat2esnt ] && [ -f $RECEIVER_BUILD_DIRECTORY/dump978/uat2json ]; then
if [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/dump978" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2text" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2esnt" ]] && [[ -f "${RECEIVER_BUILD_DIRECTORY}/dump978/uat2json" ]] ; then
# Dump978 appears to have been built already.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump978 Installed" --defaultno --yesno "Dump978 appears to be installed on your device, however...\n\nThe dump978 source code may have been updated since it was built last. To ensure you are running the latest version of dump978 you may opt to rebuild the binaries making up dump978.\n\nDownload and rebuild the dump978 binaries?" 14 65
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 Installed" --defaultno --yesno "Dump978 appears to be installed on your device, however...\n\nThe dump978 source code may have been updated since it was built last. To ensure you are running the latest version of dump978 you may opt to rebuild the binaries making up dump978.\n\nDownload and rebuild the dump978 binaries?" 14 65
case $? in
0)
DUMP978_DO_UPGRADE="true"
@ -269,7 +269,7 @@ if [ -f $RECEIVER_BUILD_DIRECTORY/dump978/dump978 ] && [ -f $RECEIVER_BUILD_DIRE
esac
else
# Refer to the installation configuration to decide if dump978 is to be rebuilt from source or not.
if [ "$DUMP1090_UPGRADE" = "true" ]; then
if [[ "${DUMP1090_UPGRADE}" = "true" ]] ; then
DUMP978_DO_UPGRADE="true"
else
DUMP978_DO_UPGRADE="false"
@ -277,8 +277,8 @@ if [ -f $RECEIVER_BUILD_DIRECTORY/dump978/dump978 ] && [ -f $RECEIVER_BUILD_DIRE
fi
else
# Dump978 does not appear to be present on this device.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Dump978 Not Installed" --defaultno --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals. These scripts can setup dump978 for you. However keep in mind a second RTL-SDR device will be required to feed data to it.\n\nDo you wish to install dump978?" 10 65
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Dump978 Not Installed" --defaultno --yesno "Dump978 is an experimental demodulator/decoder for 978MHz UAT signals. These scripts can setup dump978 for you. However keep in mind a second RTL-SDR device will be required to feed data to it.\n\nDo you wish to install dump978?" 10 65
case $? in
0)
DUMP978_INSTALL="true"
@ -291,12 +291,12 @@ else
fi
# Check if the RTL-SDR OGN binaries exist on this device.
if [ -f /etc/init.d/rtlsdr-ogn ]; then
if [[ -f "/etc/init.d/rtlsdr-ogn" ]] ; then
# The RTL-SDR OGN binaries exist on this device.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Check if a newer version of the binaries are available.
if [ ! -d $RECEIVER_BUILD_DIRECTORY/rtlsdr-ogn/rtlsdr-ogn-$RTLSDROGN_VERSION ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "RTL-SDR OGN Installed" --defaultno --yesno "A newer version of the RTL-SDR OGN binaries is available.\n\nWould you like to setup the newer binaries on this device?" 14 65
if [[ ! -d "${RECEIVER_BUILD_DIRECTORY}/rtlsdr-ogn/rtlsdr-ogn-${RTLSDROGN_VERSION}" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR OGN Installed" --defaultno --yesno "A newer version of the RTL-SDR OGN binaries is available.\n\nWould you like to setup the newer binaries on this device?" 14 65
case $? in
0)
RTLSDROGN_DO_UPGRADE="true"
@ -307,7 +307,7 @@ if [ -f /etc/init.d/rtlsdr-ogn ]; then
esac
else
# Refer to the installation configuration to decide if RTL-SDR OGN is to be rebuilt from source or not.
if [ "$RTLSDROGN_UPGRADE" = "true" ]; then
if [[ "${RTLSDROGN_UPGRADE}" = "true" ]] ; then
RTLSDROGN_DO_UPGRADE="true"
else
RTLSDROGN_DO_UPGRADE="false"
@ -316,8 +316,8 @@ if [ -f /etc/init.d/rtlsdr-ogn ]; then
fi
else
# The RTL-SDR OGN binaries do not appear to exist on this device.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "RTL-SDR OGN Not Installed" --defaultno --yesno "The goal the OGN project is to create a unified platform for tracking aircraft equipped with FLARM (or FLARM-compatible) emitters and OGN trackers.\n\nRTL-SDR OGN will require an additional RTL-SDR dongle to run.\nFLARM is generally only used within Europe.\n\nDo you wish to setup RTL-SDR OGN?" 10 65
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "RTL-SDR OGN Not Installed" --defaultno --yesno "The goal the OGN project is to create a unified platform for tracking aircraft equipped with FLARM (or FLARM-compatible) emitters and OGN trackers.\n\nRTL-SDR OGN will require an additional RTL-SDR dongle to run.\nFLARM is generally only used within Europe.\n\nDo you wish to setup RTL-SDR OGN?" 10 65
case $? in
0)
RTLSDROGN_INSTALL="true"
@ -333,78 +333,78 @@ fi
# Declare the FEEDER_LIST array and the FEEDER_CHOICES file which will store choices for feeders which are available for install.
declare array FEEDER_LIST
touch $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
touch ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
# Check for the PiAware package.
if [ $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' piaware 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# Do not show the PiAware install option if the FlightAware fork of dump1090 has been chosen.
if [ "$DUMP1090_FORK" != "fa" ]; then
if [[ "${DUMP1090_FORK}" != "fa" ]] ; then
# The PiAware package appears to not be installed.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'FlightAware PiAware' '' OFF)
else
# Check the installation configuration file to see if PiAware is to be installed.
if [ -z "$PIAWARE_INSTALL" ] && [ "$PIAWARE_INSTALL" = "true" ]; then
if [[ -z "${PIAWARE_INSTALL}" ]] && [[ "${PIAWARE_INSTALL}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "FlightAware PiAware" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "FlightAware PiAware" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
fi
else
# Check if a newer version can be installed.
if [ $(sudo dpkg -s piaware 2>/dev/null | grep -c "Version: $PIAWARE_VERSION") -eq 0 ]; then
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ $(sudo dpkg -s piaware 2>/dev/null | grep -c "Version: ${PIAWARE_VERSION}") -eq 0 ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'FlightAware PiAware (upgrade)' '' OFF)
else
# Check the installation configuration file to see if PiAware is to be upgraded.
if [ -z "$PIAWARE_INSTALL" ] && [ "$PIAWARE_INSTALL" = "true" ] && [ -z "$PIAWARE_UPGRADE" ] && [ "$PIAWARE_UPGRADE" = "true" ]; then
if [[ -z "${PIAWARE_INSTALL}" ]] && [[ "${PIAWARE_INSTALL}" = "true" ]] && [[ -z "${PIAWARE_UPGRADE}" ]] && [[ "${PIAWARE_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "FlightAware PiAware (upgrade)" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "FlightAware PiAware (upgrade)" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
fi
fi
# Check for the Planefinder ADS-B Client package.
if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# The Planefinder Client package does not appear to be installed.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'Plane Finder Client' '' OFF)
else
# Check the installation configuration file to see if the Plane Finder Client is to be installed.
if [ -z "$PLANEFINDER_INSTALL" ] && [ "$PLANEFINDER_INSTALL" = "true" ]; then
if [[ -z "${PLANEFINDER_INSTALL}" ]] && [[ "${PLANEFINDER_INSTALL}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "Plane Finder Client" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "Plane Finder Client" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
else
# Check if a newer version can be installed.
if [ "${CPU_ARCHITECTURE}" = "armv7l" ]; then
if [ $(sudo dpkg -s pfclient 2>/dev/null | grep -c "Version: $PLANEFINDER_CLIENT_VERSION_ARM") -eq 0 ]; then
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${CPU_ARCHITECTURE}" = "armv7l" ]] ; then
if [[ $(sudo dpkg -s pfclient 2>/dev/null | grep -c "Version: ${PLANEFINDER_CLIENT_VERSION_ARM}") -eq 0 ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'Plane Finder Client (upgrade)' '' OFF)
else
# Check the installation configuration file to see if the Planefinder Client is to be upgraded.
if [ -z "$PLANEFINDER_INSTALL" ] && [ "$PLANEFINDER_INSTALL" = "true" ] && [ -z "$PLANEFINDER_UPGRADE" ] && [ "$PLANEFINDER_UPGRADE" = "true" ]; then
if [[ -z "${PLANEFINDER_INSTALL}" ]] && [[ "${PLANEFINDER_INSTALL}" = "true" ]] && [[ -z "${PLANEFINDER_UPGRADE}" ]] && [[ "${PLANEFINDER_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "Plane Finder Client (upgrade)" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "Plane Finder Client (upgrade)" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
fi
else
if [ $(sudo dpkg -s pfclient 2>/dev/null | grep -c "Version: $PLANEFINDER_CLIENT_VERSION_I386") -eq 0 ]; then
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ $(sudo dpkg -s pfclient 2>/dev/null | grep -c "Version: ${PLANEFINDER_CLIENT_VERSION_I386}") -eq 0 ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'Plane Finder Client (upgrade)' '' OFF)
else
# Check the installation configuration file to see if the Planefinder Client is to be upgraded.
if [ -z "$PLANEFINDER_INSTALL" ] && [ "$PLANEFINDER_INSTALL" = "true" ] && [ -z "$PLANEFINDER_UPGRADE" ] && [ "$PLANEFINDER_UPGRADE" = "true" ]; then
if [[ -z "${PLANEFINDER_INSTALL}" ]] && [[ "${PLANEFINDER_INSTALL}" = "true" ]] && [[ -z "${PLANEFINDER_UPGRADE}" ]] && [[ "${PLANEFINDER_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "Plane Finder Client (upgrade)" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "Plane Finder Client (upgrade)" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
fi
@ -412,30 +412,30 @@ else
fi
# Check for the Flightradar24 Feeder Client package.
if [ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' fr24feed 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# The Flightradar24 client package does not appear to be installed.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'Flightradar24 Client' '' OFF)
else
# Check the installation configuration file to see if the Flightradar24 Client is to be installed.
if [ -z "$FLIGHTRADAR_INSTALL" ] && [ "$FLIGHTRADAR_INSTALL" = "true" ]; then
if [[ -z "${FLIGHTRADAR_INSTALL}" ]] && [[ "${FLIGHTRADAR_INSTALL}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "Flightradar24 Client" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "Flightradar24 Client" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
else
# Check if a newer version can be installed if this is not a Raspberry Pi device.
if [ "${CPU_ARCHITECTURE}" != "armv7l" ]; then
if [ $(sudo dpkg -s fr24feed 2>/dev/null | grep -c "Version: ${FLIGHTRADAR24_CLIENT_VERSION_I386}") -eq 0 ]; then
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${CPU_ARCHITECTURE}" != "armv7l" ]] ; then
if [[ $(sudo dpkg -s fr24feed 2>/dev/null | grep -c "Version: ${FLIGHTRADAR24_CLIENT_VERSION_I386}") -eq 0 ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'Flightradar24 Client (upgrade)' '' OFF)
else
# Check the installation configuration file to see if the Planefinder Client is to be upgraded.
if [ -z "$PLANEFINDER_INSTALL" ] && [ "$PLANEFINDER_INSTALL" = "true" ] && [ -z "$PLANEFINDER_UPGRADE" ] && [ "$PLANEFINDER_UPGRADE" = "true" ]; then
if [[ -z "${PLANEFINDER_INSTALL}" ]] && [[ "${PLANEFINDER_INSTALL}" = "true" ]] && [[ -z "${PLANEFINDER_UPGRADE}" ]] && [[ "${PLANEFINDER_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo " (upgrade)" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo " (upgrade)" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
fi
@ -443,49 +443,49 @@ else
fi
# Check if MLAT client has been installed to be used to feed ADS-B Exchange.
if [ $(dpkg-query -W -f='${STATUS}' mlat-client 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' mlat-client 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# The mlat-client package does not appear to be installed.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'Netcat and MLAT Client for ADS-B Exchange' '' OFF)
else
# Check the installation configuration file to see if ADS-B Exchange feeding is to be setup.
if [ -z "$ADSBEXCHANGE_INSTALL" ] && [ "$ADSBEXCHANGE_INSTALL" = "true" ]; then
if [[ -z "${ADSBEXCHANGE_INSTALL}" ]] && [[ "${ADSBEXCHANGE_INSTALL}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "Netcat and MLAT Client for ADS-B Exchange" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "Netcat and MLAT Client for ADS-B Exchange" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
else
# Check if a newer version of mlat-client can be installed.
if [ $(sudo dpkg -s mlat-client 2>/dev/null | grep -c "Version: ${MLAT_CLIENT_VERSION}") -eq 0 ]; then
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ $(sudo dpkg -s mlat-client 2>/dev/null | grep -c "Version: ${MLAT_CLIENT_VERSION}") -eq 0 ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the FEEDER_LIST array to be used by the whiptail menu.
FEEDER_LIST=("${FEEDER_LIST[@]}" 'Netcat and MLAT Client for ADS-B Exchange (upgrade)' '' OFF)
else
# Check the installation configuration file to see if the Planefinder Client is to be upgraded.
if [ -z "$ADSBEXCHANGE_INSTALL" ] && [ "$ADSBEXCHANGE_INSTALL" = "true" ] && [ -z "$ADSBEXCHANGE_UPGRADE" ] && [ "$ADSBEXCHANGE_UPGRADE" = "true" ]; then
if [[ -z "${ADSBEXCHANGE_INSTALL}" ]] && [[ "${ADSBEXCHANGE_INSTALL}" = "true" ]] && [[ -z "${ADSBEXCHANGE_UPGRADE}" ]] && [[ "${ADSBEXCHANGE_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the FEEDER_CHOICES file.
echo "Netcat and MLAT Client for ADS-B Exchange (upgrade)" >> $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
echo "Netcat and MLAT Client for ADS-B Exchange (upgrade)" >> ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
fi
fi
fi
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [ -n "$FEEDER_LIST" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
if [[ -n "${FEEDER_LIST}" ]] ; then
# Display a checklist containing feeders that are not installed if any.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Feeder Installation Options" --checklist --nocancel --separate-output "The following feeders are available for installation.\nChoose the feeders you wish to install." 13 65 4 "${FEEDER_LIST[@]}" 2>$RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Feeder Installation Options" --checklist --nocancel --separate-output "The following feeders are available for installation.\nChoose the feeders you wish to install." 13 65 4 "${FEEDER_LIST[@]}" 2>${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
else
# Since all available feeders appear to be installed inform the user of the fact.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "All Feeders Installed" --msgbox "It appears that all the optional feeders available for installation by this script have been installed already." 8 65
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "All Feeders Installed" --msgbox "It appears that all the optional feeders available for installation by this script have been installed already." 8 65
fi
fi
## ADS-B Receiver Project Web Portal
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask if the web portal should be installed.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Install The ADS-B Receiver Project Web Portal" --yesno "The ADS-B Receiver Project Web Portal is a lightweight web interface for dump-1090-mutability installations.\n\nCurrent features include the following:\n Unified navigation between all web pages.\n System and dump1090 performance graphs.\n\nWould you like to install the ADS-B Receiver Project web portal on this device?" 8 78
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Install The ADS-B Receiver Project Web Portal" --yesno "The ADS-B Receiver Project Web Portal is a lightweight web interface for dump-1090-mutability installations.\n\nCurrent features include the following:\n Unified navigation between all web pages.\n System and dump1090 performance graphs.\n\nWould you like to install the ADS-B Receiver Project web portal on this device?" 8 78
case $? in
0)
WEBPORTAL_INSTALL="true"
@ -500,96 +500,96 @@ fi
# Declare the EXTRAS_LIST array and the EXTRAS_CHOICES file which will store choices for extras which are available for install.
declare array EXTRAS_LIST
touch $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
touch ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
# Check if the AboveTustin repository has been cloned.
if [ -d $BUILDDIRECTORY/AboveTustin ] && [ -d $BUILDDIRECTORY/AboveTustin/.git ]; then
if [[ -d "${BUILDDIRECTORY}/AboveTustin" ]] && [[ -d "${BUILDDIRECTORY}/AboveTustin/.git" ]] ; then
# The AboveTustin repository has been cloned to this device.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the EXTRAS_LIST array to be used by the whiptail menu.
EXTRAS_LIST=("${EXTRAS_LIST[@]}" 'AboveTustin (reinstall)' '' OFF)
else
# Check the installation configuration file to see if AboveTustin is to be upgraded.
if [ -z "$ABOVETUSTIN_INSTALL" ] && [ "$ABOVETUSTIN_INSTALL" = "true" ] && [ -z "$ABOVETUSTIN_UPGRADE" ] && [ "$ABOVETUSTIN_UPGRADE" = "true" ]; then
if [[ -z "${ABOVETUSTIN_INSTALL}" ]] && [[ "${ABOVETUSTIN_INSTALL}" = "true" ]] && [[ -z "${ABOVETUSTIN_UPGRADE}" ]] && [[ "${ABOVETUSTIN_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the EXTRAS_CHOICES file.
echo "AboveTustin (reinstall)" >> $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
echo "AboveTustin (reinstall)" >> ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
fi
else
# The AboveTustin repository has not been cloned to this device.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the EXTRAS_LIST array to be used by the whiptail menu.
EXTRAS_LIST=("${EXTRAS_LIST[@]}" 'AboveTustin' '' OFF)
else
# Check the installation configuration file to see if AboveTustin is to be installed.
if [ -z "$ABOVETUSTIN_INSTALL" ] && [ "$ABOVETUSTIN_INSTALL" = "true" ]; then
if [[ -z "${ABOVETUSTIN_INSTALL}" ]] && [[ "${ABOVETUSTIN_INSTALL}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the EXTRAS_CHOICES file.
echo "AboveTustin" >> $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
echo "AboveTustin" >> ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
fi
fi
# Check if the beast-splitter package is installed.
if [ $(dpkg-query -W -f='${STATUS}' beast-splitter 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' beast-splitter 2>/dev/null | grep -c "ok installed") -eq 0 ]] ; then
# The beast-splitter package appears to not be installed.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the EXTRAS_LIST array to be used by the whiptail menu.
EXTRAS_LIST=("${EXTRAS_LIST[@]}" 'beast-splitter' '' OFF)
else
# Check the installation configuration file to see if beast-splitter is to be installed.
if [ -z "$BEASTSPLITTER_INSTALL" ] && [ "$BEASTSPLITTER_INSTALL" = "true" ]; then
if [[ -z "${BEASTSPLITTER_INSTALL}" ]] && [[ "${BEASTSPLITTER_INSTALL}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the EXTRAS_CHOICES file.
echo "beast-splitter" >> $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
echo "beast-splitter" >> ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
fi
else
# Offer the option to build then reinstall the beast-splitter package.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the EXTRAS_LIST array to be used by the whiptail menu.
EXTRAS_LIST=("${EXTRAS_LIST[@]}" 'beast-splitter (reinstall)' '' OFF)
else
if [ -z "$BEASTSPLITTER_INSTALL" ] && [ "$BEASTSPLITTER_INSTALL" = "true" ] && [ -z "$BEASTSPLITTER_UPGRADE" ] && [ "$BEASTSPLITTER_UPGRADE" = "true" ]; then
if [[ -z "${BEASTSPLITTER_INSTALL}" ]] && [[ "${BEASTSPLITTER_INSTALL}" = "true" ]] && [[ -z "${BEASTSPLITTER_UPGRADE}" ]] && [[ "${BEASTSPLITTER_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the EXTRAS_CHOICES file.
echo "beast-splitter (reinstall)" >> $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
echo "beast-splitter (reinstall)" >> ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
fi
fi
# Check if the Duck DNS update script exists.
if [ ! -f $BUILDDIRECTORY/duckdns/duck.sh ]; then
if [[ ! -f "${BUILDDIRECTORY}/duckdns/duck.sh" ]] ; then
# Duck DNS does not appear to be set up on this device.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the EXTRAS_LIST array to be used by the whiptail menu.
EXTRAS_LIST=("${EXTRAS_LIST[@]}" 'Duck DNS Free Dynamic DNS Hosting' '' OFF)
else
# Check the installation configuration file to see if Duck DNS dynamic DNS support is to be added.
if [ -z "$DUCKDNS_INSTALL" ] && [ "$DUCKDNS_INSTALL" = "true" ]; then
if [[ -z "${DUCKDNS_INSTALL}" ]] && [[ "${DUCKDNS_INSTALL}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the EXTRAS_CHOICES file.
echo "Duck DNS Free Dynamic DNS Hosting" >> $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
echo "Duck DNS Free Dynamic DNS Hosting" >> ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
fi
else
# Offer the option to install/setup Duck DNS once more.
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Add this choice to the EXTRAS_LIST array to be used by the whiptail menu.
EXTRAS_LIST=("${EXTRAS_LIST[@]}" 'Duck DNS Free Dynamic DNS Hosting (reinstall)' '' OFF)
else
if [ -z "$DUCKDNS_INSTALL" ] && [ "$DUCKDNS_INSTALL" = "true" ] && [ -z "$DUCKDNS_UPGRADE" ] && [ "$DUCKDNS_UPGRADE" = "true" ]; then
if [[ -z "${DUCKDNS_INSTALL}" ]] && [[ "${DUCKDNS_INSTALL}" = "true" ]] && [[ -z "${DUCKDNS_UPGRADE}" ]] && [[ "${DUCKDNS_UPGRADE}" = "true" ]] ; then
# Since the menu will be skipped add this choice directly to the EXTRAS_CHOICES file.
echo "Duck DNS Free Dynamic DNS Hosting (reinstall)" >> $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
echo "Duck DNS Free Dynamic DNS Hosting (reinstall)" >> ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
fi
fi
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Display a menu the user can use to pick extras to be installed.
if [[ -n "$EXTRAS_LIST" ]]; then
if [[ -n "${EXTRAS_LIST}" ]] ; then
# Display a checklist containing feeders that are not installed if any.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Feeder Installation Options" --checklist --nocancel --separate-output "The following extras are available for installation.\nChoose the extrass you wish to install." 13 65 4 "${EXTRAS_LIST[@]}" 2>$RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Feeder Installation Options" --checklist --nocancel --separate-output "The following extras are available for installation.\nChoose the extrass you wish to install." 13 65 4 "${EXTRAS_LIST[@]}" 2>${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
else
# Since all available extras appear to be installed inform the user of the fact.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "All Extras Installed" --msgbox "It appears that all the optional extras available for installation by this script have been installed already." 8 65
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "All Extras Installed" --msgbox "It appears that all the optional extras available for installation by this script have been installed already." 8 65
fi
fi
@ -598,9 +598,9 @@ fi
declare CONFIRMATION
# Check if anything is to be done before moving on.
if [ "$DUMP1090_INSTALL" = "false" ] && [ "$DUMP1090_UPGRADE" = "false" ] && [ "$DUMP978_INSTALL" = "false" ] && [ "$DUMP978_UPGRADE" = "false" ] && [ "$WEBPORTAL_INSTALL" = "false" ] && [ ! -s $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES ] && [ ! -s $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES ]; then
if [[ "${DUMP1090_INSTALL}" = "false" ]] && [[ "${DUMP1090_UPGRADE}" = "false" ]] && [[ "${DUMP978_INSTALL}" = "false" ]] && [[ "${DUMP978_UPGRADE}" = "false" ]] && [[ "${WEBPORTAL_INSTALL}" = "false" ]] && [[ ! -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" ]] && [[ ! -s "${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES" ]] ; then
# Nothing was chosen to be installed.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Nothing to be done" --msgbox "Nothing has been selected to be installed so the script will exit now." 10 65
whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Nothing to be done" --msgbox "Nothing has been selected to be installed so the script will exit now." 10 65
echo -e "\e[31m"
echo -e " Nothing was selected to do or be installed."
echo -e "\e[37m"
@ -610,120 +610,120 @@ else
CONFIRMATION="The following software will be installed:\n"
# dump1090
if [ "$DUMP1090_INSTALL" = "true" ] || [ "$DUMP1090_UPGRADE" = "true" ]; then
if [ "$DUMP1090_DO_UPGRADE" = "true" ]; then
case $DUMP1090_FORK in
if [[ "${DUMP1090_INSTALL}" = "true" ]] || [[ "${DUMP1090_UPGRADE}" = "true" ]] ; then
if [[ "${DUMP1090_DO_UPGRADE}" = "true" ]] ; then
case ${DUMP1090_FORK} in
"mutability")
CONFIRMATION="$CONFIRMATION\n * dump1090-mutability (reinstall)"
CONFIRMATION="${CONFIRMATION}\n * dump1090-mutability (reinstall)"
;;
"fa")
CONFIRMATION="$CONFIRMATION\n * dump1090-fa (upgrade)"
CONFIRMATION="${CONFIRMATION}\n * dump1090-fa (upgrade)"
;;
esac
else
case $DUMP1090_FORK in
case ${DUMP1090_FORK} in
"mutability")
CONFIRMATION="$CONFIRMATION\n * dump1090-mutability"
CONFIRMATION="${CONFIRMATION}\n * dump1090-mutability"
;;
"fa")
CONFIRMATION="$CONFIRMATION\n * dump1090-fa"
CONFIRMATION="${CONFIRMATION}\n * dump1090-fa"
;;
esac
fi
fi
# dump978
if [ "$DUMP978_INSTALL" = "true" ] || [ "$DUMP978_UPGRADE" = "true" ]; then
if [ "$DUMP978_DO_UPGRADE" = "true" ]; then
CONFIRMATION="$CONFIRMATION\n * dump978 (rebuild)"
if [[ "${DUMP978_INSTALL}" = "true" ]] || [[ "${DUMP978_UPGRADE}" = "true" ]] ; then
if [[ "${DUMP978_DO_UPGRADE}" = "true" ]] ; then
CONFIRMATION="${CONFIRMATION}\n * dump978 (rebuild)"
else
CONFIRMATION="$CONFIRMATION\n * dump978"
CONFIRMATION="${CONFIRMATION}\n * dump978"
fi
fi
# RTL-SDR OGN
if [ "$RTLSDROGN_INSTALL" = "true" ] || [ "$RTLSDROGN_UPGRADE" = "true" ]; then
if [ "$RTLSDROGN_DO_UPGRADE" = "true" ]; then
CONFIRMATION="$CONFIRMATION\n * RTL-SDR OGN (upgrade)"
if [[ "${RTLSDROGN_INSTALL}" = "true" ]] || [[ "${RTLSDROGN_UPGRADE}" = "true" ]] ; then
if [[ "${RTLSDROGN_DO_UPGRADE}" = "true" ]] ; then
CONFIRMATION="${CONFIRMATION}\n * RTL-SDR OGN (upgrade)"
else
CONFIRMATION="$CONFIRMATION\n * RTL-SDR OGN"
CONFIRMATION="${CONFIRMATION}\n * RTL-SDR OGN"
fi
fi
# If PiAware is required add it to the list.
if [ "$DUMP1090_FORK" = "fa" ]; then
CONFIRMATION="$CONFIRMATION\n * FlightAware PiAware"
if [[ "${DUMP1090_FORK}" = "fa" ]] ; then
CONFIRMATION="${CONFIRMATION}\n * FlightAware PiAware"
fi
if [ -s $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES ]; then
if [[ -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" ]] ; then
while read FEEDER_CHOICE
do
case $FEEDER_CHOICE in
case ${FEEDER_CHOICE} in
"FlightAware PiAware")
CONFIRMATION="$CONFIRMATION\n * FlightAware PiAware"
CONFIRMATION="${CONFIRMATION}\n * FlightAware PiAware"
;;
"FlightAware PiAware (upgrade)")
CONFIRMATION="$CONFIRMATION\n * FlightAware PiAware (upgrade)"
CONFIRMATION="${CONFIRMATION}\n * FlightAware PiAware (upgrade)"
;;
"Plane Finder Client")
CONFIRMATION="$CONFIRMATION\n * Plane Finder Client"
CONFIRMATION="${CONFIRMATION}\n * Plane Finder Client"
;;
"Plane Finder Client (upgrade)")
CONFIRMATION="$CONFIRMATION\n * Plane Finder Client (upgrade)"
CONFIRMATION="${CONFIRMATION}\n * Plane Finder Client (upgrade)"
;;
"Flightradar24 Client")
CONFIRMATION="$CONFIRMATION\n * Flightradar24 Client"
CONFIRMATION="${CONFIRMATION}\n * Flightradar24 Client"
;;
"Flightradar24 Client (upgrade)")
CONFIRMATION="$CONFIRMATION\n * Flightradar24 Client (upgrade)"
CONFIRMATION="${CONFIRMATION}\n * Flightradar24 Client (upgrade)"
;;
"Netcat and MLAT Client for ADS-B Exchange")
CONFIRMATION="$CONFIRMATION\n * Netcat and MLAT Client for ADS-B Exchange"
CONFIRMATION="${CONFIRMATION}\n * Netcat and MLAT Client for ADS-B Exchange"
;;
"Netcat and MLAT Client for ADS-B Exchange (upgrade)")
CONFIRMATION="$CONFIRMATION\n * Netcat and MLAT Client for ADS-B Exchange (upgrade)"
CONFIRMATION="${CONFIRMATION}\n * Netcat and MLAT Client for ADS-B Exchange (upgrade)"
;;
esac
done < $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
done < ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
if [ "$WEBPORTAL_INSTALL" = "true" ]; then
CONFIRMATION="$CONFIRMATION\n * ADS-B Receiver Project Web Portal"
if [[ "${WEBPORTAL_INSTALL}" = "true" ]] ; then
CONFIRMATION="${CONFIRMATION}\n * ADS-B Receiver Project Web Portal"
fi
if [ -s $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES ]; then
if [[ -s "${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES" ]] ; then
while read EXTRAS_CHOICE
do
case $EXTRAS_CHOICE in
case ${EXTRAS_CHOICE} in
"AboveTustin")
CONFIRMATION="$CONFIRMATION\n * AboveTustin"
CONFIRMATION="${CONFIRMATION}\n * AboveTustin"
;;
"AboveTustin (reinstall)")
CONFIRMATION="$CONFIRMATION\n * AboveTustin (reinstall)"
CONFIRMATION="${CONFIRMATION}\n * AboveTustin (reinstall)"
;;
"beast-splitter")
CONFIRMATION="$CONFIRMATION\n * beast-splitter"
CONFIRMATION="${CONFIRMATION}\n * beast-splitter"
;;
"beast-splitter (reinstall)")
CONFIRMATION="$CONFIRMATION\n * beast-splitter (reinstall)"
CONFIRMATION="${CONFIRMATION}\n * beast-splitter (reinstall)"
;;
"Duck DNS Free Dynamic DNS Hosting")
CONFIRMATION="$CONFIRMATION\n * Duck DNS Free Dynamic DNS Hosting"
CONFIRMATION="${CONFIRMATION}\n * Duck DNS Free Dynamic DNS Hosting"
;;
"Duck DNS Free Dynamic DNS Hosting (reinstall)")
CONFIRMATION="$CONFIRMATION\n * Duck DNS Free Dynamic DNS Hosting (reinstall)"
CONFIRMATION="${CONFIRMATION}\n * Duck DNS Free Dynamic DNS Hosting (reinstall)"
;;
esac
done < $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
done < ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
CONFIRMATION="$CONFIRMATION\n\n"
CONFIRMATION="${CONFIRMATION}\n\n"
fi
if [ "$RECEIVER_AUTOMATED_INSTALL" = "false" ]; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
# Ask for confirmation before moving on.
CONFIRMATION="${CONFIRMATION}Do you wish to continue setup?"
if ! (whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Confirm You Wish To Continue" --yesno "$CONFIRMATION" 21 78) then
if ! (whiptail --backtitle "${RECEIVER_PROJECT_TITLE}" --title "Confirm You Wish To Continue" --yesno "${CONFIRMATION}" 21 78) then
echo -e "\e[31m"
echo " Installation canceled by user."
exit 1
@ -735,8 +735,8 @@ fi
## Decoders
if [ "$DUMP1090_INSTALL" = "true" ] || [ "$DUMP1090_UPGRADE" = "true" ]; then
case $DUMP1090_FORK in
if [[ "${DUMP1090_INSTALL}" = "true" ]] || [[ "${DUMP1090_UPGRADE}" = "true" ]] ; then
case ${DUMP1090_FORK} in
"mutability")
InstallDump1090Mutability
;;
@ -746,11 +746,11 @@ if [ "$DUMP1090_INSTALL" = "true" ] || [ "$DUMP1090_UPGRADE" = "true" ]; then
esac
fi
if [ "$DUMP978_INSTALL" = "true" ] || [ "$DUMP978_UPGRADE" = "true" ]; then
if [[ "${DUMP978_INSTALL}" = "true" ]] || [[ "${DUMP978_UPGRADE}" = "true" ]] ; then
InstallDump978
fi
if [ "$RTLSDROGN_INSTALL" = "true" ] || [ "$RTLSDROGN_UPGRADE" = "true" ]; then
if [[ "${RTLSDROGN_INSTALL}" = "true" ]] || [[ "${RTLSDROGN_UPGRADE}" = "true" ]] ; then
InstallRtlsdrOgn
fi
@ -764,10 +764,10 @@ RUN_PLANEFINDER_SCRIPT="false"
RUN_FLIGHTRADAR24_SCRIPT="false"
RUN_ADSBEXCHANGE_SCRIPT="false"
if [ -s $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES ]; then
if [[ -s "${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES" ]] ; then
while read FEEDER_CHOICE
do
case $FEEDER_CHOICE in
case ${FEEDER_CHOICE} in
"FlightAware PiAware"|"FlightAware PiAware (upgrade)")
RUN_PIAWARE_SCRIPT="true"
;;
@ -781,28 +781,28 @@ if [ -s $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES ]; then
RUN_ADSBEXCHANGE_SCRIPT="true"
;;
esac
done < $RECEIVER_ROOT_DIRECTORY/FEEDER_CHOICES
done < ${RECEIVER_ROOT_DIRECTORY}/FEEDER_CHOICES
fi
if [ "$RUN_PIAWARE_SCRIPT" = "true" ] || [ "$FORCE_PIAWARE_INSTALL" = "true" ]; then
if [[ "${RUN_PIAWARE_SCRIPT}" = "true" ]] || [[ "${FORCE_PIAWARE_INSTALL}" = "true" ]] ; then
InstallPiAware
fi
if [ "$RUN_PLANEFINDER_SCRIPT" = "true" ]; then
if [[ "${RUN_PLANEFINDER_SCRIPT}" = "true" ]] ; then
InstallPlaneFinder
fi
if [ "$RUN_FLIGHTRADAR24_SCRIPT" = "true" ]; then
if [[ "${RUN_FLIGHTRADAR24_SCRIPT}" = "true" ]] ; then
InstallFlightradar24
fi
if [ "$RUN_ADSBEXCHANGE_SCRIPT" = "true" ]; then
if [[ "${RUN_ADSBEXCHANGE_SCRIPT}" = "true" ]] ; then
InstallAdsbExchange
fi
## ADS-B Receiver Project Web Portal
if [ "$WEBPORTAL_INSTALL" = "true" ]; then
if [[ "${WEBPORTAL_INSTALL}" = "true" ]] ; then
InstallWebPortal
fi
@ -813,10 +813,10 @@ RUN_ABOVETUSTIN_SCRIPT="false"
RUN_BEASTSPLITTER_SCRIPT="false"
RUN_DUCKDNS_SCRIPT="false"
if [ -s $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES ]; then
if [[ -s "${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES" ]] ; then
while read EXTRAS_CHOICE
do
case $EXTRAS_CHOICE in
case ${EXTRAS_CHOICE} in
"AboveTustin"|"AboveTustin (reinstall)")
RUN_ABOVETUSTIN_SCRIPT="true"
;;
@ -827,18 +827,18 @@ if [ -s $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES ]; then
RUN_DUCKDNS_SCRIPT="true"
;;
esac
done < $RECEIVER_ROOT_DIRECTORY/EXTRAS_CHOICES
done < ${RECEIVER_ROOT_DIRECTORY}/EXTRAS_CHOICES
fi
if [ "$RUN_ABOVETUSTIN_SCRIPT" = "true" ]; then
if [[ "${RUN_ABOVETUSTIN_SCRIPT}" = "true" ]] ; then
InstallAboveTustin
fi
if [ "$RUN_BEASTSPLITTER_SCRIPT" = "true" ]; then
if [[ "${RUN_BEASTSPLITTER_SCRIPT}" = "true" ]] ; then
InstallBeastSplitter
fi
if [ "$RUN_DUCKDNS_SCRIPT" = "true" ]; then
if [[ "${RUN_DUCKDNS_SCRIPT}" = "true" ]] ; then
InstallDuckDns
fi

Wyświetl plik

@ -33,16 +33,16 @@
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
PORTALBUILDDIRECTORY="$BUILDDIRECTORY/portal"
PORTALPYTHONDIRECTORY="$PORTALBUILDDIRECTORY/python"
PROJECTROOTDIRECTORY="${PWD}"
BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build"
PORTALBUILDDIRECTORY="${BUILDDIRECTORY}/portal"
PORTALPYTHONDIRECTORY="${PORTALBUILDDIRECTORY}/python"
DATABASEENGINE=$ADSB_DATABASEENGINE
DATABASEHOSTNAME=$ADSB_DATABASEHOSTNAME
DATABASEUSER=$ADSB_DATABASEUSER
DATABASEPASSWORD1=$ADSB_DATABASEPASSWORD1
DATABASENAME=$ADSB_DATABASENAME
DATABASEENGINE=${ADSB_DATABASEENGINE}
DATABASEHOSTNAME=${ADSB_DATABASEHOSTNAME}
DATABASEUSER=${ADSB_DATABASEUSER}
DATABASEPASSWORD1=${ADSB_DATABASEPASSWORD1}
DATABASENAME=${ADSB_DATABASENAME}
## SETUP FLIGHT LOGGING
@ -50,28 +50,28 @@ echo -e ""
echo -e "\e[95m Setting up core advanced portal features...\e[97m"
echo -e ""
case $DATABASEENGINE in
case ${DATABASEENGINE} in
"MySQL")
echo -e "\e[94m Creating the flight Python configuration file for MySQL...\e[97m"
tee $PORTALPYTHONDIRECTORY/config.json > /dev/null <<EOF
tee ${PORTALPYTHONDIRECTORY}/config.json > /dev/null <<EOF
{
"database":{"type":"mysql",
"host":"$DATABASEHOSTNAME",
"user":"$DATABASEUSER",
"passwd":"$DATABASEPASSWORD1",
"db":"$DATABASENAME"}
"host":"${DATABASEHOSTNAME}",
"user":"${DATABASEUSER}",
"passwd":"${DATABASEPASSWORD1}",
"db":"${DATABASENAME}"}
}
EOF
;;
"SQLite")
echo -e "\e[94m Creating the Python configuration file for SQLite...\e[97m"
tee $PORTALPYTHONDIRECTORY/config.json > /dev/null <<EOF
tee ${PORTALPYTHONDIRECTORY}/config.json > /dev/null <<EOF
{
"database":{"type":"sqlite",
"host":"$DATABASEHOSTNAME",
"user":"$DATABASEUSER",
"passwd":"$DATABASEPASSWORD1",
"db":"$DATABASENAME"}
"host":"${DATABASEHOSTNAME}",
"user":"${DATABASEUSER}",
"passwd":"${DATABASEPASSWORD1}",
"db":"${DATABASENAME}"}
}
EOF
;;

Wyświetl plik

@ -70,7 +70,7 @@ if [[ -z "${DUMP1090_INSTALLED}" ]] || [[ -z "${DUMP1090_FORK}" ]] ; then
fi
echo -e ""
fi
if [[ -f /etc/init.d/rtlsdr-ogn ]] ; then
if [[ -f "/etc/init.d/rtlsdr-ogn" ]] ; then
RTLSDROGN_INSTALLED="true"
fi
@ -360,7 +360,7 @@ fi
# The next block is temporary in order to insure this file is
# deleted on older installation before the project renaming.
if [[ -f /etc/cron.d/adsb-feeder-performance-graphs ]] ; then
if [[ -f "/etc/cron.d/adsb-feeder-performance-graphs" ]] ; then
echo -e "\e[94m Removing outdated performance graphs cron file...\e[97m"
sudo rm -f /etc/cron.d/adsb-feeder-performance-graphs 2>&1
echo -e ""
@ -409,7 +409,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Graphing setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -33,27 +33,27 @@
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
PORTALBUILDDIRECTORY="$BUILDDIRECTORY/portal"
PROJECTROOTDIRECTORY="${PWD}"
BASHDIRECTORY="${PROJECTROOTDIRECTORY}/bash"
BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build"
PORTALBUILDDIRECTORY="${BUILDDIRECTORY}/portal"
## INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
source ${BASHDIRECTORY}/variables.sh
source ${BASHDIRECTORY}/functions.sh
## BEGIN SETUP
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo -e "\n\e[91m ${ADSB_PROJECTTITLE}"
echo -e ""
echo -e "\e[92m Setting up the ADS-B Receiver Project Portal..."
echo -e "\e[93m ------------------------------------------------------------------------------\e[96m"
echo -e ""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B ADS-B Receiver Project Portal Setup" --yesno "The ADS-B ADS-B Receiver Project Portal adds a web accessable portal to your receiver. The portal contains allows you to view performance graphs, system information, and live maps containing the current aircraft being tracked.\n\nBy enabling the portal's advanced features you can also view historical data on flight that have been seen in the past as well as view more detailed information on each of these aircraft.\n\nTHE ADVANCED PORTAL FEATURES ARE STILL IN DEVELOPMENT\n\nIt is recomended that only those wishing to contribute to the development of these features or those wishing to test out the new features enable them. Do not be surprised if you run into any major bugs after enabling the advanced features at this time!\n\nDo you wish to continue with the ADS-B Receiver Project Portal setup?" 23 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "ADS-B ADS-B Receiver Project Portal Setup" --yesno "The ADS-B ADS-B Receiver Project Portal adds a web accessable portal to your receiver. The portal contains allows you to view performance graphs, system information, and live maps containing the current aircraft being tracked.\n\nBy enabling the portal's advanced features you can also view historical data on flight that have been seen in the past as well as view more detailed information on each of these aircraft.\n\nTHE ADVANCED PORTAL FEATURES ARE STILL IN DEVELOPMENT\n\nIt is recomended that only those wishing to contribute to the development of these features or those wishing to test out the new features enable them. Do not be surprised if you run into any major bugs after enabling the advanced features at this time!\n\nDo you wish to continue with the ADS-B Receiver Project Portal setup?" 23 78
CONTINUESETUP=$?
if [ "$CONTINUESETUP" = 1 ]; then
if [[ "${CONTINUESETUP}" = 1 ]] ; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo -e " Setup has been halted at the request of the user."
@ -61,7 +61,7 @@ if [ "$CONTINUESETUP" = 1 ]; then
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Receiver Project Portal setup halted.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
exit 1
@ -76,74 +76,74 @@ CheckPackage lighttpd
# Assign the Lighthttpd document root directory to a variable.
RAWDOCUMENTROOT=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root`
LIGHTTPDDOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< $RAWDOCUMENTROOT`
LIGHTTPDDOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< ${RAWDOCUMENTROOT}`
# Check if there is already an existing portal installation.
if [ -f $LIGHTTPDDOCUMENTROOT/classes/settings.class.php ]; then
if [[ -f "${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php" ]] ; then
PORTALINSTALLED="true"
else
PORTALINSTALLED="false"
fi
if [ "$PORTALINSTALLED" = "true" ]; then
if [[ "${PORTALINSTALLED}" = "true" ]] ; then
# Assign needed variables using the driver setting in settings.class.php.
DATABASEENGINE=`grep 'db_driver' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
if [ "$DATABASEENGINE" = "xml" ]; then
DATABASEENGINE=`grep 'db_driver' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
if [[ "${DATABASEENGINE}" = "xml" ]] ; then
ADVANCED="false"
else
ADVANCED="true"
fi
if [ "$ADVANCED" = "true" ]; then
case $DATABASEENGINE in
if [[ "${ADVANCED}" = "true" ]] ; then
case ${DATABASEENGINE} in
"mysql") DATABASEENGINE="MySQL";;
"sqlite") DATABASEENGINE="SQLite";;
esac
DATABASEHOSTNAME=`grep 'db_host' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASEUSER=`grep 'db_username' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASEPASSWORD1=`grep 'db_password' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASENAME=`grep 'db_database' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASEHOSTNAME=`grep 'db_host' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASEUSER=`grep 'db_username' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASEPASSWORD1=`grep 'db_password' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASENAME=`grep 'db_database' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
fi
else
# Ask if advanced features should be enabled.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Portal Selection" --defaultno --yesno "NOTE THAT THE ADVANCED FEATURES ARE STILL IN DEVELOPMENT AT THIS TIME\nADVANCED FEATURES SHOULD ONLY BE ENABLED BY DEVELOPERS AND TESTERS ONLY\n\nBy enabling advanced features the portal will log all flights seen as well as the path of the flight. This data is stored in either a MySQL or SQLite database. This will result in a lot more data being stored on your devices hard drive. Keep this and your devices hardware capabilities in mind before selecting to enable these features.\n\nENABLING ADVANCED FEATURES ON DEVICES USING SD CARDS CAN SHORTEN THE LIFE OF THE SD CARD IMMENSELY\n\nDo you wish to enable the portal advanced features?" 19 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "ADS-B Receiver Portal Selection" --defaultno --yesno "NOTE THAT THE ADVANCED FEATURES ARE STILL IN DEVELOPMENT AT THIS TIME\nADVANCED FEATURES SHOULD ONLY BE ENABLED BY DEVELOPERS AND TESTERS ONLY\n\nBy enabling advanced features the portal will log all flights seen as well as the path of the flight. This data is stored in either a MySQL or SQLite database. This will result in a lot more data being stored on your devices hard drive. Keep this and your devices hardware capabilities in mind before selecting to enable these features.\n\nENABLING ADVANCED FEATURES ON DEVICES USING SD CARDS CAN SHORTEN THE LIFE OF THE SD CARD IMMENSELY\n\nDo you wish to enable the portal advanced features?" 19 78
RESPONSE=$?
case $RESPONSE in
case ${RESPONSE} in
0) ADVANCED="true";;
1) ADVANCED="false";;
esac
if [ "$ADVANCED" = "true" ]; then
if [[ "${ADVANCED}" = "true" ]] ; then
# Ask which type of database to use.
DATABASEENGINE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Choose Database Type" --nocancel --menu "\nChoose which type of database to use." 11 80 2 "MySQL" "" "SQLite" "" 3>&1 1>&2 2>&3)
DATABASEENGINE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Choose Database Type" --nocancel --menu "\nChoose which type of database to use." 11 80 2 "MySQL" "" "SQLite" "" 3>&1 1>&2 2>&3)
if [ "$DATABASEENGINE" = "MySQL" ]; then
if [[ "${DATABASEENGINE}" = "MySQL" ]] ; then
# Ask if the database server will be installed locally.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "MySQL Database Location" --yesno "Will the database be hosted locally on this device?" 7 80
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "MySQL Database Location" --yesno "Will the database be hosted locally on this device?" 7 80
RESPONSE=$?
case $RESPONSE in
case ${RESPONSE} in
0) LOCALMYSQLSERVER="true";;
1) LOCALMYSQLSERVER="false";;
esac
if [ "$LOCALMYSQLSERVER" = "false" ]; then
if [[ "${LOCALMYSQLSERVER}" = "false" ]] ; then
# Ask for the remote MySQL servers hostname.
DATABASEHOSTNAME_TITLE="MySQL Database Server Hostname"
while [[ -z $DATABASEHOSTNAME ]]; do
DATABASEHOSTNAME=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEHOSTNAME_TITLE" --nocancel --inputbox "\nWhat is the remote MySQL server's hostname?" 10 60 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEHOSTNAME}" ]] ; do
DATABASEHOSTNAME=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEHOSTNAME_TITLE}" --nocancel --inputbox "\nWhat is the remote MySQL server's hostname?" 10 60 3>&1 1>&2 2>&3)
DATABASEHOSTNAME_TITLE="MySQL Database Server Hostname (REQUIRED)"
done
# Ask if the remote MySQL database already exists.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Does MySQL Database Exist" --yesno "Has the database already been created?" 7 80
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Does MySQL Database Exist" --yesno "Has the database already been created?" 7 80
RESPONSE=$?
case $RESPONSE in
case ${RESPONSE} in
0) DATABASEEXISTS="true";;
1) DATABASEEXISTS="false";;
esac
else
# Install the MySQL serer now if it does not already exist.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "MySQL Server Setup" --msgbox "This script will now check for the MySQL server package. If the MySQL server package is not installed it will be installed at this time." 8 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "MySQL Server Setup" --msgbox "This script will now check for the MySQL server package. If the MySQL server package is not installed it will be installed at this time." 8 78
CheckPackage mysql-server
# Since this is a local installation assume the MySQL database does not already exist.
@ -154,79 +154,79 @@ else
fi
# Ask for the MySQL administrator credentials if the database does not already exist.
if [ "$LOCALMYSQLSERVER" = "true" ] || [ "$DATABASEEXISTS" = "false" ]; then
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Create Remote MySQL Database" --msgbox "This script can attempt to create the MySQL database for you.\nYou will now be asked for the credentials for a MySQL user who has the ability to create a database on the MySQL server." 9 78
if [[ "${LOCALMYSQLSERVER}" = "true" ]] || [[ "${DATABASEEXISTS}" = "false" ]] ; then
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Create Remote MySQL Database" --msgbox "This script can attempt to create the MySQL database for you.\nYou will now be asked for the credentials for a MySQL user who has the ability to create a database on the MySQL server." 9 78
DATABASEADMINUSER_TITLE="MySQL Administrator User"
while [ -z "$DATABASEADMINUSER" ]; do
DATABASEADMINUSER=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINUSER_TITLE" --nocancel --inputbox "\nEnter the MySQL administrator user." 8 78 "root" 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINUSER}" ]] ; do
DATABASEADMINUSER=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINUSER_TITLE}" --nocancel --inputbox "\nEnter the MySQL administrator user." 8 78 "root" 3>&1 1>&2 2>&3)
DATABASEADMINUSER_TITLE="MySQL Administrator User (REQUIRED)"
done
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
DATABASEADMINPASSWORD1_MESSAGE="\nEnter the password for the MySQL adminitrator user."
while [ -z "$DATABASEADMINPASSWORD1" ]; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD1_TITLE" --nocancel --passwordbox "$DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
done
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
DATABASEADMINPASSWORD2_MESSAGE="\nConfirm the password for the MySQL adminitrator user."
while [ -z "$DATABASEADMINPASSWORD2" ]; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD2_TITLE" --nocancel --passwordbox "$DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
done
while [ ! $DATABASEADMINPASSWORD1 = $DATABASEADMINPASSWORD2 ]; do
while [[ ! "${DATABASEADMINPASSWORD1}" = "${DATABASEADMINPASSWORD2}" ]] ; do
DATABASEADMINPASSWORD1=""
DATABASEADMINPASSWORD2=""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
while [ -z "$DATABASEADMINPASSWORD1" ]; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD1_TITLE" --nocancel --passwordbox "DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
done
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
while [ -z "$DATABASEADMINPASSWORD2" ]; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD2_TITLE" --nocancel --passwordbox "DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
done
done
fi
# Get the login information pertaining to the MySQL database itself.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Create Remote MySQL Database" --msgbox "You will now be asked to supply the name of the database which will store the portal data as well as the login credentials for the MySQL user that has access to this database." 9 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Create Remote MySQL Database" --msgbox "You will now be asked to supply the name of the database which will store the portal data as well as the login credentials for the MySQL user that has access to this database." 9 78
DATABASENAME_TITLE="ADS-B Receiver Portal Database Name"
while [ -z "$DATABASENAME" ]; do
DATABASENAME=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASENAME_TITLE" --nocancel --inputbox "\nEnter your ADS-B Receiver Portal database name." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASENAME}" ]] ; do
DATABASENAME=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASENAME_TITLE}" --nocancel --inputbox "\nEnter your ADS-B Receiver Portal database name." 8 78 3>&1 1>&2 2>&3)
DATABASENAME_TITLE="ADS-B Receiver Portal Database Name (REQUIRED)"
done
DATABASEUSER_TITLE="ADS-B Receiver Portal Database User"
while [ -z "$DATABASEUSER" ]; do
DATABASEUSER=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEUSER_TITLE" --nocancel --inputbox "\nEnter the user for the ADS-B Receiver Portal database." 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEUSER}" ]] ; do
DATABASEUSER=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEUSER_TITLE}" --nocancel --inputbox "\nEnter the user for the ADS-B Receiver Portal database." 8 78 3>&1 1>&2 2>&3)
DATABASEUSER_TITLE="ADS-B Receiver Portal Database User (REQUIRED)"
done
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password"
DATABASEPASSWORD1_MESSAGE="\nEnter your ADS-B Receiver Portal database password."
while [ -z "$DATABASEPASSWORD1" ]; do
DATABASEPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEPASSWORD1_TITLE" --nocancel --passwordbox "$DATABASEPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEPASSWORD1}" ]] ; do
DATABASEPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password (REQUIRED)"
done
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password"
DATABASEPASSWORD2_MESSAGE="\nConfirm your ADS-B Receiver Portal database password."
while [ -z "$DATABASEPASSWORD2" ]; do
DATABASEPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEPASSWORD2_TITLE" --nocancel --passwordbox "$DATABASEPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEPASSWORD2}" ]] ; do
DATABASEPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password (REQUIRED)"
done
while [ ! $DATABASEPASSWORD1 = $DATABASEPASSWORD2 ]; do
while [[ ! "${DATABASEPASSWORD1}" = "${DATABASEPASSWORD2}" ]] ; do
DATABASEPASSWORD1=""
DATABASEPASSWORD2=""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password"
while [ -z "$DATABASEPASSWORD1" ]; do
DATABASEPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEPASSWORD1_TITLE" --nocancel --passwordbox "$DATABASEPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEPASSWORD1}" ]] ; do
DATABASEPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEPASSWORD1_TITLE="ADS-B Receiver Portal Password (REQUIRED)"
done
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password"
while [ -z "$DATABASEPASSWORD2" ]; do
DATABASEPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEPASSWORD2_TITLE" --nocancel --passwordbox "$DATABASEPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEPASSWORD2}" ]] ; do
DATABASEPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEPASSWORD2_TITLE="Confirm The ADS-B Receiver Portal Password (REQUIRED)"
done
done
@ -245,9 +245,9 @@ CheckPackage libpython2.7
# Check if this is Ubuntu 16.04 LTS.
# This needs optimized and made to recognize releases made after 16.04 as well.
if [ -f /etc/lsb-release ]; then
if [[ -f "/etc/lsb-release" ]] ; then
. /etc/lsb-release
if [ "$DISTRIB_ID" = "Ubuntu" ] && [ "$DISTRIB_RELEASE" = "16.04" ]; then
if [[ "${DISTRIB_ID}" = "Ubuntu" ]] && [[ "${DISTRIB_RELEASE}" = "16.04" ]] ; then
CheckPackage php7.0-cgi
CheckPackage php7.0-xml
else
@ -260,18 +260,18 @@ else
fi
# Install packages needed for advanced portal setups.
if [ "$ADVANCED" = "true" ]; then
if [[ "${ADVANCED}" = "true" ]] ; then
CheckPackage python-pyinotify
case $DATABASEENGINE in
case ${DATABASEENGINE} in
"MySQL")
CheckPackage mysql-client
CheckPackage python-mysqldb
# Check if this is Ubuntu 16.04 LTS.
# This needs optimized and made to recognize releases made after 16.04 as well.
if [ -f /etc/lsb-release ]; then
if [[ -f "/etc/lsb-release" ]] ; then
. /etc/lsb-release
if [ "$DISTRIB_ID" = "Ubuntu" ] && [ "$DISTRIB_RELEASE" = "16.04" ]; then
if [[ "${DISTRIB_ID}" = "Ubuntu" ]] && [[ "${DISTRIB_RELEASE}" = "16.04" ]] ; then
CheckPackage php7.0-mysql
else
CheckPackage php5-mysql
@ -285,9 +285,9 @@ if [ "$ADVANCED" = "true" ]; then
# Check if this is Ubuntu 16.04 LTS.
# This needs optimized and made to recognize releases made after 16.04 as well.
if [ -f /etc/lsb-release ]; then
if [[ -f "/etc/lsb-release" ]] ; then
. /etc/lsb-release
if [ "$DISTRIB_ID" = "Ubuntu" ] && [ "$DISTRIB_RELEASE" = "16.04" ]; then
if [[ "${DISTRIB_ID}" = "Ubuntu" ]] && [[ "${DISTRIB_RELEASE}" = "16.04" ]] ; then
CheckPackage php7.0-sqlite
else
CheckPackage php5-sqlite
@ -311,59 +311,59 @@ echo -e "\e[95m Setting up the web portal...\e[97m"
echo -e ""
# If this is an existing Lite installation being upgraded backup the XML data files.
if [ "$PORTALINSTALLED" = "true" ] && [ "$ADVANCED" = "false" ]; then
echo -e "\e[94m Backing up the file $LIGHTTPDDOCUMENTROOT/data/administrators.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/administrators.xml $LIGHTTPDDOCUMENTROOT/data/administrators.backup.xml
echo -e "\e[94m Backing up the file $LIGHTTPDDOCUMENTROOT/data/blogPosts.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/blogPosts.xml $LIGHTTPDDOCUMENTROOT/data/blogPosts.backup.xml
echo -e "\e[94m Backing up the file $LIGHTTPDDOCUMENTROOT/data/flightNotifications.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/flightNotifications.xml $LIGHTTPDDOCUMENTROOT/data/flightNotifications.backup.xml
echo -e "\e[94m Backing up the file $LIGHTTPDDOCUMENTROOT/data/settings.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/settings.xml $LIGHTTPDDOCUMENTROOT/data/settings.backup.xml
if [[ "${PORTALINSTALLED}" = "true" ]] && [[ "${ADVANCED}" = "false" ]] ; then
echo -e "\e[94m Backing up the file ${LIGHTTPDDOCUMENTROOT}/data/administrators.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/administrators.xml ${LIGHTTPDDOCUMENTROOT}/data/administrators.backup.xml
echo -e "\e[94m Backing up the file ${LIGHTTPDDOCUMENTROOT}/data/blogPosts.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/blogPosts.xml ${LIGHTTPDDOCUMENTROOT}/data/blogPosts.backup.xml
echo -e "\e[94m Backing up the file ${LIGHTTPDDOCUMENTROOT}/data/flightNotifications.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/flightNotifications.xml ${LIGHTTPDDOCUMENTROOT}/data/flightNotifications.backup.xml
echo -e "\e[94m Backing up the file ${LIGHTTPDDOCUMENTROOT}/data/settings.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/settings.xml ${LIGHTTPDDOCUMENTROOT}/data/settings.backup.xml
fi
echo -e "\e[94m Placing portal files in Lighttpd's root directory...\e[97m"
sudo cp -R $PORTALBUILDDIRECTORY/html/* $LIGHTTPDDOCUMENTROOT
sudo cp -R ${PORTALBUILDDIRECTORY}/html/* ${LIGHTTPDDOCUMENTROOT}
# If this is an existing installation being upgraded restore the original XML data files.
if [ "$PORTALINSTALLED" = "true" ] && [ "$ADVANCED" = "false" ]; then
echo -e "\e[94m Restoring the backup copy of the file $LIGHTTPDDOCUMENTROOT/data/administrators.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/administrators.backup.xml $LIGHTTPDDOCUMENTROOT/data/administrators.xml
echo -e "\e[94m Restoring the backup copy of the file $LIGHTTPDDOCUMENTROOT/data/blogPosts.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/blogPosts.backup.xml $LIGHTTPDDOCUMENTROOT/data/blogPosts.xml
echo -e "\e[94m Restoring the backup copy of the file $LIGHTTPDDOCUMENTROOT/data/flightNotifications.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/flightNotifications.backup.xml $LIGHTTPDDOCUMENTROOT/data/flightNotifications.xml
echo -e "\e[94m Restoring the backup copy of the file $LIGHTTPDDOCUMENTROOT/data/settings.xml...\e[97m"
sudo mv $LIGHTTPDDOCUMENTROOT/data/settings.backup.xml $LIGHTTPDDOCUMENTROOT/data/settings.xml
if [[ "${PORTALINSTALLED}" = "true" ]] && [[ "${ADVANCED}" = "false" ]] ; then
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPDDOCUMENTROOT}/data/administrators.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/administrators.backup.xml ${LIGHTTPDDOCUMENTROOT}/data/administrators.xml
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPDDOCUMENTROOT}/data/blogPosts.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/blogPosts.backup.xml ${LIGHTTPDDOCUMENTROOT}/data/blogPosts.xml
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPDDOCUMENTROOT}/data/flightNotifications.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/flightNotifications.backup.xml ${LIGHTTPDDOCUMENTROOT}/data/flightNotifications.xml
echo -e "\e[94m Restoring the backup copy of the file ${LIGHTTPDDOCUMENTROOT}/data/settings.xml...\e[97m"
sudo mv ${LIGHTTPDDOCUMENTROOT}/data/settings.backup.xml ${LIGHTTPDDOCUMENTROOT}/data/settings.xml
fi
# Set the proper permissions on certain portal directories.
echo -e "\e[94m Making the directory $LIGHTTPDDOCUMENTROOT/graphs/ writable...\e[97m"
sudo chmod 777 $LIGHTTPDDOCUMENTROOT/graphs/
echo -e "\e[94m Making the directory $LIGHTTPDDOCUMENTROOT/classes/ writable...\e[97m"
sudo chmod 777 $LIGHTTPDDOCUMENTROOT/classes/
echo -e "\e[94m Making the directory $LIGHTTPDDOCUMENTROOT/data/ writable...\e[97m"
sudo chmod 777 $LIGHTTPDDOCUMENTROOT/data/
echo -e "\e[94m Making the files contained within the directory $LIGHTTPDDOCUMENTROOT/data/ writable...\e[97m"
sudo chmod 666 $LIGHTTPDDOCUMENTROOT/data/*
echo -e "\e[94m Making the directory ${LIGHTTPDDOCUMENTROOT}/graphs/ writable...\e[97m"
sudo chmod 777 ${LIGHTTPDDOCUMENTROOT}/graphs/
echo -e "\e[94m Making the directory ${LIGHTTPDDOCUMENTROOT}/classes/ writable...\e[97m"
sudo chmod 777 ${LIGHTTPDDOCUMENTROOT}/classes/
echo -e "\e[94m Making the directory ${LIGHTTPDDOCUMENTROOT}/data/ writable...\e[97m"
sudo chmod 777 ${LIGHTTPDDOCUMENTROOT}/data/
echo -e "\e[94m Making the files contained within the directory ${LIGHTTPDDOCUMENTROOT}/data/ writable...\e[97m"
sudo chmod 666 ${LIGHTTPDDOCUMENTROOT}/data/*
# Check if dump978 was setup.
echo -e "\e[94m Checking if dump978 was set up...\e[97m"
if ! grep -q "$BUILDDIRECTORY/dump978/dump978-maint.sh &" /etc/rc.local; then
if [[ `grep -cFx "${BUILDDIRECTORY}/dump978/dump978-maint.sh &" /etc/rc.local` -eq 0 ]] ; then
# Check if a heywhatsthat.com range file exists in the dump1090 HTML folder.
echo -e "\e[94m Checking for the file upintheair.json in the dump1090 HTML folder...\e[97m"
if [ -f /usr/share/dump1090-mutability/html/upintheair.json ] || [ -f /usr/share/dump1090-fa/html/upintheair.json ]; then
if [[ -f "/usr/share/dump1090-mutability/html/upintheair.json" ]] || [[ -f "/usr/share/dump1090-fa/html/upintheair.json" ]] ; then
echo -e "\e[94m Copying the file upintheair.json from the dump1090 HTML folder to the dump978 HTML folder...\e[97m"
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
sudo cp /usr/share/dump1090-mutability/html/upintheair.json $LIGHTTPDDOCUMENTROOT/dump978/
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
sudo cp /usr/share/dump1090-mutability/html/upintheair.json ${LIGHTTPDDOCUMENTROOT}/dump978/
fi
if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
sudo cp /usr/share/dump1090-fa/html/upintheair.json $LIGHTTPDDOCUMENTROOT/dump978/
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
sudo cp /usr/share/dump1090-fa/html/upintheair.json ${LIGHTTPDDOCUMENTROOT}/dump978/
fi
fi
fi
if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
echo -e "\e[94m Removing conflicting redirects from the Lighttpd dump1090.conf file...\e[97m"
# Remove this line completely.
sudo sed -i "/$(echo ' "^/dump1090$" => "/dump1090/gmap.html"' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/d" /etc/lighttpd/conf-available/89-dump1090.conf
@ -373,11 +373,11 @@ fi
# Add to the Lighttpd configuration.
echo -e "\e[94m Adding the Lighttpd portal configuration file...\e[97m"
if [ -f /etc/lighttpd/conf-available/89-adsb-portal.conf ]; then
if [[ -f "/etc/lighttpd/conf-available/89-adsb-portal.conf" ]] ; then
sudo rm -f /etc/lighttpd/conf-available/89-adsb-portal.conf
fi
sudo touch /etc/lighttpd/conf-available/89-adsb-portal.conf
if [ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
sudo tee -a /etc/lighttpd/conf-available/89-adsb-portal.conf > /dev/null <<EOF
# Add dump1090 as an alias to the dump1090-fa HTML folder.
alias.url += (
@ -404,12 +404,12 @@ sudo tee -a /etc/lighttpd/conf-available/89-adsb-portal.conf > /dev/null <<EOF
}
EOF
if ! [ -L /etc/lighttpd/conf-enabled/89-adsb-portal.conf ]; then
if ! [[ -L /etc/lighttpd/conf-enabled/89-adsb-portal.conf ]] ; then
echo -e "\e[94m Enabling the Lighttpd portal configuration file...\e[97m"
sudo ln -s /etc/lighttpd/conf-available/89-adsb-portal.conf /etc/lighttpd/conf-enabled/89-adsb-portal.conf
fi
if [ "$PORTALINSTALLED" = "false" ]; then
if [[ "${PORTALINSTALLED}" = "false" ]] ; then
echo -e "\e[94m Enabling the Lighttpd fastcgi-php module...\e[97m"
echo -e ""
sudo lighty-enable-mod fastcgi-php
@ -429,44 +429,44 @@ fi
## SETUP THE MYSQL DATABASE
if [ "$PORTALINSTALLED" = "false" ] && [ "$ADVANCED" = "true" ] && [ "$DATABASEENGINE" = "MySQL" ] && [ "$DATABASEEXISTS" = "false" ]; then
if [[ "${PORTALINSTALLED}" = "false" ]] && [[ "${ADVANCED}" = "true" ]] && [[ "${DATABASEENGINE}" = "MySQL" ]] && [[ "${DATABASEEXISTS}" = "false" ]] ; then
# Attempt to login with the supplied MySQL administrator credentials.
echo -e "\e[94m Attempting to log into the MySQL server using the supplied administrator credentials...\e[97m"
while ! mysql -u$DATABASEADMINUSER -p$DATABASEADMINPASSWORD1 -h $DATABASEHOSTNAME -e ";" ; do
while ! mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${DATABASEHOSTNAME} -e ";" ; do
echo -e "\e[94m Unable to log into the MySQL server using the supplied administrator credentials...\e[97m"
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Create Remote MySQL Database" --msgbox "The script was not able to log into the MySQL server using the administrator credentials you supplied. You will now be asked to reenter the MySQL server administrator credentials." 9 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Create Remote MySQL Database" --msgbox "The script was not able to log into the MySQL server using the administrator credentials you supplied. You will now be asked to reenter the MySQL server administrator credentials." 9 78
DATABASEADMINPASSWORD1=""
DATABASEADMINPASSWORD2=""
DATABASEADMINUSER_TITLE="MySQL Administrator User"
while [ -z "$DATABASEADMINUSER" ]; do
DATABASEADMINUSER=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINUSER_TITLE" --nocancel --inputbox "\nEnter the MySQL administrator user." 8 78 "$DATABASEADMINUSER" 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINUSER}" ]] ; do
DATABASEADMINUSER=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINUSER_TITLE}" --nocancel --inputbox "\nEnter the MySQL administrator user." 8 78 "${DATABASEADMINUSER}" 3>&1 1>&2 2>&3)
DATABASEADMINUSER_TITLE="MySQL Administrator User (REQUIRED)"
done
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
DATABASEADMINPASSWORD1_MESSAGE="\nEnter the password for the MySQL adminitrator user."
while [ -z "$DATABASEADMINPASSWORD1" ]; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD1_TITLE" --nocancel --passwordbox "$DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD1_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
done
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
DATABASEADMINPASSWORD2_MESSAGE="\nConfirm the password for the MySQL adminitrator user."
while [ -z "$DATABASEADMINPASSWORD2" ]; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD2_TITLE" --nocancel --passwordbox "$DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "${DATABASEADMINPASSWORD2_MESSAGE}" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
done
while [ ! $DATABASEADMINPASSWORD1 = $DATABASEADMINPASSWORD2 ]; do
while [[ ! "${DATABASEADMINPASSWORD1}" = "${DATABASEADMINPASSWORD2}" ]] ; do
DATABASEADMINPASSWORD1=""
DATABASEADMINPASSWORD2=""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Passwords Did Not Match" --msgbox "Passwords did not match.\nPlease enter your password again." 9 78
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password"
while [ -z "$DATABASEADMINPASSWORD1" ]; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD1_TITLE" --nocancel --passwordbox "DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD1}" ]] ; do
DATABASEADMINPASSWORD1=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD1_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD1_MESSAGE" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD1_TITLE="MySQL Administrator Password (REQUIRED)"
done
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password"
while [ -z "$DATABASEADMINPASSWORD2" ]; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$DATABASEADMINPASSWORD2_TITLE" --nocancel --passwordbox "DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
while [[ -z "${DATABASEADMINPASSWORD2}" ]] ; do
DATABASEADMINPASSWORD2=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "${DATABASEADMINPASSWORD2_TITLE}" --nocancel --passwordbox "DATABASEADMINPASSWORD2_MESSAGE" 8 78 3>&1 1>&2 2>&3)
DATABASEADMINPASSWORD2_TITLE="Confirm The MySQL Administrator Password (REQUIRED)"
done
done
@ -474,21 +474,21 @@ if [ "$PORTALINSTALLED" = "false" ] && [ "$ADVANCED" = "true" ] && [ "$DATABASEE
done
# Create the database use and database using the information supplied by the user.
echo -e "\e[94m Creating the MySQL database \"$DATABASENAME\"...\e[97m"
mysql -u$DATABASEADMINUSER -p$DATABASEADMINPASSWORD1 -h $DATABASEHOSTNAME -e "CREATE DATABASE $DATABASENAME;"
echo -e "\e[94m Creating the MySQL user \"$DATABASEUSER\"...\e[97m"
mysql -u$DATABASEADMINUSER -p$DATABASEADMINPASSWORD1 -h $DATABASEHOSTNAME -e "CREATE USER '$DATABASEUSER'@'localhost' IDENTIFIED BY \"$DATABASEPASSWORD1\";"
echo -e "\e[94m Granting priviledges on the MySQL database \"DATABASENAME\" to the user \"$DATABASEUSER\"...\e[97m"
mysql -u$DATABASEADMINUSER -p$DATABASEADMINPASSWORD1 -h $DATABASEHOSTNAME -e "GRANT ALL PRIVILEGES ON $DATABASENAME.* TO '$DATABASEUSER'@'localhost';"
echo -e "\e[94m Creating the MySQL database \"${DATABASENAME}\"...\e[97m"
mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${DATABASEHOSTNAME} -e "CREATE DATABASE ${DATABASENAME};"
echo -e "\e[94m Creating the MySQL user \"${DATABASEUSER}\"...\e[97m"
mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${DATABASEHOSTNAME} -e "CREATE USER '${DATABASEUSER}'@'localhost' IDENTIFIED BY \"${DATABASEPASSWORD1}\";"
echo -e "\e[94m Granting priviledges on the MySQL database \"DATABASENAME\" to the user \"${DATABASEUSER}\"...\e[97m"
mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${DATABASEHOSTNAME} -e "GRANT ALL PRIVILEGES ON ${DATABASENAME}.* TO '${DATABASEUSER}'@'localhost';"
echo -e "\e[94m Flushing priviledges on the MySQL database server...\e[97m"
mysql -u$DATABASEADMINUSER -p$DATABASEADMINPASSWORD1 -h $DATABASEHOSTNAME -e "FLUSH PRIVILEGES;"
mysql -u${DATABASEADMINUSER} -p${DATABASEADMINPASSWORD1} -h ${DATABASEHOSTNAME} -e "FLUSH PRIVILEGES;"
fi
## SETUP THE PERFORMANCE GRAPHS USING THE SCRIPT GRAPHS.SH
chmod +x $BASHDIRECTORY/portal/graphs.sh
$BASHDIRECTORY/portal/graphs.sh
if [ $? -ne 0 ]; then
chmod +x ${BASHDIRECTORY}/portal/graphs.sh
${BASHDIRECTORY}/portal/graphs.sh
if [[ $? -ne 0 ]] ; then
echo -e ""
echo -e "\e[91m THE SCRIPT GRAPHS.SH ENCOUNTERED AN ERROR"
echo -e ""
@ -498,12 +498,12 @@ fi
## SETUP COMMON PORTAL FEATURES
# Export variables needed by logging.sh.
if [ "$DATABASEENGINE" = "MySQL" ] || [ "$DATABASEENGINE" = "SQLite" ]; then
export ADSB_DATABASEENGINE=$DATABASEENGINE
export ADSB_DATABASEHOSTNAME=$DATABASEHOSTNAME
export ADSB_DATABASEUSER=$DATABASEUSER
export ADSB_DATABASEPASSWORD1=$DATABASEPASSWORD1
export ADSB_DATABASENAME=$DATABASENAME
if [[ "${DATABASEENGINE}" = "MySQL" ]] || [[ "${DATABASEENGINE}" = "SQLite" ]] ; then
export ADSB_DATABASEENGINE=${DATABASEENGINE}
export ADSB_DATABASEHOSTNAME=${DATABASEHOSTNAME}
export ADSB_DATABASEUSER=${DATABASEUSER}
export ADSB_DATABASEPASSWORD1=${DATABASEPASSWORD1}
export ADSB_DATABASENAME=${DATABASENAME}
else
export ADSB_DATABASEENGINE="xml"
export ADSB_DATABASEHOSTNAME=""
@ -513,9 +513,9 @@ else
fi
# Execute the core setup script.
chmod +x $BASHDIRECTORY/portal/core.sh
$BASHDIRECTORY/portal/core.sh
if [ $? -ne 0 ]; then
chmod +x ${BASHDIRECTORY}/portal/core.sh
${BASHDIRECTORY}/portal/core.sh
if [[ $? -ne 0 ]] ; then
echo -e ""
echo -e " \e[91m THE SCRIPT CORE.SH ENCOUNTERED AN ERROR"
echo -e ""
@ -524,15 +524,15 @@ fi
## SETUP ADVANCED PORTAL FEATURES
if [ "$ADVANCED" = "true" ]; then
# If SQLite is being used and the path is not already set to the variable $DATABASENAME set it to the default path.
if [ "$DATABASEENGINE" = "SQLite" ] && [ -z "$DATABASENAME" ]; then
$DATABASENAME="$LIGHTTPDDOCUMENTROOT/data/portal.sqlite"
if [[ "${ADVANCED}" = "true" ]] ; then
# If SQLite is being used and the path is not already set to the variable ${DATABASENAME} set it to the default path.
if [[ "${DATABASEENGINE}" = "SQLite" ]] && [[ -z "${DATABASENAME}" ]] ; then
${DATABASENAME}="${LIGHTTPDDOCUMENTROOT}/data/portal.sqlite"
fi
chmod +x $BASHDIRECTORY/portal/logging.sh
$BASHDIRECTORY/portal/logging.sh
if [ $? -ne 0 ]; then
chmod +x ${BASHDIRECTORY}/portal/logging.sh
${BASHDIRECTORY}/portal/logging.sh
if [[ $? -ne 0 ]] ; then
echo -e ""
echo -e " \e[91m THE SCRIPT LOGGING.SH ENCOUNTERED AN ERROR"
echo -e ""
@ -553,7 +553,7 @@ unset ADSB_DATABASENAME
IPADDRESS=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'`
# Display final portal setup instructions to the user.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "ADS-B Receiver Project Portal Setup" --msgbox "NOTE THAT PORTAL SETUP IS NOT YET COMPLETE!\n\nIn order to complete the portal setup process visit the following URL in your favorite web browser.\n\nhttp://${IPADDRESS}/install/\n\nFollow the instructions and enter the requested information to complete the ADS-B Receiver Project Portal setup." 12 78
whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "ADS-B Receiver Project Portal Setup" --msgbox "NOTE THAT PORTAL SETUP IS NOT YET COMPLETE!\n\nIn order to complete the portal setup process visit the following URL in your favorite web browser.\n\nhttp://${IPADDRESS}/install/\n\nFollow the instructions and enter the requested information to complete the ADS-B Receiver Project Portal setup." 12 78
### SETUP COMPLETE
@ -565,7 +565,7 @@ echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m ADS-B Receiver Project Portal setup is complete.\e[39m"
echo -e ""
if [[ ${RECEIVER_AUTOMATED_INSTALL} = "false" ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -33,10 +33,10 @@
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
PORTALBUILDDIRECTORY="$BUILDDIRECTORY/portal"
PORTALPYTHONDIRECTORY="$PORTALBUILDDIRECTORY/python"
PROJECTROOTDIRECTORY="${PWD}"
BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build"
PORTALBUILDDIRECTORY="${BUILDDIRECTORY}/portal"
PORTALPYTHONDIRECTORY="${PORTALBUILDDIRECTORY}/python"
PYTHONPATH=`which python`
## SETUP FLIGHT LOGGING
@ -47,71 +47,71 @@ echo -e ""
# Create and set permissions on the flight logging and maintenance maintenance scripts.
echo -e "\e[94m Creating the flight logging maintenance script...\e[97m"
tee $PORTALPYTHONDIRECTORY/flights-maint.sh > /dev/null <<EOF
tee ${PORTALPYTHONDIRECTORY}/flights-maint.sh > /dev/null <<EOF
#!/bin/bash
while true
do
sleep 30
$PYTHONPATH $PORTALPYTHONDIRECTORY/flights.py
${PYTHONPATH} ${PORTALPYTHONDIRECTORY}/flights.py
done
EOF
echo -e "\e[94m Creating the maintenance maintenance script...\e[97m"
tee $PORTALPYTHONDIRECTORY/maintenance-maint.sh > /dev/null <<EOF
tee ${PORTALPYTHONDIRECTORY}/maintenance-maint.sh > /dev/null <<EOF
#!/bin/bash
while true
do
sleep 30
$PYTHONPATH $PORTALPYTHONDIRECTORY/maintenance.py
${PYTHONPATH} ${PORTALPYTHONDIRECTORY}/maintenance.py
done
EOF
echo -e "\e[94m Making the flight logging maintenance script executable...\e[97m"
chmod +x $PORTALPYTHONDIRECTORY/flights-maint.sh
chmod +x ${PORTALPYTHONDIRECTORY}/flights-maint.sh
echo -e "\e[94m Making the maintenance maintenance script executable...\e[97m"
chmod +x $PORTALPYTHONDIRECTORY/maintenance-maint.sh
chmod +x ${PORTALPYTHONDIRECTORY}/maintenance-maint.sh
#Remove old flights-maint.sh start up line from /etc/rc.local.
sudo sed -i '/build\/portal\/logging\/flights-maint.sh/d' /etc/rc.local
# Add flight logging maintenance script to rc.local.
if [[ `grep -cFx "$PORTALPYTHONDIRECTORY/flights-maint.sh &" /etc/rc.local` -eq 0 ]] ; then
if [[ `grep -cFx "${PORTALPYTHONDIRECTORY}/flights-maint.sh &" /etc/rc.local` -eq 0 ]] ; then
echo -e "\e[94m Adding the flight logging maintenance script startup line to /etc/rc.local...\e[97m"
LINENUMBER=($(sed -n '/exit 0/=' /etc/rc.local))
((LINENUMBER>0)) && sudo sed -i "${LINENUMBER[$((${#LINENUMBER[@]}-1))]}i $PORTALPYTHONDIRECTORY/flights-maint.sh &\n" /etc/rc.local
((LINENUMBER>0)) && sudo sed -i "${LINENUMBER[$((${#LINENUMBER[@]}-1))]}i ${PORTALPYTHONDIRECTORY}/flights-maint.sh &\n" /etc/rc.local
fi
# Remove old maintenance-maint.sh start up line from /etc/rc.local.
sudo sed -i '/build\/portal\/logging\/maintenance-maint.sh/d' /etc/rc.local
# Add maintenance maintenance script to rc.local.
if [[ `grep -cFx "$PORTALPYTHONDIRECTORY/maintenance-maint.sh &" /etc/rc.local` -eq 0 ]] ; then
if [[ `grep -cFx "${PORTALPYTHONDIRECTORY}/maintenance-maint.sh &" /etc/rc.local` -eq 0 ]] ; then
echo -e "\e[94m Adding the maintenance maintenance script startup line to /etc/rc.local...\e[97m"
LINENUMBER=($(sed -n '/exit 0/=' /etc/rc.local))
((LINENUMBER>0)) && sudo sed -i "${LINENUMBER[$((${#LINENUMBER[@]}-1))]}i $PORTALPYTHONDIRECTORY/maintenance-maint.sh &\n" /etc/rc.local
((LINENUMBER>0)) && sudo sed -i "${LINENUMBER[$((${#LINENUMBER[@]}-1))]}i ${PORTALPYTHONDIRECTORY}/maintenance-maint.sh &\n" /etc/rc.local
fi
# Kill any previously running maintenance scripts.
echo -e "\e[94m Checking for any running flights-maint.sh processes...\e[97m"
PIDS=`ps -efww | grep -w "flights-maint.sh" | awk -vpid=$$ '$2 != pid { print $2 }'`
if [ -n "$PIDS" ]; then
if [[ -n "${PIDS}" ]] ; then
echo -e "\e[94m Killing any running flights-maint.sh processes...\e[97m"
sudo kill $PIDS
sudo kill -9 $PIDS
sudo kill ${PIDS}
sudo kill -9 ${PIDS}
fi
PIDS=`ps -efww | grep -w "maintenance-maint.sh" | awk -vpid=$$ '$2 != pid { print $2 }'`
if [ -n "$PIDS" ]; then
if [[ -n "${PIDS}" ]] ; then
echo -e "\e[94m Killing any running maintenance-maint.sh processes...\e[97m"
sudo kill $PIDS
sudo kill -9 $PIDS
sudo kill ${PIDS}
sudo kill -9 ${PIDS}
fi
# Start flight logging.
echo -e "\e[94m Executing the flight logging maintenance script...\e[97m"
nohup $PORTALPYTHONDIRECTORY/flights-maint.sh > /dev/null 2>&1 &
nohup ${PORTALPYTHONDIRECTORY}/flights-maint.sh > /dev/null 2>&1 &
# Start maintenance.
echo -e "\e[94m Executing the maintenance maintenance script...\e[97m"
nohup $PORTALPYTHONDIRECTORY/maintenance-maint.sh > /dev/null 2>&1 &
nohup ${PORTALPYTHONDIRECTORY}/maintenance-maint.sh > /dev/null 2>&1 &
exit 0

Wyświetl plik

@ -46,14 +46,14 @@ clear
## VARIABLES
PROJECTROOTDIRECTORY="$PWD"
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
PROJECTROOTDIRECTORY="${PWD}"
BASHDIRECTORY="${PROJECTROOTDIRECTORY}/bash"
BUILDDIRECTORY="${PROJECTROOTDIRECTORY}/build"
## INCLUDE EXTERNAL SCRIPTS
source $BASHDIRECTORY/variables.sh
source $BASHDIRECTORY/functions.sh
source ${BASHDIRECTORY}/variables.sh
source ${BASHDIRECTORY}/functions.sh
echo -e ""
echo -e "\e[91m The ADS-B Receiver Project Image Preparation Script\e[97m"
@ -84,9 +84,9 @@ CheckPackage lighttpd
CheckPackage fakeroot
# Ask which version of dump1090 to install.
DUMP1090OPTION=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Choose Dump1090 Version" --menu "Which version of dump1090 is to be installed?" 12 65 2 "dump1090-mutability" "(Mutability)" "dump1090-fa" "(FlightAware)" 3>&1 1>&2 2>&3)
DUMP1090OPTION=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --title "Choose Dump1090 Version" --menu "Which version of dump1090 is to be installed?" 12 65 2 "dump1090-mutability" "(Mutability)" "dump1090-fa" "(FlightAware)" 3>&1 1>&2 2>&3)
case $DUMP1090OPTION in
case ${DUMP1090OPTION} in
"dump1090-mutability")
echo -e "\e[95m Installing dump1090-mutability...\e[97m"
echo -e ""
@ -95,12 +95,12 @@ case $DUMP1090OPTION in
echo -e ""
echo -e "\e[95m Installing dump1090-mutability...\e[97m"
echo -e ""
mkdir -p $BUILDDIRECTORY/dump1090-mutability
cd $BUILDDIRECTORY/dump1090-mutability
mkdir -p ${BUILDDIRECTORY}/dump1090-mutability
cd ${BUILDDIRECTORY}/dump1090-mutability
git clone https://github.com/mutability/dump1090.git
cd $BUILDDIRECTORY/dump1090-mutability/dump1090
cd ${BUILDDIRECTORY}/dump1090-mutability/dump1090
dpkg-buildpackage -b
cd $BUILDDIRECTORY/dump1090-mutability
cd ${BUILDDIRECTORY}/dump1090-mutability
sudo dpkg -i dump1090-mutability_1.15~dev_*.deb
;;
"dump1090-fa")
@ -126,22 +126,22 @@ case $DUMP1090OPTION in
echo -e ""
echo -e "\e[95m Installing dump1090-fa...\e[97m"
echo -e ""
mkdir -p $BUILDDIRECTORY/dump1090-fa
cd $BUILDDIRECTORY/dump1090-fa
mkdir -p ${BUILDDIRECTORY}/dump1090-fa
cd ${BUILDDIRECTORY}/dump1090-fa
git clone https://github.com/flightaware/dump1090.git
cd $BUILDDIRECTORY/dump1090-fa/dump1090
cd ${BUILDDIRECTORY}/dump1090-fa/dump1090
dpkg-buildpackage -b
cd $BUILDDIRECTORY/dump1090-fa
cd ${BUILDDIRECTORY}/dump1090-fa
sudo dpkg -i dump1090-fa_*.deb
# PiAware
cd $BUILDDIRECTORY
cd ${BUILDDIRECTORY}
git clone https://github.com/flightaware/piaware_builder.git
cd $BUILDDIRECTORY/piaware_builder
cd ${BUILDDIRECTORY}/piaware_builder
./sensible-build.sh jessie
cd $BUILDDIRECTORY/piaware_builder/package-jessie
cd ${BUILDDIRECTORY}/piaware_builder/package-jessie
dpkg-buildpackage -b
sudo dpkg -i $BUILDDIRECTORY/piaware_builder/piaware_*.deb
sudo dpkg -i ${BUILDDIRECTORY}/piaware_builder/piaware_*.deb
;;
*)
# Nothing selected.
@ -238,7 +238,7 @@ echo -e ""
## TOUCH THE IMAGE FILE
echo -e "\e[95m Touching the \"image\" file...\e[97m"
cd $PROJECTROOTDIRECTORY
cd ${PROJECTROOTDIRECTORY}
touch image
## CLEAR BASH HISTORY

Wyświetl plik

@ -36,11 +36,11 @@
## VARIABLES
BACKUPDATE=$(date +"%Y-%m-%d-%H%M%S")
PROJECTROOTDIRECTORY="$PWD"
BACKUPSDIRECTORY="$PROJECTROOTDIRECTORY/backups"
TEMPORARYDIRECTORY="$PROJECTROOTDIRECTORY/backup_$BACKUPDATE"
PROJECTROOTDIRECTORY="${PWD}"
BACKUPSDIRECTORY="${PROJECTROOTDIRECTORY}/backups"
TEMPORARYDIRECTORY="${PROJECTROOTDIRECTORY}/backup_${BACKUPDATE}"
RAWDOCUMENTROOT=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root`
LIGHTTPDDOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< $RAWDOCUMENTROOT`
LIGHTTPDDOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< ${RAWDOCUMENTROOT}`
## BEGIN THE BACKUP PROCESS
@ -58,81 +58,81 @@ echo -e ""
# Get the database type used.
echo -e "\e[94m Declare the database engine being used...\e[97m"
DATABASEENGINE=`grep 'db_driver' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
DATABASEENGINE=`grep 'db_driver' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
echo -e "\e[94m Declare whether or not the advnaced portal features were installed...\e[97m"
# Decide if the advanced portal features were installed or not.
echo -e "\e[94m Declare whether or not the advnaced portal features were installed...\e[97m"
if [ "$DATABASEENGINE" = "xml" ]; then
if [[ "${DATABASEENGINE}" = "xml" ]] ; then
ADVANCED=FALSE
else
ADVANCED=TRUE
fi
# Get the path to the SQLite database if SQLite is used for the database.
if [ "$DATABASEENGINE" = "sqlite" ]; then
DATABASEPATH=`grep 'db_host' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
if [[ "${DATABASEENGINE}" = "sqlite" ]] ; then
DATABASEPATH=`grep 'db_host' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
fi
# Assign the MySQL login credentials to variables if a MySQL database is being used.
if [ "$DATABASEENGINE" = "mysql" ]; then
MYSQLDATABASE=`grep 'db_database' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
MYSQLUSERNAME=`grep 'db_username' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
MYSQLPASSWORD=`grep 'db_password' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
if [[ "${DATABASEENGINE}" = "mysql" ]] ; then
MYSQLDATABASE=`grep 'db_database' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
MYSQLUSERNAME=`grep 'db_username' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
MYSQLPASSWORD=`grep 'db_password' ${LIGHTTPDDOCUMENTROOT}/classes/settings.class.php | tail -n1 | cut -d\' -f2`
fi
# Check that the backup directory exists.
echo -e "\e[94m Checking that the directory $BACKUPSDIRECTORY exists...\e[97m"
if [ ! -d "$BACKUPSDIRECTORY" ]; then
echo -e "\e[94m Checking that the directory ${BACKUPSDIRECTORY} exists...\e[97m"
if [[ ! -d "${BACKUPSDIRECTORY}" ]] ; then
# Create the backups directory.
echo -e "\e[94m Creating the directory $BACKUPSDIRECTORY...\e[97m"
mkdir -p $BACKUPSDIRECTORY
echo -e "\e[94m Creating the directory ${BACKUPSDIRECTORY}...\e[97m"
mkdir -p ${BACKUPSDIRECTORY}
fi
# Check that the temporary directory exists.
echo -e "\e[94m Checking that the directory $TEMPORARYDIRECTORY exists...\e[97m"
if [ ! -d "$TEMPORARYDIRECTORY" ]; then
echo -e "\e[94m Checking that the directory ${TEMPORARYDIRECTORY} exists...\e[97m"
if [[ ! -d "${TEMPORARYDIRECTORY}" ]] ; then
# Create the tmp directory.
echo -e "\e[94m Creating the directory $TEMPORARYDIRECTORY...\e[97m"
mkdir -p $TEMPORARYDIRECTORY
echo -e "\e[94m Creating the directory ${TEMPORARYDIRECTORY}...\e[97m"
mkdir -p ${TEMPORARYDIRECTORY}
fi
## BACKUP THE FILES COMMON TO ALL PORTAL INSTALLATION SCENARIOS
# Copy the collectd round robin database files to the temporary directory.
echo -e "\e[94m Checking that the directory $TEMPORARYDIRECTORY/var/lib/collectd/rrd/ exists...\e[97m"
if [ ! -d "$TEMPORARYDIRECTORY/var/lib/collectd/rrd/" ]; then
mkdir -p $TEMPORARYDIRECTORY/var/lib/collectd/rrd/
echo -e "\e[94m Checking that the directory ${TEMPORARYDIRECTORY}/var/lib/collectd/rrd/ exists...\e[97m"
if [[ ! -d "${TEMPORARYDIRECTORY}/var/lib/collectd/rrd/" ]] ; then
mkdir -p ${TEMPORARYDIRECTORY}/var/lib/collectd/rrd/
fi
echo -e "\e[94m Backing up the directory /var/lib/collectd/rrd/...\e[97m"
sudo cp -R /var/lib/collectd/rrd/ $TEMPORARYDIRECTORY/var/lib/collectd/rrd/
sudo cp -R /var/lib/collectd/rrd/ ${TEMPORARYDIRECTORY}/var/lib/collectd/rrd/
## BACKUP PORTAL USING LITE FEATURES AND XML FILES
if [ "$ADVANCED" = "FALSE" ]; then
if [[ "${ADVANCED}" = "FALSE" ]] ; then
# Copy the portal XML data files to the temporary directory.
echo -e "\e[94m Checking that the directory $TEMPORARYDIRECTORY/var/www/html/data/ exists...\e[97m"
if [ ! -d "$TEMPORARYDIRECTORY/var/www/html/data/" ]; then
mkdir -p $TEMPORARYDIRECTORY/var/www/html/data/
echo -e "\e[94m Checking that the directory ${TEMPORARYDIRECTORY}/var/www/html/data/ exists...\e[97m"
if [[ ! -d "${TEMPORARYDIRECTORY}/var/www/html/data/" ]] ; then
mkdir -p ${TEMPORARYDIRECTORY}/var/www/html/data/
fi
echo -e "\e[94m Backing up all XML data files to $TEMPORARYDIRECTORY/var/www/html/data/...\e[97m"
sudo cp -R /var/www/html/data/*.xml $TEMPORARYDIRECTORY/var/www/html/data/
echo -e "\e[94m Backing up all XML data files to ${TEMPORARYDIRECTORY}/var/www/html/data/...\e[97m"
sudo cp -R /var/www/html/data/*.xml ${TEMPORARYDIRECTORY}/var/www/html/data/
else
## BACKUP PORTAL USING ADVANCED FEATURES AND A SQLITE DATABASE
if [ "$DATABASEENGINE" = "sqlite" ]; then
if [[ "${DATABASEENGINE}" = "sqlite" ]] ; then
# Copy the portal SQLite database file to the temporary directory.
echo -e "\e[94m Backing up the SQLite database file to $TEMPORARYDIRECTORY/var/www/html/data/portal.sqlite...\e[97m"
sudo cp -R $DATABASEPATH $TEMPORARYDIRECTORY/var/www/html/data/portal.sqlite
echo -e "\e[94m Backing up the SQLite database file to ${TEMPORARYDIRECTORY}/var/www/html/data/portal.sqlite...\e[97m"
sudo cp -R ${DATABASEPATH} ${TEMPORARYDIRECTORY}/var/www/html/data/portal.sqlite
fi
## BACKUP PORTAL USING ADVANCED FEATURES AND A MYSQL DATABASE
if [ "$DATABASEENGINE" = "mysql" ]; then
if [[ "${DATABASEENGINE}" = "mysql" ]] ; then
# Dump the current MySQL database to a .sql text file.
echo -e "\e[94m Dumping the MySQL database $MYSQLDATABASE to the file $TEMPORARYDIRECTORY/$MYSQLDATABASE.sql...\e[97m"
mysqldump -u$MYSQLUSERNAME -p$MYSQLPASSWORD $MYSQLDATABASE > $TEMPORARYDIRECTORY/$MYSQLDATABASE.sql
echo -e "\e[94m Dumping the MySQL database ${MYSQLDATABASE} to the file ${TEMPORARYDIRECTORY}/${MYSQLDATABASE}.sql...\e[97m"
mysqldump -u${MYSQLUSERNAME} -p${MYSQLPASSWORD} ${MYSQLDATABASE} > ${TEMPORARYDIRECTORY}/${MYSQLDATABASE}.sql
fi
fi
@ -141,12 +141,12 @@ fi
# Create the backup archive.
echo -e "\e[94m Compressing the backed up files...\e[97m"
echo -e ""
tar -zcvf $BACKUPSDIRECTORY/adsb-receiver_data_$BACKUPDATE.tar.gz $TEMPORARYDIRECTORY
tar -zcvf ${BACKUPSDIRECTORY}/adsb-receiver_data_${BACKUPDATE}.tar.gz ${TEMPORARYDIRECTORY}
echo -e ""
# Remove the temporary directory.
echo -e "\e[94m Removing the temporary backup directory...\e[97m"
sudo rm -rf $TEMPORARYDIRECTORY
sudo rm -rf ${TEMPORARYDIRECTORY}
## BACKUP PROCESS COMPLETE
@ -154,13 +154,13 @@ echo -e "\e[32m"
echo -e " BACKUP PROCESS COMPLETE\e[93m"
echo -e ""
echo -e " An archive containing the data just backed up can be found at:"
echo -e " $TEMPORARYDIRECTORY/adsb-receiver_data_$BACKUPDATE.tar.gz\e[97m"
echo -e " ${TEMPORARYDIRECTORY}/adsb-receiver_data_${BACKUPDATE}.tar.gz\e[97m"
echo -e ""
echo -e "\e[93m ------------------------------------------------------------------------------"
echo -e "\e[92m Finished backing up portal data.\e[39m"
echo -e ""
if [[ -n ${VERBOSE} ]] ; then
if [[ "${RECEIVER_AUTOMATED_INSTALL}" = "false" ]] ; then
read -p "Press enter to continue..." CONTINUE
fi

Wyświetl plik

@ -68,7 +68,7 @@ function DisplayHelp() {
## CHECK FOR OPTIONS AND ARGUMENTS
while [[ $# -gt 0 ]]; do
while [[ $# -gt 0 ]] ; do
case "$1" in
-h|--help)
# Display a help message.
@ -122,12 +122,12 @@ done
## AUTOMATED INSTALL
# If the automated installation option was selected set the needed environmental variables.
if [ "${AUTOMATED_INSTALL}" = "true" ]; then
if [[ "${AUTOMATED_INSTALL}" = "true" ]] ; then
# If no configuration file was specified use the default configuration file path and name.
if [ -n "${CONFIGURATION_FILE}" ] || [ "${CONFIGURATION_FILE}" = "default" ]; then
if [[ -n "${CONFIGURATION_FILE}" ]] || [[ "${CONFIGURATION_FILE}" = "default" ]] ; then
CONFIGURATION_FILE="${RECEIVER_ROOT_DIRECTORY}/install.config"
# If either the -c or --config-file= flags were set a valid file must reside there.
elif [ ! -f "${CONFIGURATION_FILE}" ]; then
elif [[ ! -f "${CONFIGURATION_FILE}" ]] ; then
echo "Unable to locate the installation configuration file."
exit 1
fi