diff --git a/bash/feeders/adsbexchange.sh b/bash/feeders/adsbexchange.sh index be01db4..26a97a7 100755 --- a/bash/feeders/adsbexchange.sh +++ b/bash/feeders/adsbexchange.sh @@ -44,7 +44,7 @@ MLAT_CLIENT_GITBHUB_URL="https://github.com/mutability/mlat-client.git" MLAT_CLIENT_BUILD_DIRECTORY="${RECEIVER_BUILD_DIRECTORY}/mlat-client" FEEDER_NAME="adsbexchange" -FEEDER_BUILD_DIRECTORY="${RECEIVER_BUILD_DIRECTORY}/${FEEDER_NAME}" +COMPONENT_BUILD_DIRECTORY="${RECEIVER_BUILD_DIRECTORY}/${FEEDER_NAME}" FEEDER_BEAST_DST_HOST="feed.adsbexchange.com" FEEDER_BEAST_DST_PORT="30005" @@ -100,10 +100,10 @@ echo -e "\e[95m Checking for and removing any old style ADS-B Exchange setups i echo -e "" # Check if the old style ${FEEDER_NAME}-maint.sh line exists in /etc/rc.local. echo -e "\e[94m Checking for any preexisting older style setups...\e[97m" -if [[ `grep -cFx "${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-maint.sh &" /etc/rc.local` -gt 0 ]] ; then +if [[ `grep -cFx "${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-maint.sh &" /etc/rc.local` -gt 0 ]] ; then # Kill any currently running instances of the ${FEEDER_NAME}-maint.sh script. echo -e "\e[94m Checking for any running ${FEEDER_NAME}-maint.sh processes...\e[97m" - PIDS=`ps -efww | grep -w "${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-maint.sh &" | awk -vpid=$$ '$2 != pid { print $2 }'` + PIDS=`ps -efww | grep -w "${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-maint.sh &" | awk -vpid=$$ '$2 != pid { print $2 }'` if [[ -n "${PIDS}" ]] ; then echo -e "\e[94m -Killing any running ${FEEDER_NAME}-maint.sh processes...\e[97m" echo -e "" @@ -113,7 +113,7 @@ if [[ `grep -cFx "${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-maint.sh &" /etc/rc.l fi # Remove the old line from /etc/rc.local. echo -e "\e[94m Removing the old ${FEEDER_NAME}-maint.sh startup line from /etc/rc.local...\e[97m" - sudo sed -i /$${FEEDER_BUILD_DIRECTORY}\/${FEEDER_NAME}-maint.sh &/d /etc/rc.local 2>&1 + sudo sed -i /$${COMPONENT_BUILD_DIRECTORY}\/${FEEDER_NAME}-maint.sh &/d /etc/rc.local 2>&1 fi echo -e "" @@ -288,16 +288,16 @@ echo -e "" # Create the feeder directory in the build directory if it does not exist. echo -e "\e[94m Checking for the ${FEEDER_NAME} build directory...\e[97m" -if [[ ! -d "${FEEDER_BUILD_DIRECTORY}" ]] ; then +if [[ ! -d "${COMPONENT_BUILD_DIRECTORY}" ]] ; then echo -e "\e[94m Creating the ${FEEDER_NAME} build directory...\e[97m" - mkdir -vp ${FEEDER_BUILD_DIRECTORY} 2>&1 + mkdir -vp ${COMPONENT_BUILD_DIRECTORY} 2>&1 fi echo -e "" if [[ ${FEEDER_BEAST_ENABLED} = "true" ]] ; then # Create netcat maint script. echo -e "\e[94m Creating the file ${FEEDER_NAME}-netcat_maint.sh...\e[97m" - tee ${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh > /dev/null < /dev/null < /dev/null < /dev/null <&1 + sudo chmod +x ${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh 2>&1 fi if [[ ${FEEDER_MLAT_ENABLED} = "true" ]] ; then # Set permissions on MLAT script. echo -e "\e[94m Setting file permissions for ${FEEDER_NAME}-mlat_maint.sh...\e[97m" - sudo chmod +x ${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh 2>&1 + sudo chmod +x ${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh 2>&1 echo -e "" fi if [[ ${FEEDER_BEAST_ENABLED} = "true" ]] ; then # Add netcat script to startup. echo -e "\e[94m Checking if the netcat startup line is contained within the file /etc/rc.local...\e[97m" - if [[ `grep -cFx "${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh &" /etc/rc.local` -eq 0 ]] ; then + if [[ `grep -cFx "${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh &" /etc/rc.local` -eq 0 ]] ; then echo -e "\e[94m Adding the netcat startup line to the file /etc/rc.local...\e[97m" lnum=($(sed -n '/exit 0/=' /etc/rc.local)) - ((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i ${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh &\n" /etc/rc.local + ((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i ${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh &\n" /etc/rc.local echo -e "" fi fi @@ -348,10 +348,10 @@ fi if [[ ${FEEDER_MLAT_ENABLED} = "true" ]] ; then # Add MLAT script to startup. echo -e "\e[94m Checking if the mlat-client startup line is contained within the file /etc/rc.local...\e[97m" - if [[ `grep -cFx "${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh &" /etc/rc.local` -eq 0 ]] ; then + if [[ `grep -cFx "${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh &" /etc/rc.local` -eq 0 ]] ; then echo -e "\e[94m Adding the mlat-client startup line to the file /etc/rc.local...\e[97m" lnum=($(sed -n '/exit 0/=' /etc/rc.local)) - ((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i ${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh &\n" /etc/rc.local + ((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i ${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh &\n" /etc/rc.local echo -e "" fi echo -e "" @@ -402,13 +402,13 @@ fi if [[ ${FEEDER_BEAST_ENABLED} = "true" ]] ; then # Start netcat script. echo -e "\e[94m Executing the ${FEEDER_NAME}-netcat_maint.sh script...\e[97m" - sudo nohup ${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh > /dev/null 2>&1 & + sudo nohup ${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-netcat_maint.sh > /dev/null 2>&1 & fi if [[ ${FEEDER_MLAT_ENABLED} = "true" ]] ; then # Start MLAT script. echo -e "\e[94m Executing the ${FEEDER_NAME}-mlat_maint.sh script...\e[97m" - sudo nohup ${FEEDER_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh > /dev/null 2>&1 & + sudo nohup ${COMPONENT_BUILD_DIRECTORY}/${FEEDER_NAME}-mlat_maint.sh > /dev/null 2>&1 & echo -e "" fi