# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------
+#!/bin/bash -e
-#!/bin/bash
+###########################################
+function getDistrib {
+ local OS=`uname`
-rm -rf Creatools
-mkdir Creatools
-cd Creatools
-wget http://www.creatis.insa-lyon.fr/software/public/creatools/creaTools/creatools-Linux-BinVersion.sh
-source creatools-Linux-BinVersion.sh
+ if [ "$OS" == Darwin ] ; then OS=MacOS;
+ elif [ "$OS" == Linux ] ; then OS=`awk 'NR==1{print $1}' /etc/issue`
+ else OS=""
+ fi
+# checkDistrib $OS
+ echo $OS
+}
+
+
+OperatingSystem=`getDistrib`
+
+ case "$OperatingSystem" in
+ Mandriva)
+ echo Root password:
+ su -c "urpmi aria2"
+ downloadCpmmand=aria2
+ ;;
+ Fedora)
+ echo Root password:
+ su -c "yum install aria2 -y"
+ downloadCpmmand=aria2
+ ;;
+ Ubuntu)
+ echo Root password:
+ su -c "apt-get --yes install wget"
+ downloadCpmmand=wget
+ ;;
+ MacOS)
+ port install curl -y
+ downloadCpmmand=curl
+ ;;
+ *)
+ echo " '$OperatingSystem' : Unknown (for us...) Operating Sytem "
+ echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
+// exit 0
+ ;;
+ esac
+
+CREATOOLSBINDIR=Creatools-Bin
+rm -rf $CREATOOLSBINDIR
+mkdir $CREATOOLSBINDIR
+cd $CREATOOLSBINDIR
+$downloadCpmmand http://www.creatis.insa-lyon.fr/software/public/creatools/creaTools/creatools-Linux-Bin.sh
+source creatools-Linux-Bin.sh
cd ..
+