Skip to content

Instantly share code, notes, and snippets.

@dschaper
Last active October 16, 2015 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dschaper/09f7947c7bca0d965382 to your computer and use it in GitHub Desktop.
Save dschaper/09f7947c7bca0d965382 to your computer and use it in GitHub Desktop.
#!/bin/bash
clear
echo ""
echo -e "\033[31m########################################"
echo "Dump1090-mutability Installation Script"
echo "########################################"
echo ""
echo -e "\033[33mThis script will build then install dump-1090-mutability."
echo -e "\033[37m dump1090-mutability: https://github.com/mutability/dump1090"
echo ""
echo -e "\033[33mThe following packages will also be installed which are required to build and run the resulting package."
echo -e "\033[37m git, build-essential, debhelper, librtlsdr-dev, libusb-1.0-0-dev, and pkg-config."
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
clear
## SET UP BUILD ENVIRONMENT
echo ""
echo -e "\033[33mPlease specify a directory in which to download and build the source for dump1090."
echo "This directory will be created for you if it does not already exist."
echo -e "\033[37m"
NOBUILDDIR="true"
GIT="false"
while [[ $NOBUILDDIR == 'true' ]]
do
read -p "Build Directory Path: [$PWD/build] " BUILDDIR
if [[ $BUILDDIR == '' ]]; then
BUILDDIR="$PWD/build"
fi
# Create the build directory then make sure it exists.
if [ ! -d "$BUILDDIR" ]; then
echo ""
mkdir -p $BUILDDIR
fi
if [ -d "$BUILDDIR" ]; then
NOBUILDDIR="false"
else
echo "Please make sure the path specified is valid or try another path."
echo -e "\033[37m"
fi
if [ -d "$BUILDDIR/dump1090" ]; then
GIT='true'
fi
done
cd $BUILDDIR
## INSTALL PREREQUISITES
clear
echo -e "\033[33m"
echo "We are now ready to start building then installing dump1090-mutability."
echo "First the packages needed to build and fulfill dependencies will be installed."
echo "Once this is done the source code for dump1090 will be downloaded GitHub."
echo "The source code will then be used to build the dump1090 package."
echo "After the package is built it will be installed on this system."
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
## INSTALL PREREQUISITES
clear
echo -e "\033[33m"
echo "Installing packages to build and fulfill dependencies..."
echo -e "\033[37m"
sudo apt-get update
sudo apt-get -y install git build-essential debhelper librtlsdr-dev libusb-1.0-0-dev pkg-config
## DOWNLOAD THE DUMP1090 SOURCE
echo -e "\033[33m"
echo "Downloading the source code for dump1090..."
echo -e "\033[37m"
if [[ $GIT == 'true' ]]; then
cd $BUILDDIR/dump1090
git pull
else
git clone https://github.com/mutability/dump1090.git
fi
## BUILD THE DUMP1090-MUTABILITY PACKAGE
echo -e "\033[33m"
echo "Building the dump1090-mutability package..."
echo -e "\033[37m"
cd $BUILDDIR/dump1090
dpkg-buildpackage -b
## INSTALL THE DUMP1090-MUTABILITY PACKAGE
echo -e "\033[33m"
echo "Installing the dump1090-mutability package..."
echo -e "\033[37m"
sudo dpkg -i $BUILDDIR/dump1090-mutability_1.15~dev_*.deb
## DISPLAY MESSAGE STATING DUMP1090 SETUP IS COMPLETE
echo -e "\033[33m"
echo "Installation of dump-1090-mutability is now complete."
echo "Feel free to look over the output generated to be sure no errors were encountered."
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
## ASK IF A WEB INTERFACE IS WANTED
clear
echo -e "\033[33m"
echo "Output from dump1090-mutability can be displayed to a web browser using Lighttpd."
echo "At this point this feature is not set up however this script can install and configure Lighttpd for you if you wish."
echo "This step is a totally optional step and can be skipped if you do not need or want this feature."
echo -e "\033[37m"
read -p "Install Lighttpd: [Y/n] " LIGHTTPD
if [[ ! $LIGHTTPD =~ ^[Nn]$ ]]; then
## INSTALL LIGHTTPD
echo -e "\033[33m"
echo "Installing the lighttpd package..."
echo -e "\033[37m"
sudo apt-get -y install lighttpd
## CONFIGURE LIGHTTPD
echo -e "\033[33m"
echo "Configuring lighttpd..."
echo -e "\033[37m"
sudo lighty-enable-mod dump1090
sudo /etc/init.d/lighttpd force-reload
## DISPLAY WEB INTERFACE INFORMATION
echo -e "\033[33m"
echo "Installation and configuration of Lighttpd is now complete."
echo "Again feel free to look over the output to be sure no errors were encountered."
echo "A web page displaying output from dump1090-mutability is now located at the address:."
echo "http://localhost/dump1090"
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
fi
## EXIT THE SCRIPT
cd $PWD
clear
echo -e "\033[33m"
echo "I hope you enjoyed using this script to install dump1090-mutability."
echo "If you ran into any issues using this script feel free to message me on the FlightAware forums."
echo "My name on the FlightAware forums is jprochazka."
echo ""
echo "Good luck and happy tracking!"
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
clear
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment