#!/bin/bash
install_key=`cat install.key`
IFS=':' read -ra install_params <<< "$install_key"
selectedserver=${install_params[0]}
echo "$selectedserver"
# SINGLE SERVER
if [[ "$selectedserver" == "0" ]]; then

cd ../installables/
wget --user="wardrobe" --password="be0O5tar@P"  https://dns.parablu.com/parablu_installables/scripts/parablu_deployment/debpackages/all_deb_single.zip

#sleep 2s
unzip -oqq all_deb_single.zip
dpkg -R --install deb
echo 'Y'| apt-get -f install
sleep 2s
dpkg -R --install deb
echo 'Y' | apt --fix-broken install
echo 'Y' | apt-get update


fi

# PARACLOUD SERVER
if [[ "$selectedserver" == "1" ]]; then


#cd ../installables/
cd ../installables/
wget --user="wardrobe" --password="be0O5tar@P"  https://dns.parablu.com/parablu_installables/scripts/parablu_deployment/debpackages/all_deb_paracloud.zip
#sleep 2s
unzip -oqq all_deb_paracloud.zip
dpkg -R --install deb
echo 'Y'| apt-get -f install
sleep 2s
dpkg -R --install deb
echo 'Y' | apt --fix-broken install
echo 'Y' | apt-get update


fi

#BLUKRYPT SERVER
if [[ "$selectedserver" == "2" ]]; then

#cd ../installables/
#cd ../installables/
cd ../installables/
wget --user="wardrobe" --password="be0O5tar@P"  https://dns.parablu.com/parablu_installables/scripts/parablu_deployment/debpackages/all_deb_blukrypt.zip
#sleep 2s
unzip -oqq all_deb_blukrypt.zip
sleep 3s
dpkg -R --install deb
echo 'Y'| apt-get -f install
sleep 2s
dpkg -R --install deb
echo 'Y' | apt --fix-broken install
echo 'Y' | apt-get update



fi


#MONGO SERVER
if [[ "$selectedserver" == "3" ]]; then

cd ../installables/
wget --user="wardrobe" --password="be0O5tar@P"  https://dns.parablu.com/parablu_installables/scripts/parablu_deployment/debpackages/all_deb_mongo.zip
#sleep 2s
unzip -oqq all_deb_mongo.zip
dpkg -R --install deb
echo 'Y'| apt-get -f install
sleep 2s
dpkg -R --install deb
echo 'Y' | apt --fix-broken install
echo 'Y' | apt-get update


fi

# PARACLOUD/BLUKRYPT SERVER
if [[ "$selectedserver" == "1 2" ]]; then

cd ../installables/
wget --user="wardrobe" --password="be0O5tar@P"  https://dns.parablu.com/parablu_installables/scripts/parablu_deployment/debpackages/all_deb_pcbk.zip
#sleep 2s
unzip -oqq all_deb_pcbk.zip
dpkg -R --install deb
echo 'Y'| apt-get -f install
sleep 2s
dpkg -R --install deb
echo 'Y' | apt --fix-broken install
echo 'Y' | apt-get update


fi

# MONGO/PARACLOUD SERVER
if [[ "$selectedserver" == "3 1" ]]; then

cd ../installables/
wget --user="wardrobe" --password="be0O5tar@P"  https://dns.parablu.com/parablu_installables/scripts/parablu_deployment/debpackages/all_deb_single.zip
#sleep 2s
unzip -oqq all_deb_single.zip
dpkg -R --install deb
echo 'Y'| apt-get -f install
sleep 2s
dpkg -R --install deb
echo 'Y' | apt --fix-broken install
echo 'Y' | apt-get update

fi
