Modified AboveTustin script to work with ini file.

pull/289/head
Joe Prochazka 2016-12-23 15:38:58 -05:00
rodzic a94bdd9322
commit 1d7b6fa624
3 zmienionych plików z 185 dodań i 144 usunięć

Wyświetl plik

@ -7,7 +7,9 @@ The following is a history of the changes made to this project.
* Added the ability to install beast-splitter as an extra.
* Added the ability to setup Duck DNS dynamic DNS service as an extra.
* Added the ability to setup the AboveTustin Twitter bot.
* A log file can be kept by using either the -l or --log-output switch.
* Help pertaining to the new switches is available using the -h or --help switch.
* An installation log file can be kept by using either the -l or --log-output switch.
* The branch you wish to use can be specified using the -b or --branch switch.
## v2.5.0 *(December 5th, 2016)*

Wyświetl plik

@ -69,100 +69,110 @@ fi
echo -e "\e[95m Checking for PhantomJS...\e[97m"
echo ""
if [ -f /usr/bin/phantomjs ] && [ `phantomjs --version` = $PHANTOMJSVERSION ]; then
if [ -f /usr/bin/phantomjs ] && [ `phantomjs --version` -eq $PHANTOMJSVERSION ]; then
# A PhantomJS binary which is the proper version appears to exist on this device.
echo -e "\e[94m PhantomJS is present on this device and is the proper version...\e[97m"
PHANTOMJSEXISTS="true"
PHANTOMJS_EXISTS="true"
else
echo -e "\e[91m PhantomJS is not present on this device or is not the proper version...\e[97m"
PHANTOMJSEXISTS="false"
echo -e "\e[94m Checking if a precompiled PhantomJS binary is available for download...\e[97m"
PHANTOMJS_EXISTS="false"
echo -e "\e[94m Detecting CPU architeture...\e[97m"
CPUARCHITECTURE=`uname -m`
CPU_ARCHITECTURE=`uname -m`
echo -e "\e[94m CPU architecture detected as $CPUARCHITECTURE...\e[97m"
if [ $CPUARCHITECTURE = "armv7l" ] || [ $CPUARCHITECTURE = "x86_64" ] || [ $CPUARCHITECTURE = "i686" ]; then
if [ $CPU_ARCHITECTURE -eq "armv7l" ] || [ $CPU_ARCHITECTURE -eq "x86_64" ] || [ $CPU_ARCHITECTURE -eq "i686" ]; then
# A precompiled binary should be available for this device.
echo -e "\e[94m A precompiled PhantomJS binary appears to be available for this CPU's arcitecture...\e[97m"
BINARYAVAILABLE="true"
BINARY_AVAILABLE="true"
else
# A precompiled binary does not appear to be available for this device.
echo -e "\e[94m A precompiled PhantomJS binary does not appear to be available for this CPU's arcitecture...\e[97m"
BINARYAVAILABLE="false"
# Warn the user of the build time if there is no binary available for download.
# The user should be allowed to cancel out of the setup process at this time.
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "PhantomJS Binary Not Available" --yesno "It appears there is not a precompiled PhantomJS binary available for your devices architecture.\n\nThis script is capable of downloading and compiling the PhantomJS source but THIS MAY TAKE AN EXTREMELY LONG TO TO COMPLETE. Expect the build process to range anywhere from a half our to literally hours.\n\nDo you wish to compile PhantomJS from source?" 13 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."
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
BINARY_AVAILABLE="false"
if [ $RECEIVER_AUTOMATED_INSTALL -eq "false" ]; then
# Warn the user of the build time if there is no binary available for download.
# The user should be allowed to cancel out of the setup process at this time.
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "PhantomJS Binary Not Available" --yesno "It appears there is not a precompiled PhantomJS binary available for your devices architecture.\n\nThis script is capable of downloading and compiling the PhantomJS source but THIS MAY TAKE AN EXTREMELY LONG TO TO COMPLETE. Expect the build process to range anywhere from a half our to literally hours.\n\nDo you wish to compile PhantomJS from source?" 13 78
if [ $? -eq 1 ]; then
# Setup has been halted by the user.
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo " Setup has been halted at the request of the user."
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 1
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 -ne "true" ]
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
echo " A prebuilt PhantomJS binary is not available for this system."
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
exit 1
fi
exit 1
fi
echo -e "\e[94m Will attempt to build the PhantomJS binary from source...\e[97m"
fi
fi
## GATHER TWITTER API INFORMATION FROM THE USER
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Twiter Keys and Tokens" --yesno "In order to send Tweets to Twitter using AboveTustin you will need to obtain the proper keys and tokens from Twitter. You will need to sign up for a Twitter developer account at https://apps.twitter.com and create an application there in order to obtain this information.\n\nMore information on obtaining Twitter keys and access tokens can be found in the projects wiki page.\n\nhttps://github.com/jprochazka/adsb-receiver/wiki/Setting-Up-AboveTustin\n\nProceed with the AboveTustin setup?" 20 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."
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
if [ $RECEIVER_AUTOMATED_INSTALL -eq "false" ]; then
whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "Twiter Keys and Tokens" --yesno "In order to send Tweets to Twitter using AboveTustin you will need to obtain the proper keys and tokens from Twitter. You will need to sign up for a Twitter developer account at https://apps.twitter.com and create an application there in order to obtain this information.\n\nMore information on obtaining Twitter keys and access tokens can be found in the projects wiki page.\n\nhttps://github.com/jprochazka/adsb-receiver/wiki/Setting-Up-AboveTustin\n\nProceed with the AboveTustin setup?" 20 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."
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
exit 1
fi
exit 1
fi
# If any exist assign the current Twitter keys and access tokens to variables.
if [ $RECEIVER_AUTOMATED_INSTALL -eq "false" ]; then
TWITTER_ACCESS_TOKEN_TITLE="Twitter Access Token"
while [ -z $TWITTER_ACCESS_TOKEN ]; do
if [ -f $RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini ]; then
TWITTER_ACCESS_TOKEN=`GetConfig "access_token" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"`
fi
TWITTER_ACCESS_TOKEN=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$TWITTER_ACCESS_TOKEN_TITLE" --nocancel --inputbox "\nEnter your Twitter Access Token." 7 78 "$TWITTER_ACCESS_TOKEN" 3>&1 1>&2 2>&3)
TWITTER_ACCESS_TOKEN_TITLE="Twitter Access Token (REQUIRED)"
done
TWITTERACCESSTOKEN_TITLE="Twitter Access Token"
while [[ -z $TWITTERACCESSTOKEN ]]; do
TWITTERACCESSTOKEN=""
if [ -f $BUILDDIRECTORY/AboveTustin/keys/token ]; then
TWITTERACCESSTOKEN=`cat $BUILDDIRECTORY/AboveTustin/keys/token`
fi
TWITTERACCESSTOKEN=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$TWITTERACCESSTOKEN_TITLE" --nocancel --inputbox "\nEnter your Twitter Access Token." 7 78 "$TWITTERACCESSTOKEN" 3>&1 1>&2 2>&3)
TWITTERACCESSTOKEN_TITLE="Twitter Access Token (REQUIRED)"
done
TWITTERACCESSTOKENSECRET_TITLE="Twitter Access Token Secret"
while [[ -z $TWITTERACCESSTOKENSECRET ]]; do
TWITTERACCESSTOKENSECRET=""
if [ -f $BUILDDIRECTORY/AboveTustin/keys/token_secret ]; then
TWITTERACCESSTOKENSECRET=`cat $BUILDDIRECTORY/AboveTustin/keys/token_secret`
fi
TWITTERACCESSTOKENSECRET=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$TWITTERACCESSTOKENSECRET_TITLE" --nocancel --inputbox "\nEnter your Twitter Access Token Secret." 7 " $TWITTERACCESSTOKENSECRET"78 3>&1 1>&2 2>&3)
TWITTERACCESSTOKENSECRET_TITLE="Twitter Access Token Secret (REQUIRED)"
done
TWITTERCONSUMERKEY_TITLE="Twitter Consumer Key"
while [[ -z $TWITTERCONSUMERKEY ]]; do
TWITTERCONSUMERKEY=""
if [ -f $BUILDDIRECTORY/AboveTustin/keys/consumer_key ]; then
TWITTERCONSUMERKEY=`cat $BUILDDIRECTORY/AboveTustin/keys/consumer_key`
fi
TWITTERCONSUMERKEY=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$TWITTERCONSUMERKEY_TITLE" --nocancel --inputbox "\nEnter your Twitter Consumer Key." 7 78 "TWITTERCONSUMERKEY" 3>&1 1>&2 2>&3)
TWITTERCONSUMERKEY_TITLE="Twitter Consumer Key (REQUIRED)"
done
TWITTERCONSUMERSECRET_TITLE="Twitter Consumer Secret"
while [[ -z $TWITTERCONSUMERSECRET ]]; do
TWITTERCONSUMERSECRET=""
if [ -f $BUILDDIRECTORY/AboveTustin/keys/consumer_secret ]; then
TWITTERCONSUMERSECRET=`cat $BUILDDIRECTORY/AboveTustin/keys/consumer_secret`
fi
TWITTERCONSUMERSECRET=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$TWITTERCONSUMERSECRET_TITLE" --nocancel --inputbox "\nEnter your Twitter Consumer Secret." 7 78 "$TWITTERCONSUMERSECRET" 3>&1 1>&2 2>&3)
TWITTERCONSUMERSECRET_TITLE="Twitter Consumer Secret (REQUIRED)"
done
TWITTER_ACCESS_TOKEN_SECRET_TITLE="Twitter Access Token Secret"
while [ -z $TWITTER_ACCESS_TOKEN_SECRET ]; do
if [ -f $RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini ]; then
TWITTER_ACCESS_TOKEN_SECRET=`GetConfig "access_token_secret" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"`
fi
TWITTER_ACCESS_TOKEN_SECRET=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$TWITTER_ACCESS_TOKEN_SECRET_TITLE" --nocancel --inputbox "\nEnter your Twitter Access Token Secret." 7 78 " $TWITTER_ACCESS_TOKEN_SECRET" 3>&1 1>&2 2>&3)
TWITTER_ACCESS_TOKEN_SECRET_TITLE="Twitter Access Token Secret (REQUIRED)"
done
TWITTER_CONSUMER_KEY_TITLE="Twitter Consumer Key"
while [ -z $TWITTER_CONSUMER_KEY ]; do
if [ -f $RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini ]; then
TWITTER_CONSUMER_KEY=`GetConfig "consumer_key" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"`
fi
TWITTER_CONSUMER_KEY=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$TWITTER_CONSUMER_KEY_TITLE" --nocancel --inputbox "\nEnter your Twitter Consumer Key." 7 78 "$TWITTER_CONSUMER_KEY" 3>&1 1>&2 2>&3)
TWITTER_CONSUMER_KEY_TITLE="Twitter Consumer Key (REQUIRED)"
done
TWITTER_CONSUMER_SECRET_TITLE="Twitter Consumer Secret"
while [ -z $TWITTER_CONSUMER_SECRET ]; do
if [ -f $RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini ]; then
TWITTER_CONSUMER_SECRET=`GetConfig "consumer_secret" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"`
fi
TWITTER_CONSUMER_SECRET=$(whiptail --backtitle "$RECEIVER_PROJECT_TITLE" --title "$TWITTER_CONSUMER_SECRET_TITLE" --nocancel --inputbox "\nEnter your Twitter Consumer Secret." 7 78 "$TWITTER_CONSUMER_SECRET" 3>&1 1>&2 2>&3)
TWITTER_CONSUMER_SECRET_TITLE="Twitter Consumer Secret (REQUIRED)"
done
fi
## CHECK FOR PREREQUISITE PACKAGES
@ -171,7 +181,7 @@ echo ""
# The package ttf-mscorefonts-installer requires contrib be added to the Debian repositories contained in /etc/apt/sources.list.
# The contrib flag does not need to be added for Raspbian Jessie and Ubuntu only Debian so far.
if [ `lsb_release -si` = "Debian" ]; then
if [ `lsb_release -si` -eq "Debian" ]; then
echo -e "\e[94m Adding the contrib component to the repositories contained sources.list...\e[97m"
sudo sed -i 's/main/main contrib/g' /etc/apt/sources.list
echo -e "\e[94m Updating the repository package lists...\e[97m"
@ -198,7 +208,7 @@ CheckPackage libxext-dev
CheckPackage libpng12-dev
CheckPackage libc6
if [ $BINARYAVAILABLE = "false" ]; then
if [ $BINARY_AVAILABLE -eq "false" ]; then
# These packages are only needed if the user decided to build PhantomJS.
CheckPackage build-essential
CheckPackage g++
@ -209,8 +219,8 @@ fi
## SETUP PHANTOMJS IF IT DOES NOT ALREADY EXIST ON THIS DEVICE
if [ $PHANTOMJSEXISTS = "false" ]; then
if [ $BINARYAVAILABLE = "true" ]; then
if [ $PHANTOMJS_EXISTS -eq "false" ]; then
if [ $BINARY_AVAILABLE -eq "true" ]; then
# DOWNLOAD THE PHANTOMJS BINARY
@ -220,38 +230,39 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
# Enter the root of the project build directory.
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
cd $BUILDDIRECTORY
cd $RECIEVER_BUILD_DIRECTORY
# Download the proper PhantomJS binary.
case $CPUARCHITECTURE in
case $CPU_ARCHITECTURE in
"armv7l")
# Download the armv7l version of the PhantomJS binary from https://github.com/jprochazka/phantomjs-linux-armv7l.
echo -e "\e[94m Downloading the armv7l PhantomJS v$PHANTOMJSVERSION binary for Linux...\e[97m"
echo -e "\e[94m Downloading the armv7l PhantomJS v$PHANTOMJS_VERSION binary for Linux...\e[97m"
echo ""
wget https://github.com/jprochazka/phantomjs-linux-armv7l/releases/download/2.1.1/phantomjs-2.1.1-linux-armv7l.tar.bz2
"x86_64")
# Download the x86_64 version of the PhantomJS binary from the PhantomJS web site.
echo -e "\e[94m Downloading the official x86_64 PhantomJS v$PHANTOMJSVERSION binary for Linux...\e[97m"
echo -e "\e[94m Downloading the official x86_64 PhantomJS v$PHANTOMJS_VERSION binary for Linux...\e[97m"
echo ""
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
;;
"i686"
# Download the i686 version of the PantomJS binary from the PhantomJS web site.
echo -e "\e[94m Downloading the official i686 PhantomJS v$PHANTOMJSVERSION binary for Linux...\e[97m"
echo -e "\e[94m Downloading the official i686 PhantomJS v$PHANTOMJS_VERSION binary for Linux...\e[97m"
echo ""
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
;;
esac
# Extract the files from the PhantomJS archive which was just downloaded.
echo -e "\e[94m Extracting the PhantomJS binary archive...\e[97m"
echo ""
bunzip2 -v phantomjs-${PHANTOMJSVERSION}-linux-$PHANTOMJSVERSION.tar.bz2
tar -vxf phantomjs-${PHANTOMJSVERSION}-linux-$PHANTOMJSVERSION.tar
rm -f phantomjs-${PHANTOMJSVERSION}-linux-$PHANTOMJSVERSION.tar
bunzip2 -v phantomjs-${PHANTOMJS_VERSION}-linux-$CPU_ARCHITECTURE.tar.bz2
tar -vxf phantomjs-${PHANTOMJS_VERSION}-linux-$CPU_ARCHITECTURE.tar
rm -f phantomjs-${PHANTOMJS_VERSION}-linux-$CPU_ARCHITECTURE.tar
# Move the binary into the /usr/bin directory and make it executable.
echo -e "\e[94m Copying the PhantomJS binary into the directory /usr/bin...\e[97m"
sudo cp phantomjs-${PHANTOMJSVERSION}-linux-$PHANTOMJSVERSION/bin/phantomjs /usr/bin
sudo cp phantomjs-${PHANTOMJS_VERSION}-linux-$CPU_ARCHITECTURE/bin/phantomjs /usr/bin
echo -e "\e[94m Making the file /usr/bin/phantomjs executable...\e[97m"
sudo chmod +x /usr/bin/phantomjs
@ -267,17 +278,17 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
echo ""
echo -e "\e[95m Preparing the PhantomJS Git repository...\e[97m"
echo ""
if [ -d $PHANTOMJSBUILDDIRECTORY ] && [ -d $PHANTOMJSBUILDDIRECTORY/.git ]; then
if [ -d $RECIEVER_BUILD_DIRECTORY/phantomjs ] && [ -d $RECIEVER_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 $PHANTOMJSBUILDDIRECTORY
cd $RECIEVER_BUILD_DIRECTORY/phantomjs
echo -e "\e[94m Updating the local PhantomJS git repository...\e[97m"
echo ""
git pull --all
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 $RECIEVER_BUILD_DIRECTORY
echo -e "\e[94m Cloning the PhantomJS git repository locally...\e[97m"
echo ""
git clone git://github.com/ariya/phantomjs.git
@ -285,15 +296,15 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
fi
# Enter the PhantomJS build directory if not already there.
if [ ! $PWD = $PHANTOMJSBUILDDIRECTORY ]; then
if [ ! $PWD -eq $RECIEVER_BUILD_DIRECTORY/phantomjs ]; then
echo -e "\e[94m Entering the PhantomJS Git repository directory...\e[97m"
cd $PHANTOMJSBUILDDIRECTORY
cd $RECIEVER_BUILD_DIRECTORY/phantomjs
fi
# Checkout the proper branch then init and update the submodules.
echo -e "\e[94m Checking out the branch $PHANTOMJSVERSION...\e[97m"
echo -e "\e[94m Checking out the branch $PHANTOMJS_VERSION...\e[97m"
echo ""
git checkout $PHANTOMJSVERSION
git checkout $PHANTOMJS_VERSION
echo ""
echo -e "\e[94m Initializing Git submodules...\e[97m"
echo ""
@ -305,7 +316,7 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
echo ""
# Compile and link the code.
if [[ `uname -m` == "armv7l" ]] || [[ `uname -m` == "armv6l" ]] || [[ `uname -m` == "aarch64" ]]; then
if [ `uname -m` -eq "armv7l" ] || [ `uname -m` -eq "armv6l" ] || [ `uname -m` -eq "aarch64" ]; then
# Limit the amount of processors being used on Raspberry Pi devices.
# Not doing will very likely cause the compile to fail due to an out of memory error.
echo -e "\e[94m Building PhantomJS... (Job will be limited to using 1 processor.)\e[97m"
@ -317,7 +328,7 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
echo ""
# Test that the binary was built properly.
if [ ! -f bin/pahntomjs ] || [ ! `bin/phantomjs --version` = $PHANTOMJSVERSION ]; then
if [ ! -f bin/pahntomjs ] || [ ! `bin/phantomjs --version` -eq $PHANTOMJS_VERSION ]; then
# If the dump978 binaries could not be found halt setup.
echo ""
echo -e "\e[91m \e[5mINSTALLATION HALTED!\e[25m"
@ -329,9 +340,7 @@ if [ $PHANTOMJSEXISTS = "false" ]; then
echo -e "\e[93m-------------------------------------------------------------------------------------------------------"
echo -e "\e[92m AboveTustin setup halted.\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
read -p "Press enter to continue..." CONTINUE
exit 1
fi
@ -381,57 +390,69 @@ echo -e "\e[95m Downloading and configuring AboveTustin...\e[97m"
echo ""
echo -e "\e[94m Entering the ADS-B Receiver Project build directory...\e[97m"
cd $BUILDDIRECTORY
cd $RECIEVER_BUILD_DIRECTORY
echo -e "\e[94m Checking if the AboveTustin Git repository has been cloned...\e[97m"
if [ -d $BUILDDIRECTORY/AboveTustin ] && [ -d $BUILDDIRECTORY/AboveTustin/.git ]; then
if [ -d $RECIEVER_BUILD_DIRECTORY/AboveTustin ] && [ -d $RECIEVER_BUILD_DIRECTORY/AboveTustin/.git ]; then
# A directory with a git repository containing the source code already exists.
echo -e "\e[94m Entering the AboveTustin git repository directory...\e[97m"
cd $BUILDDIRECTORY/AboveTustin
cd $RECIEVER_BUILD_DIRECTORY/AboveTustin
echo -e "\e[94m Updating the local AboveTustin git repository...\e[97m"
echo ""
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 $BUILDDIRECTORY
cd $BUILDDIRECTORY
mkdir -p $RECIEVER_BUILD_DIRECTORY
cd $RECIEVER_BUILD_DIRECTORY
echo -e "\e[94m Cloning the AboveTustin git repository locally...\e[97m"
echo ""
git clone https://github.com/kevinabrandon/AboveTustin.git
echo ""
fi
# Make the logs directory if it does not already exist.
cho -e "Checking if the directory $BUILDDIRECTORY/AboveTustin/logs exists...\e[97m"
if [ ! -d $BUILDDIRECTORY/AboveTustin/logs ]; then
echo -e "\e[94m Creating the directory $BUILDDIRECTORY/AboveTustin/logs...\e[97m"
mkdir $BUILDDIRECTORY/AboveTustin/logs
fi
# Copy the file config.sample.ini to config.ini
echo -e "\e[94m Copying the file config.sample.ini to the file config.ini...\e[97m"
cp $RECIEVER_BUILD_DIRECTORY/AboveTustin/config.sample.ini $RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini
# Make the key directory if it does not already exist.
echo -e "Checking if the directory $BUILDDIRECTORY/AboveTustin/keys exists...\e[97m"
if [ ! -d $BUILDDIRECTORY/AboveTustin/keys ]; then
echo -e "\e[94m Creating the directory $BUILDDIRECTORY/AboveTustin/keys...\e[97m"
mkdir $BUILDDIRECTORY/AboveTustin/keys
fi
# Write out the supplied values to the file config.ini.
echo -e "\e[94m Writing the Twitter token value to the config.ini file...\e[97m"
ChangeConfig "access_token" "$TWITTER_ACCESS_TOKEN" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"
echo -e "\e[94m Writing the Twitter token secret value to the config.ini file...\e[97m"
ChangeConfig "access_token_secret" "$TWITTER_ACCESS_TOKEN_SECRET" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"
echo -e "\e[94m Writing the Twitter consumer key value to the config.ini file...\e[97m"
ChangeConfig "consumer_key" "$TWITTER_CONSUMER_KEY" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"
echo -e "\e[94m Writing the Twitter consumer secret to the config.ini file...\e[97m"
ChangeConfig "consumer_secret" "$TWITTER_CONSUMER_SECRET" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"
echo -e "\e[94m Writing the receiver's timezone to the config.ini file...\e[97m"
ChangeConfig "time_zone" "`cat /etc/timezone`" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"
# Write out the files which will contain the user's Twitter keys and access tokens.
echo -e "\e[94m Adding the supplied token to the Twitter Token file...\e[97m"
echo "$TWITTERACCESSTOKEN" > $BUILDDIRECTORY/AboveTustin/keys/token
echo -e "\e[94m Adding the supplied token secret to the Twitter Token Secret file...\e[97m"
echo "$TWITTERACCESSTOKENSECRET" > $BUILDDIRECTORY/AboveTustin/keys/token_secret
echo -e "\e[94m Adding the supplied consumer key to the Twitter Consumer Key file...\e[97m"
echo "$TWITTERCONSUMERKEY" > $BUILDDIRECTORY/AboveTustin/keys/consumer_key
echo -e "\e[94m Adding the supplied consumer secret to the Twitter Consumer Secret file...\e[97m"
echo "$TWITTERCONSUMERSECRET" > $BUILDDIRECTORY/AboveTustin/keys/consumer_secret
# Ask for the receivers latitude and longitude.
if [ $RECEIVER_AUTOMATED_INSTALL -eq "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 distance calculations to work 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 3>&1 1>&2 2>&3)
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 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 3>&1 1>&2 2>&3)
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 3>&1 1>&2 2>&3)
done
fi
echo -e "\e[94m Writing the receiver's latitude to the config.ini file...\e[97m"
ChangeConfig "latitude" "$RECEIVER_LATITUDE" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"
echo -e "\e[94m Writing the receiver's longitude to the config.ini file...\e[97m"
ChangeConfig "longitude" "$RECEIVER_LONGITUDE" "$RECIEVER_BUILD_DIRECTORY/AboveTustin/config.ini"
# Add the run_tracker.sh script to /etc/rc.local so it is executed at boot up.
echo -e "\e[94m Checking if the AboveTustin startup line is contained within the file /etc/rc.local...\e[97m"
if ! grep -Fxq "$BUILDDIRECTORY/AboveTustin/run_tracker.sh &" /etc/rc.local; then
if ! grep -Fxq "$RECIEVER_BUILD_DIRECTORY/AboveTustin/run_tracker.sh &" /etc/rc.local; then
echo -e "\e[94m Adding the AboveTustin 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 $BUILDDIRECTORY/AboveTustin/run_tracker.sh &\n" /etc/rc.local
((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i $RECIEVER_BUILD_DIRECTORY/AboveTustin/run_tracker.sh &\n" /etc/rc.local
fi
# Kill any currently running instances of the run_tracker.sh script.
@ -459,21 +480,19 @@ if [ ! -z "$PIDS" ]; then
sudo kill -9 $PIDS
fi
echo -e "\e[94m Executing the adsbexchange-netcat_maint.sh script...\e[97m"
sudo nohup $BUILDDIRECTORY/AboveTustin/run_tracker.sh > /dev/null 2>&1 &
echo -e "\e[94m Executing the run_tracker.sh script...\e[97m"
sudo nohup $RECIEVER_BUILD_DIRECTORY//AboveTustin/run_tracker.sh > /dev/null 2>&1 &
## OVERTUSTIN SETUP COMPLETE
# Enter into the project root directory.
echo -e "\e[94m Entering the ADS-B Receiver Project root directory...\e[97m"
cd $PROJECTROOTDIRECTORY
cd $RECIEVER_ROOT_DIRECTORY
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m OverTustin setup is complete.\e[39m"
echo ""
if [[ ! -z ${VERBOSE} ]] ; then
read -p "Press enter to continue..." CONTINUE
fi
read -p "Press enter to continue..." CONTINUE
exit 0

Wyświetl plik

@ -53,10 +53,11 @@ RECEIVER_LATITUDE="41.3683798"
RECEIVER_LONGITUDE="-82.1076486"
RECIEVER_ALTITUDE="224"
## DECODERS
# ---------------------------------------------------------------------------------
# DUMP1090
# DUMP1090
# ---------------------------------------------------------------------------------
#
# One of two dump1090 forks must be installed by these scripts. You are required to
@ -140,7 +141,7 @@ DUMP1090_BIND_TO_ALL_IPS="true"
DUMP1090_UNIT_OF_MEASURMENT="imperial"
# ---------------------------------------------------------------------------------
# DUMP978
# DUMP978
# ---------------------------------------------------------------------------------
DUMP978_INSTALL="false"
@ -164,15 +165,16 @@ DUMP978_UPGRADE="true"
DUMP978_USB_DEVICE="1"
# ---------------------------------------------------------------------------------
# RTLSDR-OGN
# RTLSDR-OGN
# ---------------------------------------------------------------------------------
RTLSDROGN_INSTALL="false"
## FEEDERS
# ---------------------------------------------------------------------------------
# ADS-B Exchange
# ADS-B Exchange
# ---------------------------------------------------------------------------------
ADSBEXCHANGE_INSTALL="false"
@ -186,7 +188,7 @@ ADSBEXCHANGE_UPGRADE="false"
ADSBEXCHANGE_RECEIVER_NAME="I_DID_NOT_READ_THE_COMMENTS"
# ---------------------------------------------------------------------------------
# FLIGHTRADAR24 FEEDER CLIENT
# FLIGHTRADAR24 FEEDER CLIENT
# ---------------------------------------------------------------------------------
#
# The Flightradar24 Feeder Client requires the user to interact physically with the
@ -197,7 +199,7 @@ ADSBEXCHANGE_RECEIVER_NAME="I_DID_NOT_READ_THE_COMMENTS"
FLIGHTRADAR24_INSTALL="false"
# ---------------------------------------------------------------------------------
# PIAWARE
# PIAWARE
# ---------------------------------------------------------------------------------
#
# Please note that if the FlightAware fork of dump1090 is chosen to be installed
@ -217,7 +219,7 @@ PIAWARE_FLIGHTAWARE_LOGIN=""
PIAWARE_FLIGHTAWARE_PASSWORD=""
# ---------------------------------------------------------------------------------
# PLANEFINDER ADS-B CLIENT
# PLANEFINDER ADS-B CLIENT
# ---------------------------------------------------------------------------------
#
# After setup has completed the Plane Finder ADS-B Client should be installed and
@ -236,9 +238,8 @@ PIAWARE_FLIGHTAWARE_PASSWORD=""
PLANEFINDER_INSTALL="false"
PLANEFINDER_UPGRADE="true"
## WEB PORTAL
# ---------------------------------------------------------------------------------
# WEB PORTAL
# ---------------------------------------------------------------------------------
#
# If you wish to install the ADS-B Receiver Project portal set the following
@ -301,8 +302,11 @@ WEBPORTAL_DATABASE_NAME=""
WEBPORTAL_DATABASE_USER=""
WEBPORTAL_DATABASE_PASSWORD=""
## ABOVETUSTIN
## EXTRAS
# ---------------------------------------------------------------------------------
# ABOVETUSTIN
# ---------------------------------------------------------------------------------
#
# AboveTustin is a twitter bot which can be installed using these scripts. In order
@ -316,8 +320,24 @@ ABOVETUSTIN_INSTALL="false"
ABOVETUSTIN_UPGRADE="true"
## BEAST-SPLITTER
# If no precompiled PhantomJS binary is available for download for use on your
# device the scripts are capable of building a binary from source. However doing so
# may take quite some time measurable in hours. Set this variable to true if you
# wish to allow the scripts to compile a binary if one is not available.
ABOVETUSTIN_COMPILE_IF_NEEDED="false"
# You will need to obtain tokens and keys from the Twitter developers site in order
# to send tweets to your Twitter account via the AboveTustin Twitter bot. You can
# sign up for a free Twitter developer account at https://dev.twitter.com.
TWITTER_ACCESS_TOKEN=""
TWITTER_ACCESS_TOKEN_SECRET=""
TWITTER_CONSUMER_KEY=""
TWITTER_CONSUMER_SECRET=""
# ---------------------------------------------------------------------------------
# BEAST-SPLITTER
# ---------------------------------------------------------------------------------
#
# It is possible to allow these scripts to install the beast-splitter application
@ -343,8 +363,8 @@ BEASTSPLITTER_UPGRADE="false"
BEASTSPLITTER_LISTEN_PORT="30005"
BEASTSPLITTER_CONNECT_PORT="30104"
## DUCK DNS FREE DYNAMIC DNS HOSTING
# ---------------------------------------------------------------------------------
# DUCK DNS FREE DYNAMIC DNS HOSTING
# ---------------------------------------------------------------------------------
#
# These scripts are capable of setting up your receiver to use Duck DNS for dynamic
@ -363,4 +383,4 @@ DUCKDNS_UPGRADE="false"
# supply the subdomain and key supplied to you by duckdns.org.
DUCKDNS_DOMAIN=""
DUCKDNS_TOKEN=""
DUCKDNS_TOKEN=""