diff --git a/LBConverter.tar.gz b/LBConverter.tar.gz new file mode 100755 index 0000000..a2177ad Binary files /dev/null and b/LBConverter.tar.gz differ diff --git a/ez_i.sh b/ez_i.sh new file mode 100755 index 0000000..2ee740c --- /dev/null +++ b/ez_i.sh @@ -0,0 +1,823 @@ +#!/bin/bash +: 'Trata-se de um módulo que oferece uma série de funcionalidades para +criar um instalador usando "bash". + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ +Copyright 2016 Eduardo Lúcio Amorim Costa +' + +# NOTE: Obtêm a pasta do script atual para que seja usado como +# caminho base/referência durante a instalação! By Questor +EZ_I_DIR_V="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# NOTE: Quando setado faz "ez_i" desabilitar algumas funções, +# notadamente aquelas que envolvem "perguntas ao usuário" e as +# gráficas! By Questor +EZ_I_SKIP_ON_V=0 + +# > -------------------------------------------------------------------------- +# UTILITÁRIOS! +# -------------------------------------- + +f_enter_to_cont() { + : 'Solicitar ao usuário que pressione enter para continuar. + + Args: + INFO_P (Optional[str]): Se informado apresenta uma mensagem ao + usuário. + ' + + INFO_P=$1 + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + + if [ ! -z "$INFO_P" ] ; then + f_div_section + echo "$INFO_P" + f_div_section + fi + + read -p "Press enter to continue..." nothing +} + +GET_USR_INPUT_R="" +f_get_usr_input() { + : 'Obter entradas digitadas pelo usuário. + + Permite autocomplete (tab). Enter para submeter a entrada. + + Args: + QUESTION_P (str): Pergunta a ser feita ao usuário. + ALLOW_EMPTY_P (Optional[int]): 0 - Não permite valor vazio; 1 - Permite + valor vazio. Padrão 0. + + Returns: + GET_USR_INPUT_R (str): Entrada digitada pelo usuário. + ' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + QUESTION_P=$1 + ALLOW_EMPTY_P=$2 + if [ -z "$ALLOW_EMPTY_P" ] ; then + ALLOW_EMPTY_P=0 + fi + GET_USR_INPUT_R="" + read -e -r -p "$QUESTION_P (use enter to confirm): " RESP_V + if [ -n "$RESP_V" ] ; then + GET_USR_INPUT_R="$RESP_V" + elif [ ${ALLOW_EMPTY_P} -eq 0 ] ; then + f_get_usr_input "$QUESTION_P" 0 + fi +} + +F_EZ_SED_ECP_R="" +f_ez_sed_ecp() { + : '"Escapar" strings para o comando "sed". + + Como há muitas semelhanças entre o escape para "sed" ("f_ez_sed") e + escape para "grep" ("f_fl_cont_str") optei por colocar essa + função como utilitária para as outras duas citadas. + + Args: + VAL_TO_ECP (str): Valor a ser "escapado". + DONT_ECP_NL (Optional[int]): 0 - Não "escapa" "\n" (quebra de + linha); 1 - "Escapa" "\n". Padrão 1. + DONT_ECP_SQ (Optional[int]): 0 - Não "escapa" "'" (aspas + simples); 1 - "Escapa" "'". Padrão 0. NOTE: Usado apenas pela + função "f_fl_cont_str". + + Returns: + F_EZ_SED_ECP_R (str): Valor "escapado". + ' + + VAL_TO_ECP=$1 + DONT_ECP_NL=$2 + if [ -z "$DONT_ECP_NL" ] ; then + DONT_ECP_NL=1 + fi + DONT_ECP_SQ=$3 + if [ -z "$DONT_ECP_SQ" ] ; then + DONT_ECP_SQ=0 + fi + F_EZ_SED_ECP_R=$VAL_TO_ECP + if [ ${DONT_ECP_NL} -eq 1 ] ; then + F_EZ_SED_ECP_R=$(echo "$F_EZ_SED_ECP_R" | sed 's/\\n/C0673CECED2D4A8FBA90C9B92B9508A8/g') + fi + F_EZ_SED_ECP_R=$(echo "$F_EZ_SED_ECP_R" | sed 's/[]\/$*.^|[]/\\&/g') + if [ ${DONT_ECP_SQ} -eq 0 ] ; then + F_EZ_SED_ECP_R=$(echo "$F_EZ_SED_ECP_R" | sed "s/'/\\\x27/g") + fi + if [ ${DONT_ECP_NL} -eq 1 ] ; then + F_EZ_SED_ECP_R=$(echo "$F_EZ_SED_ECP_R" | sed 's/C0673CECED2D4A8FBA90C9B92B9508A8/\\n/g') + fi +} + +f_ez_sed() { + : 'Facilitar o uso da funcionalidade "sed". + + Args: + TARGET (str): Valor a ser substituído por pelo valor de REPLACE. + REPLACE (str): Valor que irá substituir TARGET. + FILE (str): Arquivo no qual será feita a substituição. + ALL_OCCUR (Optional[int]): 0 - Fazer replace apenas na primeira + ocorrência; 1 - Fazer replace em todas as ocorrências. Padrão 0. + DONT_ESCAPE (Optional[int]): 0 - Faz escape das strings em + TARGET e REPLACE; 1 - Não faz escape das strings em TARGET e + REPLACE. Padrão 0. + DONT_ECP_NL (Optional[int]): 1 - Não "escapa" "\n" (quebra de + linha); 0 - "Escapa" "\n". Padrão 1. + REMOVE_LN (Optional[int]): 1 - Remove a linha que possui o + valor em TARGET; 0 - Faz o replace convencional. Padrão 0. + ' + + FILE=$3 + ALL_OCCUR=$4 + if [ -z "$ALL_OCCUR" ] ; then + ALL_OCCUR=0 + fi + DONT_ESCAPE=$5 + if [ -z "$DONT_ESCAPE" ] ; then + DONT_ESCAPE=0 + fi + DONT_ECP_NL=$6 + if [ -z "$DONT_ECP_NL" ] ; then + DONT_ECP_NL=1 + fi + REMOVE_LN=$7 + if [ -z "$REMOVE_LN" ] ; then + REMOVE_LN=0 + fi + if [ ${DONT_ESCAPE} -eq 1 ] ; then + TARGET=$1 + REPLACE=$2 + else + f_ez_sed_ecp "$1" $DONT_ECP_NL + TARGET=$F_EZ_SED_ECP_R + f_ez_sed_ecp "$2" $DONT_ECP_NL + REPLACE=$F_EZ_SED_ECP_R + fi + if [ ${REMOVE_LN} -eq 1 ] ; then + if [ ${ALL_OCCUR} -eq 0 ] ; then + SED_RPL="'0,/$TARGET/{//d;}'" + else + SED_RPL="'/$TARGET/d'" + fi + eval "sed -i $SED_RPL $FILE" + else + if [ ${ALL_OCCUR} -eq 0 ] ; then + SED_RPL="'0,/$TARGET/s//$REPLACE/g'" + else + SED_RPL="'s/$TARGET/$REPLACE/g'" + fi + eval "sed -i $SED_RPL $FILE" + fi +} + +FL_CONT_STR_R=0 +f_fl_cont_str() { + : 'Checar se um arquivo contêm determinada string. + + Args: + STR_TO_CH (str): Valor de string a ser verificado. + FILE (str): Arquivo no qual será feita a verificação. + COND_MSG_P (Optional[str]): Mensagem a ser exibida se + verdadeira a verificação. Se vazio ou não informado não será + exibida mensagem. + CHK_INVERT (Optional[int]): Inverter a lógica da checagem. + Padrão 0. + DONT_ESCAPE (Optional[int]): 0 - Faz escape da string em + STR_TO_CH; 1 - Não faz escape das strings em STR_TO_CH. Padrão 0. + DONT_ECP_NL (Optional[int]): 1 - Não "escapa" "\n" (quebra de + linha); 0 - "Escapa" "\n". Padrão 1. + + Returns: + FL_CONT_STR_R (int): 1 - Se verdadeiro para a condição + analisada; 0 - Se falso para a condição analisada. + ' + + STR_TO_CH=$1 + FILE=$2 + COND_MSG_P=$3 + CHK_INVERT=$4 + DONT_ESCAPE=$5 + + if [ -z "$DONT_ESCAPE" ] ; then + DONT_ESCAPE=0 + fi + if [ ${DONT_ESCAPE} -eq 0 ] ; then + DONT_ECP_NL=$6 + if [ -z "$DONT_ECP_NL" ] ; then + DONT_ECP_NL=1 + fi + f_ez_sed_ecp "$STR_TO_CH" $DONT_ECP_NL 1 + STR_TO_CH=$F_EZ_SED_ECP_R + fi + + if [ -z "$CHK_INVERT" ] ; then + CHK_INVERT=0 + fi + FL_CONT_STR_R=0 + if [ ${CHK_INVERT} -eq 0 ] ; then + if grep -q "$STR_TO_CH" "$FILE"; then + FL_CONT_STR_R=1 + fi + else + if ! grep -q "$STR_TO_CH" "$FILE"; then + FL_CONT_STR_R=1 + fi + fi + if [ ${EZ_I_SKIP_ON_V} -eq 0 ] && [ ${FL_CONT_STR_R} -eq 1 ] && [ ! -z "$COND_MSG_P" ] ; then + f_div_section + echo "$COND_MSG_P" + f_div_section + f_enter_to_cont + fi +} + +CHK_FD_FL_R=0 +f_chk_fd_fl() { + : 'Verificar se determinado diretório ou arquivo existe. + + Args: + TARGET (str): Diretório ou arquivo qual se quer verificar. + CHK_TYPE (str): "d" - Checar por diretório; "f" - Checar por + arquivo. + + Returns: + CHK_FD_FL_R (int): 1 - True; 0 - False. + ' + + CHK_FD_FL_R=0 + TARGET=$1 + CHK_TYPE=$2 + if [ "$CHK_TYPE" == "f" ] ; then + if [ -f "$TARGET" ] ; then + CHK_FD_FL_R=1 + fi + fi + if [ "$CHK_TYPE" == "d" ] ; then + if [ -d "$TARGET" ] ; then + CHK_FD_FL_R=1 + fi + fi +} + +F_PACK_IS_INST_R=0 +f_pack_is_inst() { + : 'Checar se um pacote está instalado. + + Args: + PACKAGE_NM_P (str): Nome do pacote. + PACK_MANAG (str): Tipo de gerenciador de pacotes. Apenas yum é + suportado. Em caso diverso o script exibe erro e para. + EXIST_MSG_P (Optional[str]): Mensagem a ser exibida se o + pacote já estiver instalado. Se vazio ou não informado não será + exibida mensagem. + SKIP_MSG_P (Optional[int]): Omite a mensagem. Padrão 0. + + Returns: + F_PACK_IS_INST_R (int): 1 - Instalado; 0 - Não instalado. + ' + + PACKAGE_NM_P=$1 + PACK_MANAG=$2 + EXIST_MSG_P=$3 + SKIP_MSG_P=$4 + + if [ -z "$SKIP_MSG_P" ] ; then + SKIP_MSG_P=0 + fi + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + SKIP_MSG_P=1 + fi + + F_PACK_IS_INST_R=0 + if [ "$PACK_MANAG" == "yum" ] ; then + if yum list installed "$PACKAGE_NM_P" >/dev/null 2>&1; then + if [ ${SKIP_MSG_P} -eq 0 ] && [ ! -z "$EXIST_MSG_P" ] ; then + f_div_section + echo "$EXIST_MSG_P" + f_div_section + f_enter_to_cont + fi + F_PACK_IS_INST_R=1 + else + F_PACK_IS_INST_R=0 + fi + else + f_div_section + echo "ERROR! Not implemented for \"$PACK_MANAG\"!" + f_div_section + f_enter_to_cont + fi +} + +F_CHK_BY_PATH_HLP_R=0 +f_chk_by_path_hlp() { + : 'Checar se um aplicativo/pacote/arquivo está presente/instalado + verificando-o através do seu caminho físico informando. + + Args: + PATH_VER_P (str): Caminho físico para o aplicativo/pacote. + VER_TYPE_P (str): Se o caminho físico é para um diretório ("d") + ou arquivo ("f"). + EXIST_MSG_P (Optional[str]): Mensagem a ser "printada" caso o + aplicativo/pacote/arquivo exista. Se não informado ou vazio não + exibe a mensagem. + SKIP_MSG_P (Optional[int]): Não exibir mensagem. + + Returns: + F_CHK_BY_PATH_HLP_R (int): 0 - Não existe; 1 - Existe + ("printa" menssagem contida em EXIST_MSG_P). + ' + + PATH_VER_P=$1 + VER_TYPE_P=$2 + EXIST_MSG_P=$3 + SKIP_MSG_P=$4 + if [ -z "$SKIP_MSG_P" ] ; then + SKIP_MSG_P=0 + fi + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + SKIP_MSG_P=1 + fi + + F_CHK_BY_PATH_HLP_R=0 + f_chk_fd_fl "$PATH_VER_P" "$VER_TYPE_P" + if [ ${CHK_FD_FL_R} -eq 0 ] ; then + F_CHK_BY_PATH_HLP_R=0 + else + if [ ${SKIP_MSG_P} -eq 0 ] && [ ! -z "$EXIST_MSG_P" ]; then + f_div_section + echo "$EXIST_MSG_P" + f_div_section + f_enter_to_cont + fi + F_CHK_BY_PATH_HLP_R=1 + fi +} + +F_CHK_IPTABLES_R=0 +f_chk_iptables() { + : 'Fazer verificações usando "iptables". + + Trata-se de um utilitário para fazer verificações diversas usando o + comando "iptables" NORMALMENTE CHECAR DE DETERMINADA PORTA ESTÁ + ABERTA. + + Ex 1.: f_chk_iptables 80 + Ex 2.: f_chk_iptables 80 "Já está aberta!" + Ex 3.: f_chk_iptables 80 "Já está aberta!" 0 "ACCEPT" "tcp" "NEW" + Ex 4.: f_chk_iptables 80 "Já está aberta!" 0 "ACCEPT" "tcp" "NEW" 5 + + Args: + PORT_P (int): Porta a ser verificada. + MSG_P (Optional[str]): Mensagem a ser exibida em caso de + verdadeiro para a verificação (normalmente porta aberta). Se vazio + ou não informado não será exibida mensagem. + SKIP_MSG_P (Optional[int]): Não exibir mensagem. + Padrão 0. + TARGET_P (Optional[str]): Padrão "ACCEPT". + PROT_P (Optional[str]): Padrão "tcp". + STATE_P (str): Padrão "". + POS_IN_CHAIN_P (int): Padrão "". + + Returns: + F_CHK_IPTABLES_R (int): 1 - Verdadeiro para a verificação; + 0 - Falso para a verificação. + ' + + PORT_P=$1 + MSG_P=$2 + SKIP_MSG_P=$3 + + if [ -z "$SKIP_MSG_P" ] ; then + SKIP_MSG_P=0 + fi + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + SKIP_MSG_P=1 + fi + + TARGET_P=$4 + if [ -z "$TARGET_P" ] ; then + TARGET_P="ACCEPT" + fi + PROT_P=$5 + if [ -z "$PROT_P" ] ; then + PROT_P="tcp" + fi + STATE_P=$6 + if [ -z "$STATE_P" ] ; then + STATE_P="" + else + STATE_P="state $STATE_P " + fi + POS_IN_CHAIN_P=$7 + if [ -z "$POS_IN_CHAIN_P" ] ; then + POS_IN_CHAIN_P="" + else + POS_IN_CHAIN_P=$(printf "%-9s" $POS_IN_CHAIN_P) + fi + GREP_OUT=$(iptables -vnL --line-numbers | grep "$POS_IN_CHAIN_P" | grep "$TARGET_P" | grep "$PROT_P" | grep "$STATE_P$PROT_P dpt:$PORT_P") + if [ $? -eq 1 ] ; then + F_CHK_IPTABLES_R=1 + else + if [ ${SKIP_MSG_P} -eq 0 ] && [ ! -z "$MSG_P" ] ; then + f_div_section + echo "$MSG_P" + f_div_section + f_enter_to_cont + fi + F_CHK_IPTABLES_R=0 + fi +} + +F_IS_NOT_RUNNING_R=0 +f_is_not_running() { + : 'Checar de determinado processo (pode ser um serviço) está + rodando. + + Args: + PROC_NM_P (str): Nome do processo (pode ser um serviço). + COND_MSG_P (Optional[str]): Mensagem a ser exibida se + verdadeira a verificação. Se vazio ou não informado não será + exibida mensagem. + CHK_INVERT (Optional[int]): Inverter a lógica da checagem. + Padrão 0. + + Returns: + F_IS_NOT_RUNNING_R (int): 1 - Se verdadeiro para a condição + analisada; 0 - Se falso para a condição analisada. + ' + + PROC_NM_P=$1 + COND_MSG_P=$2 + CHK_INVERT=$3 + if [ -z "$CHK_INVERT" ] ; then + CHK_INVERT=0 + fi + F_IS_NOT_RUNNING_R=0 + # NOTE: A verificação "grep -v grep" é para que ele não dê positivo + # para o próprio comando grep! By Questor + F_IS_NOT_RUNNING_R=0 + if [ ${CHK_INVERT} -eq 0 ] ; then + if ! ps aux | grep -v "grep" | grep "$PROC_NM_P" > /dev/null ; then + F_IS_NOT_RUNNING_R=1 + fi + else + if ps aux | grep -v "grep" | grep "$PROC_NM_P" > /dev/null ; then + F_IS_NOT_RUNNING_R=1 + fi + fi + if [ ${EZ_I_SKIP_ON_V} -eq 0 ] && [ ${F_IS_NOT_RUNNING_R} -eq 1 ] && [ ! -z "$COND_MSG_P" ] ; then + f_div_section + echo "$COND_MSG_P" + f_div_section + f_enter_to_cont + fi +} + +F_GET_STDERR_R="" +F_GET_STDOUT_R="" +f_get_stderr_stdout() { + : 'Executar um comando e colocar a saída de stderr e stdout nas + variáveis "F_GET_STDERR_R" e "F_GET_STDOUT_R"!. + + Args: + CMD_TO_EXEC (str): Comando a ser executado. + + Returns: + F_GET_STDERR_R (str): Saída para stderr. + F_GET_STDOUT_R (str): Saída para stdout. + ' + + CMD_TO_EXEC=$1 + F_GET_STDERR_R="" + F_GET_STDOUT_R="" + unset t_std t_err + eval "$( eval "$CMD_TO_EXEC" 2> >(t_err=$(cat); typeset -p t_err) > >(t_std=$(cat); typeset -p t_std) )" + F_GET_STDERR_R=$t_err + F_GET_STDOUT_R=$t_std +} + +F_BAK_PATH_R="" +F_BAK_MD_R=0 +f_ez_mv_bak() { + : 'Modifica o nome de um arquivo ou pasta para um nome de backup. + + Adiciona um sufixo ao nome no formato: "-D%Y-%m-%d-T%H-%M-%S.bak". + + Args: + TARGET (str): Caminho para o arquivo ou pasta alvo. + CONF_MSG_P (Optional[str]): Verificar se o usuário deseja ou + não backup. Se vazio ou não informado não será exibida mensagem. + SKIP_MSG_P (Optional[int]): Não exibir mensagem. Padrão 0. + + Returns: + F_BAK_PATH_R (str): Caminho para o arquivo ou pasta alvo com o + novo nome. + F_BAK_NAME_R (str): Nome do arquivo recém criado. + F_BAK_MD_R (int): 1 - Backup realizado; 0 - Backup não + realizado. + ' + + TARGET=$1 + CONF_MSG_P=$2 + SKIP_MSG_P=$3 + if [ -z "$SKIP_MSG_P" ] ; then + SKIP_MSG_P=0 + fi + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + SKIP_MSG_P=1 + fi + + + MK_BAK=1 + F_BAK_PATH_R="" + F_BAK_NAME_R="" + F_BAK_MD_R=0 + + if [ ${SKIP_MSG_P} -eq 0 ] && [ ! -z "$CONF_MSG_P" ] ; then + f_div_section + f_yes_no "$CONF_MSG_P" + f_div_section + MK_BAK=$YES_NO_R + fi + if [ ${MK_BAK} -eq 1 ] ; then + SUFFIX=$(date +"-D%Y-%m-%d-T%H-%M-%S.bak") + NEW_NAME="$TARGET$SUFFIX" + mv "$TARGET" "$NEW_NAME" + F_BAK_PATH_R=$NEW_NAME + F_BAK_NAME_R="${NEW_NAME##*/}" + F_BAK_MD_R=1 + fi +} + +f_error_exit() { + : '"Printa" uma mensagem de erro e encerra o instalador. + + Args: + ERROR_CAUSE_P (Optional[str]): Causa do erro. + ' + + ERROR_CAUSE_P=$1 + echo + f_open_section "E R R O R !" + ERROR_MSG_NOW_P="AN ERROR OCCURRED AND THIS INSTALLER WAS CLOSED!" + if [ ! -z "$ERROR_CAUSE_P" ] ; then + ERROR_MSG_NOW_P="$ERROR_MSG_NOW_P ERROR: \"$ERROR_CAUSE_P\"" + fi + echo "$ERROR_MSG_NOW_P" + echo + f_close_section + exit 1 +} + +f_continue() { + : 'Questionar ao usuário se deseja continuar ou parar a instalação. + + Args: + NOTE_P (Optional[str]): Informações adicionais ao usuário. + ' + + NOTE_P=$1 + f_div_section + if [ -z "$NOTE_P" ] ; then + NOTE_P="" + else + NOTE_P=" (NOTE: \"$NOTE_P\")" + fi + + f_yes_no "CONTINUE? (USE \"n\" TO STOP THIS INSTALLER)$NOTE_P" + f_div_section + if [ ${YES_NO_R} -eq 0 ] ; then + exit 0 + fi +} + + +# < -------------------------------------------------------------------------- + +# > -------------------------------------------------------------------------- +# GRAFICO! +# -------------------------------------- + +f_indent() { + : 'Definir uma tabulação para uma string informada. + + Exemplo de uso: echo "" | f_indent 4 + + Args: + LEVEL_P (int): 2, 4 ou 8 espaços. + ' + + LEVEL_P=$1 + if [ ${LEVEL_P} -eq 2 ] ; then + sed 's/^/ /'; + fi + if [ ${LEVEL_P} -eq 4 ] ; then + sed 's/^/ /'; + fi + if [ ${LEVEL_P} -eq 8 ] ; then + sed 's/^/ /'; + fi +} + +f_open_section() { + : 'Printar abertura de uma seção.' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + TITLE_P=$1 + echo "> ------------------------------------------------" + if [ -n "$TITLE_P" ] ; then + echo "$TITLE_P" + f_div_section + echo + fi +} + +f_close_section() { + : 'Printar fechamento de uma seção.' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + echo "< ------------------------------------------------" + echo +} + +f_div_section() { + : 'Printar divisão em uma seção.' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + echo "----------------------------------" +} + +f_sub_section() { + : 'Printar uma subseção. + + Args: + TITLE_P (str): Título da subseção. + TEXT_P (str): Texto da subseção. + ' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + TITLE_P=$1 + TEXT_P=$2 + echo "> $TITLE_P" | f_indent 2 + echo + echo "$TEXT_P" | f_indent 4 + echo +} + +# < -------------------------------------------------------------------------- + +# > -------------------------------------------------------------------------- +# APRESENTAÇÃO! +# -------------------------------------- + +f_begin() { + : 'Printar uma abertura/apresentação para o instalador do produto. + + Usar no início da instalação. + + Args: + TITLE_P (str): Título. + VERSION_P (str): Versão do produto. + ABOUT_P (str): Sobre o produto. + WARNINGS_P (str): Avisos antes de continuar. + COMPANY_P (str): Informações sobre a empresa. + ' + + clear + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + TITLE_P=$1 + VERSION_P=$2 + ABOUT_P=$3 + WARNINGS_P=$4 + COMPANY_P=$5 + f_open_section "$TITLE_P ($VERSION_P)" + f_sub_section "ABOUT:" "$ABOUT_P" + f_sub_section "WARNINGS:" "$WARNINGS_P" + f_div_section + echo "$COMPANY_P" + f_close_section + f_enter_to_cont + clear +} + +f_end() { + : 'Printar uma fechamento/encerramento para o instalador do produto. + + Usar no final da instalação. + + Args: + TITLE_P (str): Título. + USEFUL_INFO_P (str): Informações úteis (uso básico etc...). + ' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + TITLE_P=$1 + USEFUL_INFO_P=$2 + f_open_section "$TITLE_P" + f_sub_section "USEFUL INFORMATION:" "$USEFUL_INFO_P" + f_close_section +} + +f_terms_licen() { + : 'Printar os termos de licença/uso do produto. + + Pede que o usuário concorde com os termos. + + Args: + TERMS_LICEN_P (str): Termos de licença/uso do produto. + ' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + TERMS_LICEN_P=$1 + f_open_section "LICENSE/TERMS:" + echo "$TERMS_LICEN_P" | f_indent 2 + echo + f_div_section + TITLE_F="BY ANSWERING YES (y) YOU WILL AGREE WITH TERMS AND CONDITIONS "\ +"PRESENTED! PROCEED?" + f_yes_no "$TITLE_F" + TITLE_F="" + f_close_section + sleep 1 + if [ ${YES_NO_R} -eq 0 ] ; then + exit 0 + fi + clear +} + +f_instruct() { + : 'Printar instruções sobre o produto. + + Args: + INSTRUCT_P (str): Instruções sobre o produto. + ' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + INSTRUCT_P=$1 + f_open_section "INSTRUCTIONS:" + echo "$INSTRUCT_P" | f_indent 2 + echo + f_close_section + f_enter_to_cont + clear +} + +# < -------------------------------------------------------------------------- + +# > -------------------------------------------------------------------------- +# ESQUEMAS CONDICIONAIS! +# -------------------------------------- + +YES_NO_R=0 +f_yes_no() { + : 'Questiona ao usuário "yes" ou "no" sobre determinado algo. + + Args: + QUESTION_P (str): Questionamento a ser feito. + + Returns: + YES_NO_R (int): 1 - Yes; 0 - No. + ' + + if [ ${EZ_I_SKIP_ON_V} -eq 1 ] ; then + return 0 + fi + QUESTION_P=$1 + YES_NO_R=0 + read -r -p "$QUESTION_P (y/n) " RESP_V + if [[ $RESP_V =~ ^([sS]|[yY])$ ]] ; then + YES_NO_R=1 + elif [[ $RESP_V =~ ^([nN])$ ]] ; then + echo "NO!" + YES_NO_R=0 + else + f_yes_no "$QUESTION_P" + fi +} + +# < -------------------------------------------------------------------------- diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..52a550f --- /dev/null +++ b/install.sh @@ -0,0 +1,480 @@ +#!/bin/bash + +# NOTE: Evita problemas com caminhos relativos! By Questor +SCRIPTDIR_V="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +. $SCRIPTDIR_V/ez_i.sh + +# > -------------------------------------------------------------------------- +# INÍCIO! +# -------------------------------------- + +read -d '' TITLE_F <<"EOF" +LBC - LBConverter Installer +EOF + +read -d '' VERSION_F <<"EOF" +1.0.0.0 +EOF + +read -d '' ABOUT_F <<"EOF" +This script will install LBC - LBConverter the LightBase OCR (Optical Character +Recognition)/data extractor component that obtain data from submitted files! + +Have fun! =D +EOF + +read -d '' WARNINGS_F <<"EOF" +- Installer designed for CentOS 6 AMD64/RHEL 6 AMD64! + +- We RECOMMEND you... + Install all the components (answer yes to everything). Except + contrary guidance! + Check for previous installations! If there is previous + installations consider this variant in the process! +- We WARNING you... + USE AT YOUR OWN RISK: WE ARE NOT RESPONSIBLE FOR ANY DAMAGE TO +YOURSELF, HARDWARE, OR CO-WORKERS. EXCEPT IN CASES WHERE THERE ARE +SIGNED CONTRACT THAT REGULATES THIS! +EOF + +read -d '' COMPANY_F <<"EOF" +BR Light LTDA - LightBase Consulting in Public Software/LightBase Consultoria em Software Público +Free Software + Our Ideas = Best Solution!/Software Livre + Nossas Idéias = Melhor Solução! ++55-61-3347-1949 - http://www.LightBase.com.br - Brasil-DF +EOF + +f_begin "$TITLE_F" "$VERSION_F" "$ABOUT_F" "$WARNINGS_F" "$COMPANY_F" +ABOUT_F="" +WARNINGS_F="" + +# < -------------------------------------------------------------------------- + +# > -------------------------------------------------------------------------- +# TERMOS E LICENÇA! +# -------------------------------------- + +read -d '' TERMS_LICEN_F <<"EOF" +BY USING THIS INSTALLER YOU ARE AGREEING TO THE TERMS OF USE OF ALL INVOLVED SOFTWARE! +EOF + +f_terms_licen "$TERMS_LICEN_F" +TERMS_LICEN_F="" + +# < -------------------------------------------------------------------------- + +# > -------------------------------------------------------------------------- +# INTRUÇÕES! +# -------------------------------------- + +read -d '' INSTRUCT_F <<"EOF" +- To run this script YOU NEED to be root! + +- TO CANCEL installation at any time use Ctrl+c! +EOF + +f_instruct "$INSTRUCT_F" +INSTRUCT_F="" + +# < -------------------------------------------------------------------------- + +# > ----------------------------------------- +# Dá ao usuário mais avançado a possibilideade de usar o instalador +# simplificado! + +# NOTE: É possível forçar o processo de instalção simplificado setando +# "SIMPLE_INST" com 1! By Questor +SIMPLE_INST=0 +if [ ${SIMPLE_INST} -eq 0 ] ; then + f_open_section + f_yes_no "Use simple install (using a default value for most of the options)?" + if [ ${YES_NO_R} -eq 1 ] ; then + + # NOTE: Essa variável serve apenas para "preservar" o valor + # setado pelo usuário sendo somente "leitura". A variável a + # ser usada nas regras deve ser "EZ_I_SKIP_ON_V" (ez_i.sh)! Essa + # estratégia serve para mudarmos o comportamento do "ez_i.sh" + # de acordo com as circunstâncias! By Questor + SIMPLE_INST=1 + + # NOTE: Essa variável é para consumo do "ez_i.sh", para que ele + # não execute algumas funções e simplifique o processo de + # instalação! By Questor + EZ_I_SKIP_ON_V=1 + fi + f_close_section + sleep 1 +fi + +# < ----------------------------------------- + +# > ----------------------------------------- +# Garantir o encodamento correto para evitar problemas de +# compatibilidade! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +f_open_section +read -d '' TITLE_F <<"EOF" +Set terminal encode? (recommended for Windows terminal clients) +EOF + +f_yes_no "$TITLE_F" +TITLE_F="" +if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then + export LANG=pt_BR.utf8 +fi +f_close_section + +# < ----------------------------------------- + +# > ----------------------------------------- +# Desabilita o SElinux! + +EZ_I_SKIP_ON_V=0 +f_open_section +read -d '' TITLE_F <<"EOF" +Disable SElinux (use "y" if you never did it)? +EOF + +f_yes_no "$TITLE_F" +TITLE_F="" +if [ ${YES_NO_R} -eq 1 ] ; then + setenforce 0 + + # NOTE: As condições abaixo visam evitar que o arquivo seja + # desnecessariamente e erroneamente modificado! By Questor + EZ_I_SKIP_ON_V=$SIMPLE_INST + f_fl_cont_str "# SELINUX=enforcing" "/etc/sysconfig/selinux" "The file \"/etc/sysconfig/selinux\" probably has already been changed! Check it!" + EZ_I_SKIP_ON_V=0 + if [ ${FL_CONT_STR_R} -eq 0 ] ; then + f_fl_cont_str "SELINUX=disabled" "/etc/sysconfig/selinux" + if [ ${FL_CONT_STR_R} -eq 0 ] ; then + f_ez_sed "SELINUX=enforcing" "# SELINUX=enforcing\nSELINUX=disabled" "/etc/sysconfig/selinux" + fi + fi +fi +f_close_section + +# < ----------------------------------------- + +BASE_INST_DIR_V="/usr/local/lb" +# > ----------------------------------------- +# Criar o diretório base da instalação! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +f_open_section +QUESTION_F="Insert where the base installation directory (\"lb\") will be created (don't use \"/\" at the end). +Use empty for \"/usr/local\"!" + +f_get_usr_input "$QUESTION_F" 1 +QUESTION_F="" +if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ -z "$GET_USR_INPUT_R" ] ; then + f_chk_by_path_hlp "$BASE_INST_DIR_V" "d" "\"$BASE_INST_DIR_V\" directory already created!" + if [ ${F_CHK_BY_PATH_HLP_R} -eq 0 ] ; then + mkdir -p "$BASE_INST_DIR_V" + fi +else + BASE_INST_DIR_V="$GET_USR_INPUT_R/lb" + f_chk_by_path_hlp "$BASE_INST_DIR_V" "d" "\"$BASE_INST_DIR_V\" directory already created!" + if [ ${F_CHK_BY_PATH_HLP_R} -eq 0 ] ; then + mkdir -p "$BASE_INST_DIR_V" + fi +fi +f_close_section + +# < ----------------------------------------- + +# > ----------------------------------------- +# Instalar o virtualenv-1.11.6 no python2.6! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +f_open_section +read -d '' TITLE_F <<"EOF" +Install virtualenv-1.11.6 on python2.6? +EOF + +f_yes_no "$TITLE_F" +TITLE_F="" +if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then + f_chk_by_path_hlp "/usr/bin/virtualenv-2.6" "f" "virtualenv-1.11.6 already installed!" + if [ ${F_CHK_BY_PATH_HLP_R} -eq 0 ] ; then + cd "$SCRIPTDIR_V" + cd ./other-srcs-n-apps + tar -zxvf virtualenv-1.11.6.tar.gz + cd virtualenv-1.11.6 + python2.6 setup.py install + cd .. + rm -rf virtualenv-1.11.6 + fi +fi +f_close_section + +# < ----------------------------------------- + +# > ----------------------------------------- +# Criar o ambiente virtual (python2.6)! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +f_open_section +f_enter_to_cont "Create the virtual environment (python2.6)!" + +f_chk_by_path_hlp "$BASE_INST_DIR_V/ve26" "d" "Virtual environment (python2.6) already created in \"$BASE_INST_DIR_V/ve26\"!" +if [ ${F_CHK_BY_PATH_HLP_R} -eq 0 ] ; then + cd "$BASE_INST_DIR_V" + virtualenv-2.6 ve26 + mkdir "$BASE_INST_DIR_V/ve26/src" + f_enter_to_cont "Virtual environment created in \"$BASE_INST_DIR_V/ve26\"!" +fi +f_close_section + +# < ----------------------------------------- + +# > ----------------------------------------- +# Instalar o catdoc, unzip e ImageMagick para o LBConverter! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +f_open_section +f_yes_no "Install catdoc, unzip and ImageMagick?" +TITLE_F="" +if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then + + UP_CATDOC=1 + f_chk_by_path_hlp "$BASE_INST_DIR_V/ve26/lib/catdoc-0.94.2" "d" "catdoc-0.94.2 already installed in \"$BASE_INST_DIR_V/ve26/lib/catdoc-0.94.2\"!" + if [ ${F_CHK_BY_PATH_HLP_R} -eq 1 ] ; then + if [ ${EZ_I_SKIP_ON_V} -eq 0 ] ; then + f_div_section + f_yes_no "Update/reinstall catdoc-0.94.2? (\"y\" recommended)" + f_div_section + UP_CATDOC=$YES_NO_R + if [ ${UP_CATDOC} -eq 1 ] ; then + rm -rf "$BASE_INST_DIR_V/ve26/lib/catdoc-0.94.2" + fi + fi + fi + if [ ${UP_CATDOC} -eq 1 ] ; then + + f_pack_is_inst "gcc-c++" "yum" "\"gcc-c++\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install gcc-c++ + fi + f_pack_is_inst "unzip" "yum" "\"unzip\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install unzip + fi + f_pack_is_inst "ImageMagick" "yum" "\"ImageMagick\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install ImageMagick + fi + + cd "$SCRIPTDIR_V" + cd ./other-srcs-n-apps + tar -zxvf catdoc-0.94.2.tar.gz + mv ./catdoc-0.94.2 $BASE_INST_DIR_V/ve26/lib + cd $BASE_INST_DIR_V/ve26/lib/catdoc-0.94.2 + ./configure + make && make install + fi +fi +f_close_section + +# < ----------------------------------------- + +# > ----------------------------------------- +# Instalar o tesseract-ocr-3.02.02! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +f_open_section +f_yes_no "Install tesseract-ocr-3.02.02?" +TITLE_F="" +if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then + + UP_TESSERACT_OCR=1 + f_chk_by_path_hlp "/usr/local/lib/tesseract-ocr" "d" "tesseract-ocr-3.02.02 already installed in \"/usr/local/lib/tesseract-ocr\"!" + if [ ${F_CHK_BY_PATH_HLP_R} -eq 1 ] ; then + if [ ${EZ_I_SKIP_ON_V} -eq 0 ] ; then + f_div_section + f_yes_no "Update/reinstall tesseract-ocr-3.02.02? (\"y\" recommended)" + f_div_section + UP_TESSERACT_OCR=$YES_NO_R + fi + fi + if [ ${UP_TESSERACT_OCR} -eq 1 ] ; then + f_pack_is_inst "libpng-devel" "yum" "\"libpng-devel\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install libpng-devel + fi + f_pack_is_inst "libjpeg-turbo-devel" "yum" "\"libjpeg-devel\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install libjpeg-devel + fi + f_pack_is_inst "libtiff-devel" "yum" "\"libtiff-devel\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install libtiff-devel + fi + f_pack_is_inst "libtool" "yum" "\"libtool\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install libtool + fi + f_pack_is_inst "automake" "yum" "\"automake\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install automake + fi + f_pack_is_inst "autoconf" "yum" "\"autoconf\" already installed!" + if [ ${F_PACK_IS_INST_R} -eq 0 ] ; then + yum -y install autoconf + fi + + cd "$SCRIPTDIR_V" + cd ./other-srcs-n-apps + + tar -zxvf leptonica-1.71.tar.gz + mv ./leptonica-1.71 /usr/local/lib + cd /usr/local/lib/leptonica-1.71 + ./configure + make && make install + + cd "$SCRIPTDIR_V" + cd ./other-srcs-n-apps + + tar -zxvf tesseract-ocr-3.02.02.tar.gz + mv ./tesseract-ocr /usr/local/lib + cd /usr/local/lib/tesseract-ocr + ./autogen.sh + ./configure + make & make install + ldconfig + + cd "$SCRIPTDIR_V" + cd ./other-srcs-n-apps + + tar -zxvf tesseract-ocr-3.01.eng.tar.gz + tar -zxvf tesseract-ocr-3.02.por.tar.gz + mv ./tesseract-ocr /usr/local/lib/tesseract-ocr + cp /usr/local/lib/tesseract-ocr/tesseract-ocr/tessdata/eng.traineddata /usr/local/share/tessdata + export TESSDATA_PREFIX=/usr/local/lib/tesseract-ocr/tesseract-ocr + + fi +fi +f_close_section + +# < ----------------------------------------- + +# > ----------------------------------------- +# Instalar as dependências python2.6 da LBC - LBConverter! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +cd "$SCRIPTDIR_V" +sh py-packs-LBConverter.sh "$EZ_I_SKIP_ON_V" "$BASE_INST_DIR_V" + +# < ----------------------------------------- + +HTTP_PORT_F=6544 +# > ----------------------------------------- +# Instalar e configurar o LBC - LBConverter! + +EZ_I_SKIP_ON_V=$SIMPLE_INST +f_open_section +f_yes_no "Install the LBC - LBConverter?" +TITLE_F="" +if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then + + f_chk_by_path_hlp "$BASE_INST_DIR_V/ve26/src/LBConverter" "d" "\"LBConverter\" already installed in \"$BASE_INST_DIR_V/ve26/src\"!" + F_BAK_MD_R=1 + if [ ${F_CHK_BY_PATH_HLP_R} -eq 1 ] ; then + f_ez_mv_bak "$BASE_INST_DIR_V/ve26/src/LBConverter" "Backup old version and update? (\"y\" recommended)" + fi + if [ ${F_BAK_MD_R} -eq 1 ] ; then + + cd "$SCRIPTDIR_V" + tar -zxvf LBConverter.tar.gz + mv "$SCRIPTDIR_V/LBConverter" "$BASE_INST_DIR_V/ve26/src/" + cd "$BASE_INST_DIR_V/ve26/src/LBConverter" + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + + f_enter_to_cont "Configure LBC - LBConverter!" + \cp "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconverter-dist" "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconverter-prov" + f_ez_sed "" "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconvertermg" "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconverter-prov" + rm -rf "/etc/init.d/lbconverter" + mv "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconverter-prov" "/etc/init.d/lbconverter" + + chmod 755 -R /etc/init.d/ + cd /etc/init.d/ + chkconfig --level 2345 lbconverter on + + \cp "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconvertermg-dist" "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconvertermg" + f_ez_sed "" "$BASE_INST_DIR_V/ve26" "$BASE_INST_DIR_V/ve26/src/LBConverter/lbconvertermg" + + LBG_URL_F="http://127.0.0.1/lbg" + QUESTION_F="Enter the LBG - LBGenerator URL. +Use empty for \"$LBG_URL_F\" (LOCALHOST)!" + + f_get_usr_input "$QUESTION_F" 1 + QUESTION_F="" + if [ -n "$GET_USR_INPUT_R" ] ; then + LBG_URL_F=$GET_USR_INPUT_R + fi + + QUESTION_F="Enter the port number for http service. +Use empty for \"$HTTP_PORT_F\" (recommended)!" + + f_get_usr_input "$QUESTION_F" 1 + QUESTION_F="" + if [ -n "$GET_USR_INPUT_R" ] ; then + HTTP_PORT_F=$GET_USR_INPUT_R + fi + + \cp "$BASE_INST_DIR_V/ve26/src/LBConverter/production.ini-dist" "$BASE_INST_DIR_V/ve26/src/LBConverter/production.ini" + f_ez_sed "" "$HTTP_PORT_F" "$BASE_INST_DIR_V/ve26/src/LBConverter/production.ini" + f_ez_sed "" "$LBG_URL_F" "$BASE_INST_DIR_V/ve26/src/LBConverter/production.ini" + + service lbconverter restart + fi +fi +f_close_section + +# < ----------------------------------------- + +# > ----------------------------------------- +# Abrir o firewall para o http service! + +EZ_I_SKIP_ON_V=0 +f_open_section +TITLE_F="Open firewall for http service (TCP $HTTP_PORT_F)?" + +f_yes_no "$TITLE_F" +TITLE_F="" +if [ ${YES_NO_R} -eq 1 ]; then + f_chk_iptables ${HTTP_PORT_F} "Port $HTTP_PORT_F is already open!" 0 "ACCEPT" "tcp" "NEW" + if [ ${F_CHK_IPTABLES_R} -eq 1 ] ; then + iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport ${HTTP_PORT_F} -j ACCEPT + service iptables save + service iptables restart + fi +fi +f_close_section + +# < ----------------------------------------- + +# > -------------------------------------------------------------------------- +# FINAL! +# -------------------------------------- + +EZ_I_SKIP_ON_V=0 +read -d '' TITLE_F <<"EOF" +Installer finished! Thanks! +EOF + +USEFUL_INFO_F="To configure... + vi $BASE_INST_DIR_V/ve26/src/LBConverter/production.ini + +To start/stop... + service lbconverter start + service lbconverter stop + +Log... + less /var/log/lbconverter.log" + +f_end "$TITLE_F" "$USEFUL_INFO_F" +TITLE_F="" +USEFUL_INFO_F="" + +# < -------------------------------------------------------------------------- diff --git a/other-srcs-n-apps/.directory b/other-srcs-n-apps/.directory new file mode 100755 index 0000000..adb2a47 --- /dev/null +++ b/other-srcs-n-apps/.directory @@ -0,0 +1,5 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2016,3,18,17,34,50 +Version=3 +ViewMode=1 diff --git a/other-srcs-n-apps/.directory.lock b/other-srcs-n-apps/.directory.lock new file mode 100755 index 0000000..5f7edb8 --- /dev/null +++ b/other-srcs-n-apps/.directory.lock @@ -0,0 +1,3 @@ +29964 +dolphin +eduardo-nb diff --git a/other-srcs-n-apps/catdoc-0.94.2.tar.gz b/other-srcs-n-apps/catdoc-0.94.2.tar.gz new file mode 100755 index 0000000..671e3cb Binary files /dev/null and b/other-srcs-n-apps/catdoc-0.94.2.tar.gz differ diff --git a/other-srcs-n-apps/lbconverter b/other-srcs-n-apps/lbconverter new file mode 100755 index 0000000..228f52a --- /dev/null +++ b/other-srcs-n-apps/lbconverter @@ -0,0 +1,48 @@ +#!/bin/bash +# chkconfig: 2345 99 01 +# description: Serviço de inicialização do LBConverter +# processname: lbconverter + +cd /usr/local/lbneo/virtenvlb2.6/src/LBConverter +Name=lbconverter +Start="/usr/local/lbneo/virtenvlb2.6/bin/python /usr/local/lbneo/virtenvlb2.6/src/LBConverter/lbconverter/ start" +Stop="/usr/local/lbneo/virtenvlb2.6/bin/python /usr/local/lbneo/virtenvlb2.6/src/LBConverter/lbconverter/ stop" +Pid=$(ps auxf | grep ${Name} | grep -v grep | awk '{print $2}') + +function startProgram(){ + if [ -z "${Pid}" ]; then + echo "${Name} is running" + else + echo "starting ${Name}..." + ${Start} + fi +} + +function stopProgram(){ + if [ -n "$Pid" ]; then + + ${Stop} + else + echo "${Name} not is running" + fi +} + +case "$1" in + start) + startProgram + ;; + stop) + stopProgram + ;; + restart) + stopProgram + startProgram + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/other-srcs-n-apps/leptonica-1.71.tar.gz b/other-srcs-n-apps/leptonica-1.71.tar.gz new file mode 100755 index 0000000..0d749c2 Binary files /dev/null and b/other-srcs-n-apps/leptonica-1.71.tar.gz differ diff --git a/other-srcs-n-apps/tesseract-ocr-3.01.eng.tar.gz b/other-srcs-n-apps/tesseract-ocr-3.01.eng.tar.gz new file mode 100755 index 0000000..e631c3e Binary files /dev/null and b/other-srcs-n-apps/tesseract-ocr-3.01.eng.tar.gz differ diff --git a/other-srcs-n-apps/tesseract-ocr-3.02.02.tar.gz b/other-srcs-n-apps/tesseract-ocr-3.02.02.tar.gz new file mode 100755 index 0000000..b64fd81 Binary files /dev/null and b/other-srcs-n-apps/tesseract-ocr-3.02.02.tar.gz differ diff --git a/other-srcs-n-apps/tesseract-ocr-3.02.por.tar.gz b/other-srcs-n-apps/tesseract-ocr-3.02.por.tar.gz new file mode 100755 index 0000000..8e45c53 Binary files /dev/null and b/other-srcs-n-apps/tesseract-ocr-3.02.por.tar.gz differ diff --git a/other-srcs-n-apps/virtualenv-1.11.6.tar.gz b/other-srcs-n-apps/virtualenv-1.11.6.tar.gz new file mode 100755 index 0000000..e2a760e Binary files /dev/null and b/other-srcs-n-apps/virtualenv-1.11.6.tar.gz differ diff --git a/py-packs-LBConverter.sh b/py-packs-LBConverter.sh new file mode 100755 index 0000000..8cef331 --- /dev/null +++ b/py-packs-LBConverter.sh @@ -0,0 +1,184 @@ +#!/bin/bash + +# Instalação das dependências do LBC - LBConverter no python2.6! + +. ./ez_i.sh + +SKIP_ON_V=$1 +if [ -z "$SKIP_ON_V" ] ; then + SKIP_ON_V=0 +fi + +BASE_INST_DIR_V=$2 + +# > ----------------------------------------- +# Informar o diretório base da instalação! + +if [ -z "$BASE_INST_DIR_V" ] ; then + f_open_section + BASE_INST_DIR_V="/usr/local/lb" + + QUESTION_F="Enter the installation directory. + Use empty for \"$BASE_INST_DIR_V\"!" + + f_get_usr_input "$QUESTION_F" 1 + QUESTION_F="" + if [ -n "$GET_USR_INPUT_R" ] ; then + BASE_INST_DIR_V="$GET_USR_INPUT_R/lb" + fi + f_close_section +fi + +# < ----------------------------------------- + +f_open_section + +TITLE_F="Install LBC - LBConverter dependencies for python2.6?" + +f_yes_no "$TITLE_F" +TITLE_F="" + +if [ ${SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then + + cd "$SCRIPTDIR_V" + cd ./py-packs-LBConverter + + tar -zxvf ./ordereddict-1.1.tar.gz + cd ./ordereddict-1.1 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./ordereddict-1.1 + + tar -zxvf ./configparser-3.3.0r2.tar.gz + cd ./configparser-3.3.0r2 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./configparser-3.3.0r2 + + tar -zxvf ./pdfminer-20140328.tar.gz + cd ./pdfminer-20140328 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./pdfminer-20140328 + + tar -zxvf ./requests-2.3.0.tar.gz + cd ./requests-2.3.0 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./requests-2.3.0 + + tar -zxvf ./PasteDeploy-1.5.2.tar.gz + cd ./PasteDeploy-1.5.2 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./PasteDeploy-1.5.2 + + tar -zxvf ./venusian-1.0.tar.gz + cd ./venusian-1.0 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./venusian-1.0 + + tar -zxvf ./translationstring-1.3.tar.gz + cd ./translationstring-1.3 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./translationstring-1.3 + + tar -zxvf ./zope.deprecation-4.1.2.tar.gz + cd ./zope.deprecation-4.1.2 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./zope.deprecation-4.1.2 + + tar -zxvf ./zope.interface-4.1.3.tar.gz + cd ./zope.interface-4.1.3 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./zope.interface-4.1.3 + + tar -zxvf ./repoze.lru-0.6.tar.gz + cd ./repoze.lru-0.6 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./repoze.lru-0.6 + + tar -zxvf ./WebOb-1.5.1.tar.gz + cd ./WebOb-1.5.1 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./WebOb-1.5.1 + + tar -zxvf ./pyramid-1.6b2.tar.gz + cd ./pyramid-1.6b2 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./pyramid-1.6b2 + + tar -zxvf ./pbr-0.10.0.tar.gz + cd ./pbr-0.10.0 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./pbr-0.10.0 + + tar -zxvf ./linecache2-1.0.0.tar.gz + cd ./linecache2-1.0.0 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./linecache2-1.0.0 + + tar -zxvf ./traceback2-1.4.0.tar.gz + cd ./traceback2-1.4.0 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./traceback2-1.4.0 + + tar -zxvf ./six-1.7.2.tar.gz + cd ./six-1.7.2 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./six-1.7.2 + + tar -zxvf ./argparse-1.3.0.tar.gz + cd ./argparse-1.3.0 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./argparse-1.3.0 + + tar -zxvf ./unittest2-1.0.1.tar.gz + cd ./unittest2-1.0.1 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./unittest2-1.0.1 + + tar -zxvf ./Chameleon-2.24.tar.gz + cd ./Chameleon-2.24 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./Chameleon-2.24 + + tar -zxvf ./pyramid_chameleon-0.3.tar.gz + cd ./pyramid_chameleon-0.3 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./pyramid_chameleon-0.3 + + tar -zxvf ./waitress-0.8.10.tar.gz + cd ./waitress-0.8.10 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./waitress-0.8.10 + + tar -zxvf ./xlrd-0.9.4.tar.gz + cd ./xlrd-0.9.4 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./xlrd-0.9.4 + + tar -zxvf ./BeautifulSoup-3.2.1.tar.gz + cd ./BeautifulSoup-3.2.1 + eval "$BASE_INST_DIR_V/ve26/bin/python2.6 setup.py install" + cd .. + rm -rf ./BeautifulSoup-3.2.1 + +fi diff --git a/py-packs-LBConverter/BeautifulSoup-3.2.1.tar.gz b/py-packs-LBConverter/BeautifulSoup-3.2.1.tar.gz new file mode 100755 index 0000000..777f4f6 Binary files /dev/null and b/py-packs-LBConverter/BeautifulSoup-3.2.1.tar.gz differ diff --git a/py-packs-LBConverter/Chameleon-2.24.tar.gz b/py-packs-LBConverter/Chameleon-2.24.tar.gz new file mode 100755 index 0000000..3f8a823 Binary files /dev/null and b/py-packs-LBConverter/Chameleon-2.24.tar.gz differ diff --git a/py-packs-LBConverter/PasteDeploy-1.5.2.tar.gz b/py-packs-LBConverter/PasteDeploy-1.5.2.tar.gz new file mode 100755 index 0000000..fd4f9e1 Binary files /dev/null and b/py-packs-LBConverter/PasteDeploy-1.5.2.tar.gz differ diff --git a/py-packs-LBConverter/WebOb-1.5.1.tar.gz b/py-packs-LBConverter/WebOb-1.5.1.tar.gz new file mode 100755 index 0000000..689a47c Binary files /dev/null and b/py-packs-LBConverter/WebOb-1.5.1.tar.gz differ diff --git a/py-packs-LBConverter/argparse-1.3.0.tar.gz b/py-packs-LBConverter/argparse-1.3.0.tar.gz new file mode 100755 index 0000000..d2dce21 Binary files /dev/null and b/py-packs-LBConverter/argparse-1.3.0.tar.gz differ diff --git a/py-packs-LBConverter/configparser-3.3.0r2.tar.gz b/py-packs-LBConverter/configparser-3.3.0r2.tar.gz new file mode 100755 index 0000000..63c4c58 Binary files /dev/null and b/py-packs-LBConverter/configparser-3.3.0r2.tar.gz differ diff --git a/py-packs-LBConverter/linecache2-1.0.0.tar.gz b/py-packs-LBConverter/linecache2-1.0.0.tar.gz new file mode 100755 index 0000000..4604f93 Binary files /dev/null and b/py-packs-LBConverter/linecache2-1.0.0.tar.gz differ diff --git a/py-packs-LBConverter/ordereddict-1.1.tar.gz b/py-packs-LBConverter/ordereddict-1.1.tar.gz new file mode 100755 index 0000000..2955c19 Binary files /dev/null and b/py-packs-LBConverter/ordereddict-1.1.tar.gz differ diff --git a/py-packs-LBConverter/pbr-0.10.0.tar.gz b/py-packs-LBConverter/pbr-0.10.0.tar.gz new file mode 100755 index 0000000..696ea1b Binary files /dev/null and b/py-packs-LBConverter/pbr-0.10.0.tar.gz differ diff --git a/py-packs-LBConverter/pdfminer-20140328.tar.gz b/py-packs-LBConverter/pdfminer-20140328.tar.gz new file mode 100755 index 0000000..b261e7b Binary files /dev/null and b/py-packs-LBConverter/pdfminer-20140328.tar.gz differ diff --git a/py-packs-LBConverter/pyramid-1.6b2.tar.gz b/py-packs-LBConverter/pyramid-1.6b2.tar.gz new file mode 100755 index 0000000..a0ce2b2 Binary files /dev/null and b/py-packs-LBConverter/pyramid-1.6b2.tar.gz differ diff --git a/py-packs-LBConverter/pyramid_chameleon-0.3.tar.gz b/py-packs-LBConverter/pyramid_chameleon-0.3.tar.gz new file mode 100755 index 0000000..e470834 Binary files /dev/null and b/py-packs-LBConverter/pyramid_chameleon-0.3.tar.gz differ diff --git a/py-packs-LBConverter/repoze.lru-0.6.tar.gz b/py-packs-LBConverter/repoze.lru-0.6.tar.gz new file mode 100755 index 0000000..81e8ee5 Binary files /dev/null and b/py-packs-LBConverter/repoze.lru-0.6.tar.gz differ diff --git a/py-packs-LBConverter/requests-2.3.0.tar.gz b/py-packs-LBConverter/requests-2.3.0.tar.gz new file mode 100755 index 0000000..4c8e509 Binary files /dev/null and b/py-packs-LBConverter/requests-2.3.0.tar.gz differ diff --git a/py-packs-LBConverter/six-1.7.2.tar.gz b/py-packs-LBConverter/six-1.7.2.tar.gz new file mode 100755 index 0000000..036b9ee Binary files /dev/null and b/py-packs-LBConverter/six-1.7.2.tar.gz differ diff --git a/py-packs-LBConverter/traceback2-1.4.0.tar.gz b/py-packs-LBConverter/traceback2-1.4.0.tar.gz new file mode 100755 index 0000000..7043739 Binary files /dev/null and b/py-packs-LBConverter/traceback2-1.4.0.tar.gz differ diff --git a/py-packs-LBConverter/translationstring-1.3.tar.gz b/py-packs-LBConverter/translationstring-1.3.tar.gz new file mode 100755 index 0000000..52c8c1e Binary files /dev/null and b/py-packs-LBConverter/translationstring-1.3.tar.gz differ diff --git a/py-packs-LBConverter/unittest2-1.0.1.tar.gz b/py-packs-LBConverter/unittest2-1.0.1.tar.gz new file mode 100755 index 0000000..07a5e34 Binary files /dev/null and b/py-packs-LBConverter/unittest2-1.0.1.tar.gz differ diff --git a/py-packs-LBConverter/venusian-1.0.tar.gz b/py-packs-LBConverter/venusian-1.0.tar.gz new file mode 100755 index 0000000..c8fc8cc Binary files /dev/null and b/py-packs-LBConverter/venusian-1.0.tar.gz differ diff --git a/py-packs-LBConverter/waitress-0.8.10.tar.gz b/py-packs-LBConverter/waitress-0.8.10.tar.gz new file mode 100755 index 0000000..b54e000 Binary files /dev/null and b/py-packs-LBConverter/waitress-0.8.10.tar.gz differ diff --git a/py-packs-LBConverter/xlrd-0.9.4.tar.gz b/py-packs-LBConverter/xlrd-0.9.4.tar.gz new file mode 100755 index 0000000..08071e8 Binary files /dev/null and b/py-packs-LBConverter/xlrd-0.9.4.tar.gz differ diff --git a/py-packs-LBConverter/zope.deprecation-4.1.2.tar.gz b/py-packs-LBConverter/zope.deprecation-4.1.2.tar.gz new file mode 100755 index 0000000..5522180 Binary files /dev/null and b/py-packs-LBConverter/zope.deprecation-4.1.2.tar.gz differ diff --git a/py-packs-LBConverter/zope.interface-4.1.3.tar.gz b/py-packs-LBConverter/zope.interface-4.1.3.tar.gz new file mode 100755 index 0000000..c9e652f Binary files /dev/null and b/py-packs-LBConverter/zope.interface-4.1.3.tar.gz differ -- libgit2 0.21.2