
echo 'This code assumes you already have iraf installed'

apt-get install gfortran liblapack-dev libblas-dev g++ python-gtk2 python-gtk2-dev python-wxgtk2.8 python-wxtools libfreetype6-dev python-qt4 python-qt4-dev tk8.5 tk8.5-dev tcl8.5 tcl8.5-dev python-tz texlive dvipng python-dateutil tk libqt4-dev lsb-release tcsh sharutils lynx libc6-dev libncurses5-dev python-pmw libf2c2 python-urwid python-dev libx11-dev libcfitsio3-dev pgplot5 python-mysqldb mysql-server mysql-client libxt-dev libxaw7-dev openjdk-6-source openjdk-6-jre libmotif-dev unzip fort77 cfortran gv cups-bsd cups-common cups mc python-setuptools python-numpy python-scipy python-matplotlib python-pip

pip install stscipython
pip install astropy
pip install pyfits 
pip install pywcs
pip install aplpy
pip install pyephem
pip install pyspectrograph

wget http://hea-www.harvard.edu/RD/download/pyds9/pyds9-1.6.tar.gz
tar zxvf pyds9-1.6.tar.gz
cd pyds9-1.6
python setup.py install
cd ../


#creating the pysalt installation
wget http://pysalt.salt.ac.za/versions/pysalt.v0.42.tar.gz
tar xvf pysalt.v0.42.tar.gz
cd pysalt
Make

echo 'Installation Complete  but the user should follow these instructions to install in home directory:'
#create iraf in the home directory
echo 'cd '
echo 'mkdir iraf'
echo 'cd iraf'
echo 'mkiraf'
echo ''
echo 'To run pysalt, the user should insert the '
echo 'following lines into their login.cl:'
echo 
echo '   reset pysalt = "/[PATH]/pysalt/"'
echo '   task  pysalt.pkg   = "pysalt$pysalt.cl"'
echo '   reset helpdb    = (envget("helpdb") // ",pysalt$lib/helpdb.mip")'
echo
echo '[PATH] should be set to the path where pysalt is installed'

echo 'For CAMK participants or anyone with iraf installed in a non-standard location, you may need to add the following two lines'
echo 'to your .bashrc:'
echo 'export iraf=/Vol/share/iraf-2.14/iraf/'
echo 'export IRAFARCH=redhat'

echo ''
echo 'If everything worked, you should be able to run the following without any errors:'
echo '>pyraf'
echo '-->pysalt'
echo '-->saltspec'
