install.sh 2.09 KB
#!/bin/bash

read -r -p "Deseja fazer o download das dependências? [Y/n] " response
 response=${response,,} # tolower
 if [[ $response =~ ^(yes|y| ) ]]; then
    mkdir ~/vlibras-libs
	cd ~/vlibras-libs

	mkdir aelius
	cd aelius

	wget 150.165.204.30:8080/translate/linux/aelius-install.tar.gz

	MACHINE_TYPE=`uname -m`
	if [ ${MACHINE_TYPE} == 'x86_64' ]; then
		wget 150.165.204.30:8080/translate/linux/hunpos/x86_64/hunpos-tag
	else
		wget 150.165.204.30:8080/translate/linux/hunpos/i386/hunpos-tag
	fi

     read -r -p "Deseja instalar as dependências? [Y/n] " response
	 response=${response,,} # tolower
	 if [[ $response =~ ^(yes|y| ) ]]; then
	    echo -e "\n# Extraindo...\n"
		tar -xf aelius-install.tar.gz -C .
		mkdir bin
		mv hunpos-tag bin/
		chmod 777 bin/hunpos-tag
	
		echo -e "# Instalando dependências...\n"
		sudo apt-get update
		sudo apt-get install -y python-dev python-setuptools python-pip python-yaml python-numpy python-matplotlib
		sudo pip install nltk nltk_tgrep --upgrade 

	 fi

	 read -r -p "Deseja limpar os arquivos temporários? [Y/n] " response
	 response=${response,,} # tolower
	 if [[ $response =~ ^(yes|y| ) ]]; then
	    rm ~/vlibras-libs/aelius/aelius-install.tar.gz
	 fi

 fi


read -r -p "Deseja criar as variáveis de ambiente? [Y/n] " response
 response=${response,,} # tolower
 if [[ $response =~ ^(yes|y| ) ]]; then
    # path to Hunpos Tag
	echo -e "\nHUNPOS_TAGGER=\"$HOME/vlibras-libs/aelius/bin/hunpos-tag\"" >> ~/.bashrc
	echo -e "export HUNPOS_TAGGER" >> ~/.bashrc

	# path to Aelius Data
	echo -e "\nAELIUS_DATA=\"$HOME/vlibras-libs/aelius/aelius_data\"" >> ~/.bashrc
	echo -e "export AELIUS_DATA" >> ~/.bashrc

	# path to NLTK Data
	echo -e "\nNLTK_DATA=\"$HOME/vlibras-libs/aelius/nltk_data\"" >> ~/.bashrc
	echo -e "export NLTK_DATA" >> ~/.bashrc

	# path to Aelius and Translate package (new version)
	echo -e "\nPYTHONPATH=\"${PYTHONPATH}:$HOME/vlibras-libs/aelius:$HOME/vlibras-translate/src\"" >> ~/.bashrc
	echo -e "export PYTHONPATH\n" >> ~/.bashrc

	echo -e "\n## Execute o seguinte comando para concluir:\n\n$ source ~/.bashrc\n"
 fi

echo -e "### Instalação finalizada!"