#!/bin/sh

# install software
sudo apt-get install apache2 rtl-sdr librtlsdr-dev libncurses-dev python-gi-cairo

# script
mkdir -p ~/bin
cp ads-b.sh ~/bin

# rules
sudo cp *.rules /etc/udev/rules.d
sudo service udev restart

# apache setup
sudo cp dump1090-fa.conf /etc/apache2/conf-enabled/
sudo service apache2 restart

# dump1090 build and install
mkdir -p ~/src
cd ~/src
git clone https://github.com/flightaware/dump1090
cd dump1090
make
sudo mkdir -p /var/www/html/dump1090-fa
sudo cp -a public_html/* /var/www/html/dump1090-fa
cd ~/pi_tools/Projects/ADS-B
ln -fs ~/src/dump1090

# dump1090 config
sudo cp config.js /var/www/html/dump1090-fa
cd /var/www/html/dump1090-fa
sudo ln -fs /run/dump1090-fa data
