#!/bin/bash

coliopRelease=1.18.2

if [[ $OSTYPE == *darwin* ]] ||  [[ $OSTYPE == *linux* ]] ; then
	if test -d "coliop-${coliopRelease}" ; then 
		echo "Coliop-${coliopRelease} exists"
	else
		echo "downloading Coliop" 
		wgetcmd=wget
		wgetcount=`which wget 2>/dev/null | wc -l`
		if test ! $wgetcount = 1; then
  			if [[ $OSTYPE == *darwin* ]] ; then
    			wgetcmd=ftp
  			else
    			exit -1
    		fi
  		fi
  		rm -f coliop*.zip
		$wgetcmd http://cmpl.th-wildau.de/download/coliop/coliop-${coliopRelease}.tar.gz
		gunzip -f coliop-${coliopRelease}.tar.gz
		tar xf coliop-${coliopRelease}.tar
		rm coliop-${coliopRelease}.tar

	fi
else 
	echo "Please download Coliop-${coliopRelease} from http://cmpl.th-wildau.de/download/coliop/coliop-${coliopRelease}.zip"
fi
		
