#!/bin/bash
# Bash Menu Script Example

##R1 V1##
####Chanches For V1####
#Added Vraiables and executes for them#

echo "UBUNTU 18.04 INSTALLATIE SCRIPT"
echo "Webserver:"
PS3='Keuze:'
options=("Apache" "Apache, Nginx reverse proxy" "Nginx, PHP-FPM" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Apache")
            webserver=apache
            break
            ;;
        "Apache, Nginx reverse proxy")
            webserver=apache_nginx
            break
            ;;
        "Nginx, PHP-FPM")
            webserver=nginx
            break
            ;;
        "Quit")
            exit
            ;;
        *) echo "Fout antwoord $REPLY";;
    esac
done

while true; do
    read -p "Installeer VestaCP webpanel -> yes/no?" yn
    case $yn in
        [Yy]* ) vestacp=1 phpmyadmin=0
        break;;
        [Nn]* ) vestacp=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done

while (( $vestacp != 1 )); do
    read -p "Installeer PHPmyAdmin -> yes/no?" yn
    case $yn in
        [Yy]* ) phpmyadmin=1
        break;;
        [Nn]* ) phpmyadmin=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done

while true; do
    read -p "Installeer Postfix -> yes/no?" yn
    case $yn in
        [Yy]* ) postfix=1
        break;;
        [Nn]* ) postfix=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done

while true; do
    read -p "Installeer Netdata -> yes/no?" yn
    case $yn in
        [Yy]* ) netdata=1
        break;;
        [Nn]* ) netdata=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done

while true; do
    read -p "Installeer Memcached -> yes/no?" yn
    case $yn in
        [Yy]* ) memcached=1
        break;;
        [Nn]* ) memcached=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done

while true; do
    read -p "Installeer Redis Cache -> yes/no?" yn
    case $yn in
        [Yy]* ) redis=1
        break;;
        [Nn]* ) redis=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done

while true; do
    read -p "Installeer Let's Encrypt -> yes/no?" yn
    case $yn in
        [Yy]* ) certbot=1
        break;;
        [Nn]* ) certbot=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done

while true; do
    read -p "Installeer Wordpress -> yes/no?" yn
    case $yn in
        [Yy]* ) wordpress=1
        break;;
        [Nn]* ) wordpress=0
        break;;
        * ) echo "Kies yes of no.";;
    esac
done
echo "***************************"
sleep 0.5
echo "INSTALLATIE DUURT 5 Minuten"
sleep 0.5
echo "***************************"




if [ $webserver = apache ]
    then
        echo "install apache"
fi
if [ $webserver = apache_nginx ]
    then
        echo "install apache_nginx"
fi
if [ $webserver = nginx ]
    then
       echo "install NGINX"
fi

if [ $vestacp = 1 ]
then
    echo "install vesta CP"
fi

if [ $phpmyadmin = 1 ]
then
    echo "install php myadmin"
fi

if [ $postfix = 1 ]
then
    echo "install postfix"
fi

if [ $netdata = 1 ]
then
    echo "install netdata"
fi

if [ $memcached = 1 ]
then
    echo "install memcached"
fi

if [ $redis = 1 ]
then
    echo "install redis"
fi

if [ $certbot = 1 ]
then
    echo "install Let's Encrypt Certbot"
fi

if [ $wordpress = 1 ]
then
    echo "install wordpress"
fi
echo "Install Sucsess"
exit
