echo
echo "--== Let's start with EasyBuild ==--"
echo
yum -y install \
autoconf \
environment-modules \
gcc \
gcc-c++ \
libibverbs-devel \
openssl-devel \
patch \
wget \
libX11-devel \
unzip \

curl -s -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py
#dot -Tps  /tmp/test.dot > /tmp/test.ps
#dot -Tsvg /tmp/test.dot > /tmp/test.svg
#dot -Tpng /tmp/test.dot > /tmp/test.png

pip install python-graph-core
pip install python-graph-dot

su - vagrant -c 'EASYBUILD_PREFIX=$HOME/.local/easybuild ;\
curl -s -O https://raw.githubusercontent.com/hpcugent/easybuild-framework/develop/easybuild/scripts/bootstrap_eb.py ;\
python bootstrap_eb.py $EASYBUILD_PREFIX ;\
module use $EASYBUILD_PREFIX/modules/all ;\
module load EasyBuild ;\
eb --modules-tool=EnvironmentModulesC --module-syntax=Tcl Lmod-6.4.2.eb -r --hide-deps=zlib,ncurses,binutils,gettext,Lmod,Lua,flex,libtool,Bison,libevent;\
echo "EASYBUILD_PREFIX=\$HOME/.local/easybuild" >> .bashrc ;\
echo "export FTP_PROXY='http://repository.it4i.cz:3128'" >> .bashrc ;\
#echo "module use \$EASYBUILD_PREFIX/modules/all" >> .bashrc ;\
echo ". /home/vagrant/.local/easybuild/software/Lmod/6.4.2/lmod/lmod/init/profile" >> .bashrc ;\
echo "module load EasyBuild" >> .bashrc ;\
echo "module avail" >> .bashrc ;\
echo "module list" >> .bashrc ;\'

mv /usr/bin/modulecmd{,.exe}
cd /usr/bin/
curl -O https://raw.githubusercontent.com/hpcugent/environment-modules/master/SOURCES/modulecmd
chmod +x modulecmd

#comment out modules path
#sed -i  's/^\([^#]\)/#\1/g' /usr/share/Modules/init/.modulespath


#ls -d1 /home/vagrant/.local/easybuild/modules/*  | grep -v all > /usr/share/Modules/init/.modulespath
#module load EasyBuild
##build lmod module