# Exploratory 2.5.0.0 Linux Ubuntu 16.04 Install Script. Run with ordinary user!

sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

sudo apt-get update 
sudo apt-get install r-base r-base-dev git curl libssl-dev libpq-dev libxml2-dev libcurl4-openssl-dev libsodium-dev libmariadb-client-lgpl-dev libsasl2-dev
mkdir ~/.exploratory
mkdir ~/.exploratory/R
mkdir ~/.exploratory/R/3.3
cd ~/.exploratory/
curl -O http://download2.exploratory.io/linux/install_2.5.0.0.R
chmod o+rx ./install_2.5.0.0.R
# This line bellow would be better to change in the install.R script (satisfies need for R repo specification):
sed -i 's/dependencies=TRUE/dependencies=TRUE, repos="http:\/\/cran.rstudio.com\/"/g' ./install_2.5.0.0.R 
sed -i s/your_os_username/$USER/g ./install_2.5.0.0.R 
Rscript ./install_2.5.0.0.R
curl -O http://download2.exploratory.io/linux/Exploratory_2.5.1.2_LINUX.zip
cd ~/
unzip .exploratory/Exploratory_2.5.1.2_LINUX.zip
PATH=$PATH:~/Exploratory/
echo "Exploratory Desktop is installed. To start it up, run ~/Exploratory/Exploratory from the Terminal."
