#!/bash/bash
FABRIC_PKG="Fabric-1.9.2"


function fabric_install() 
{
	for a in  python-devel python-setuptools gcc wget
	do
		yum -y install ${a}
	done

	wget -c https://pypi.python.org/packages/source/F/Fabric/${FABRIC_PKG}.tar.gz
	tar axvf ${FABRIC_PKG}.tar.gz
	cd ${FABRIC_PKG}
	python setup.py install

	fab -V>/dev/null 2>&1
	[[ $? -eq 0 ]] && echo -e "\e[1;35m Good Luck,Fabric Install Successful \e[0m" || echo -e "\e[1;35m Sorry,Fabric Install Failed! \e[0m" 
	
	fab -f deploy.py go
}


fab -V>/dev/null 2>&1
if [[ $? -eq 0 ]]; then
	echo -e "\e[1;35m Good Luck,Fabric Install Successful \e[0m";
	fab -f deploy.py go
else
	echo -e "\e[1;35m Sorry,Fabric Install Failed! \e[0m" 
	fabric_install
fi
