adsb-receiver/install.sh

179 wiersze
7.8 KiB
Bash
Czysty Zwykły widok Historia

2015-11-04 04:48:08 +00:00
#!/bin/bash
#####################################################################################
# ADS-B RECEIVER #
2015-11-04 04:48:08 +00:00
#####################################################################################
# #
# A set of scripts created to automate the process of installing the software #
# needed to setup a Mode S decoder as well as feeders which are capable of #
# sharing your ADS-B results with many of the most popular ADS-B aggregate sites. #
# #
# Project Hosted On GitHub: https://github.com/jprochazka/adsb-receiver #
2015-11-04 04:48:08 +00:00
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
2016-09-01 21:06:18 +00:00
# Copyright (c) 2015-2016 Joseph A. Prochazka #
2015-11-04 04:48:08 +00:00
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy #
# of this software and associated documentation files (the "Software"), to deal #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included in all #
# copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
2015-12-17 04:38:06 +00:00
## VARIABLES
2016-12-06 06:02:03 +00:00
PROJECTBRANCH="master"
2016-09-01 21:06:18 +00:00
PROJECTROOTDIRECTORY="$PWD"
2016-09-07 18:58:30 +00:00
BASHDIRECTORY="$PROJECTROOTDIRECTORY/bash"
BUILDDIRECTORY="$PROJECTROOTDIRECTORY/build"
2015-11-04 04:48:08 +00:00
2016-09-07 17:08:43 +00:00
## INCLUDE EXTERNAL SCRIPTS
2016-09-01 21:06:18 +00:00
source $BASHDIRECTORY/functions.sh
2015-11-04 04:48:08 +00:00
2016-09-23 21:10:29 +00:00
## MORE VARIABLES
export ADSB_PROJECTTITLE="The ADS-B Receiver Project Installer"
2016-12-05 18:08:58 +00:00
TERMINATEDMESSAGE=" \e[91m ANY FURTHER SETUP AND/OR INSTALLATION REQUESTS HAVE BEEN TERMINIATED\e[39m"
2016-09-07 18:58:30 +00:00
2016-09-23 21:10:29 +00:00
## CHECK IF THIS IS THE FIRST RUN USING THE IMAGE RELEASE
if [ -f $PROJECTROOTDIRECTORY/image ]; then
# Execute image setup script..
chmod +x $BASHDIRECTORY/image.sh
$BASHDIRECTORY/image.sh
if [ $? -ne 0 ]; then
echo ""
echo -e $TERMINATEDMESSAGE
echo ""
exit 1
fi
exit 0
fi
## FUNCTIONS
2016-09-02 20:47:46 +00:00
# UPDATE REPOSITORY PACKAGE LISTS
2015-12-17 04:38:06 +00:00
function AptUpdate() {
2015-11-04 04:48:08 +00:00
clear
2016-09-13 18:39:47 +00:00
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
2016-09-01 21:06:18 +00:00
echo ""
echo -e "\e[92m Downloading the latest package lists for all enabled repositories and PPAs..."
2016-09-02 19:17:31 +00:00
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
2016-09-01 21:06:18 +00:00
echo ""
2015-12-17 04:38:06 +00:00
sudo apt-get update
2016-12-01 18:42:34 +00:00
echo ""
2016-09-02 19:17:31 +00:00
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
2016-09-01 21:06:18 +00:00
echo -e "\e[92m Finished downloading and updating package lists.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
2015-12-17 04:38:06 +00:00
}
2015-11-04 04:48:08 +00:00
2016-12-01 18:42:34 +00:00
function CheckPrerequisites() {
2015-11-04 04:48:08 +00:00
clear
2016-09-13 18:39:47 +00:00
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
2016-09-01 21:06:18 +00:00
echo ""
2016-12-01 18:42:34 +00:00
echo -e "\e[92m Checking to make sure the whiptail and git packages are installed..."
2016-09-02 19:17:31 +00:00
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
2016-09-01 21:06:18 +00:00
echo ""
2016-09-23 21:10:29 +00:00
CheckPackage whiptail
2016-12-01 18:42:34 +00:00
CheckPackage git
2016-09-01 21:06:18 +00:00
echo ""
2016-09-02 19:17:31 +00:00
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
2016-12-01 18:42:34 +00:00
echo -e "\e[92m The whiptail and git packages are installed.\e[39m"
2016-09-01 21:06:18 +00:00
echo ""
2015-11-04 04:48:08 +00:00
read -p "Press enter to continue..." CONTINUE
2015-12-17 04:38:06 +00:00
}
2015-11-04 04:48:08 +00:00
2016-09-23 21:10:29 +00:00
function UpdateRepository() {
## UPDATE THIS REPOSITORY
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Pulling the latest version of the ADS-B Receiver Project repository..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
2016-11-29 21:43:37 +00:00
echo -e "\e[94m Switching to branch $PROJECTBRANCH...\e[97m"
echo ""
git checkout $PROJECTBRANCH
echo ""
2016-09-23 21:10:29 +00:00
echo -e "\e[94m Pulling the latest git repository...\e[97m"
echo ""
git pull
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Finished pulling the latest version of the ADS-B Receiver Project repository....\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
2015-12-17 04:38:06 +00:00
}
2015-11-04 04:48:08 +00:00
2016-09-23 21:10:29 +00:00
# UPDATE THE OPERATING SYSTEM
function UpdateOperatingSystem() {
clear
echo -e "\n\e[91m $ADSB_PROJECTTITLE"
echo ""
echo -e "\e[92m Downloading and installing the latest updates for your operating system..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
sudo apt-get -y dist-upgrade
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Your operating system should now be up to date.\e[39m"
echo ""
read -p "Press enter to continue..." CONTINUE
2015-12-17 04:38:06 +00:00
}
2015-11-04 04:48:08 +00:00
2016-09-07 18:58:30 +00:00
AptUpdate
2016-12-01 18:42:34 +00:00
CheckPrerequisites
2016-09-23 21:10:29 +00:00
UpdateRepository
2015-11-04 04:48:08 +00:00
2016-09-23 21:10:29 +00:00
## DISPLAY WELCOME SCREEN
2016-09-14 21:22:11 +00:00
2016-09-23 21:10:29 +00:00
## ASK IF OPERATING SYSTEM SHOULD BE UPDATED
2015-12-23 01:13:54 +00:00
if (whiptail --backtitle "$ADSB_PROJECTTITLE" --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) then
UpdateOperatingSystem
2015-12-17 04:38:06 +00:00
fi
2015-11-04 04:48:08 +00:00
2016-09-23 21:10:29 +00:00
## EXECUTE BASH/MAIN.SH
2015-11-04 04:48:08 +00:00
chmod +x $BASHDIRECTORY/main.sh
$BASHDIRECTORY/main.sh
if [ $? -ne 0 ]; then
echo -e $TERMINATEDMESSAGE
echo ""
exit 1
fi
2015-11-04 04:48:08 +00:00
2015-12-17 04:38:06 +00:00
## INSTALLATION COMPLETE
2015-11-04 04:48:08 +00:00
2015-12-17 04:38:06 +00:00
# Display the installation complete message box.
2016-09-23 21:10:29 +00:00
whiptail --backtitle "$ADSB_PROJECTTITLE" --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
2016-09-13 18:39:47 +00:00
# Unset any exported variables.
unset ADSB_PROJECTTITLE
2015-12-19 08:51:05 +00:00
2016-09-23 21:10:29 +00:00
# Remove the FEEDERCHOICES file created by whiptail.
2015-12-19 08:51:05 +00:00
rm -f FEEDERCHOICES
2015-11-04 04:48:08 +00:00
2015-12-21 22:37:41 +00:00
echo -e "\033[32m"
2015-12-19 09:39:04 +00:00
echo "Installation complete."
echo -e "\033[37m"
2015-12-17 04:38:06 +00:00
exit 0