diff --git a/install.sh b/install.sh index eb9aa95..748997c 100755 --- a/install.sh +++ b/install.sh @@ -12,9 +12,11 @@ remoteexecutable="http://raw.github.com/Karajlug/KusoIDE/1.0/bin/kuso" conffile=conf/dotkuso +REQUIRMENTS=(emacs git) + # Coloring Functions function info() { - echo -e "[\033[01;32mINFO\033[00m]: $1" + echo -ne "[\033[01;32mINFO\033[00m]: $1" } function error(){ @@ -25,8 +27,34 @@ function warn(){ echo -e "[\033[01;33mWARN\033[00m]: $1" } +function requirments_check(){ + for app in "${REQUIRMENTS[@]}" + do + echo -ne "[\033[01;32mINFO\033[00m]: $app \033[01;34m[CHEKING]\033[00m \r" + if hash $1 2>/dev/null; then + echo -ne "[\033[01;32mINFO\033[00m]: $app \033[01;34m[OK]\033[00m \n" + else + REQUIRMENT_CHECK=false + echo -ne "[\033[01;32mINFO\033[00m]: $app \033[01;31m[ERR]\033[00m \n" + fi + done +} + # Gathering informations echo -e "\n\033[01;32mKuso IDE\033[00m $VERSION copyright 2010-2013 \033[01;34mSameer Rahmani \033[00m\n\n" + +# Requirments check to make sure everything is ok +echo -e "Requirment Check" +# if this variable changed to fasle , means we have something to install +REQUIRMENT_CHECK=true +requirments_check $REQUIRMENTS +# exit if our requirement check +if [ $REQUIRMENT_CHECK == false ]; then + error "Please install requirments first"; + exit; +fi +echo -e "\n\n" + echo "Enter requested informations. You can change it later in top" echo -e "your init file.\n\n"