From 3794ad62ae5447087f371b26ad25f8c9102c3123 Mon Sep 17 00:00:00 2001 From: edulucio Date: Thu, 7 Dec 2017 11:11:28 -0200 Subject: [PATCH] Atualização da versão! Melhorias e correções no processo de instalação! By Questor --- .directory | 4 ---- LBIndex.tar.gz | Bin 913629 -> 0 bytes ez_i.bash | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++------- install.bash | 12 +++++++----- liblightbase.tar.gz | Bin 2321046 -> 0 bytes 5 files changed, 57 insertions(+), 16 deletions(-) delete mode 100755 .directory diff --git a/.directory b/.directory deleted file mode 100755 index c97edb6..0000000 --- a/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -Timestamp=2016,8,2,17,48,55 -Version=3 -ViewMode=1 diff --git a/LBIndex.tar.gz b/LBIndex.tar.gz index 65a4bd4..ec378bd 100644 Binary files a/LBIndex.tar.gz and b/LBIndex.tar.gz differ diff --git a/ez_i.bash b/ez_i.bash index 46188d2..c8fe5a4 100755 --- a/ez_i.bash +++ b/ez_i.bash @@ -2,7 +2,7 @@ : 'Trata-se de um módulo que oferece uma série de funcionalidades para criar um instalador usando "bash". -Version 1.1.0b +Version 1.2.0b Apache License Version 2.0, January 2004 @@ -146,8 +146,8 @@ 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. + escape para "grep" ("f_fl_cont_str") optei por colocar essa função + como utilitária para as outras duas. Args: VAL_TO_ECP (str): Valor a ser "escapado". @@ -171,10 +171,23 @@ f_ez_sed_ecp() { DONT_ECP_SQ=0 fi F_EZ_SED_ECP_R=$VAL_TO_ECP + + # NOTE: Com essa intervenção conseguimos passar argumentos para um comando + # "sed" mesmo que o texto tenha quebras de linha! By Questor + F_EZ_SED_ECP_R=$(echo -n "$F_EZ_SED_ECP_R" | awk 'BEGIN {RS="dn"} {gsub("\n","\\n"); printf $0}') + + # NOTE: Para os casos onde "\n" faz parte dos argumentos. Nesses casos + # os argumentos possuem "\n" em vez de quebras de linha efetivamente. Se + # desabilitado "\n" será tratado como texto e não será convertido para + # quebras! By Questor if [ ${DONT_ECP_NL} -eq 1 ] ; then F_EZ_SED_ECP_R=$(echo "$F_EZ_SED_ECP_R" | sed 's/\\n/C0673CECED2D4A8FBA90C9B92B9508A8/g') fi + + # NOTE: Escapa valores, principalmente, para serem aplicados como + # argumentos em um comando de replace no "sed"! By Questor 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 @@ -197,10 +210,15 @@ f_ez_sed() { REPLACE. Padrão 0. DONT_ECP_NL (Optional[int]): 1 - Não "escapa" "\n" (quebra de linha); 0 - "Escapa" "\n". Padrão 1. + NOTE: Para os casos onde "\n" faz parte dos argumentos. Nesses casos + os argumentos possuem "\n" em vez de quebras de linha efetivamente. Se + desabilitado "\n" será tratado como texto e não será convertido para + quebras; REMOVE_LN (Optional[int]): 1 - Remove a linha que possui o valor em TARGET; 0 - Faz o replace convencional. Padrão 0. NTH_OCCUR (Optional[int]): Executará a operação escolhida - apenas sobre a ocorrência indicada; Se -1, não executa. Padrão -1. + apenas sobre a ocorrência indicada (utilize 2 para fazer replace apenas + na 2 ocorrencia, por exemplo); Se -1, não executa. Padrão -1. ' FILE=$3 @@ -602,8 +620,8 @@ F_GET_STDERR_R="" F_GET_STDOUT_R="" F_GET_EXIT_CODE_R=0 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"!. + : 'Executar um comando e capturar a saída de stderr, stdout e + o "exit code". Args: CMD_TO_EXEC (str): Comando a ser executado. @@ -611,6 +629,7 @@ f_get_stderr_stdout() { Returns: F_GET_STDERR_R (str): Saída para stderr. F_GET_STDOUT_R (str): Saída para stdout. + F_GET_EXIT_CODE_R (int): Código de saída. ' CMD_TO_EXEC=$1 @@ -618,9 +637,9 @@ f_get_stderr_stdout() { F_GET_STDOUT_R="" unset t_std t_err t_ret eval "$( eval "$CMD_TO_EXEC" 2> >(t_err=$(cat); typeset -p t_err) > >(t_std=$(cat); typeset -p t_std); t_ret=$?; typeset -p t_ret )" - F_GET_EXIT_CODE_R=$t_ret F_GET_STDERR_R=$t_err F_GET_STDOUT_R=$t_std + F_GET_EXIT_CODE_R=$t_ret } YES_NO_R=0 @@ -883,6 +902,8 @@ f_split() { TARGET_P=$(echo "$TARGET_P" | awk 'BEGIN {RS="dn" } {gsub("\n","£§¢¬¨") ;printf $0 }') fi + # TODO: Talvez se remover as aspas do "${TARGET_P}" logo abaixo resolva o + # problema da necessidade de usar o workaround "£§¢¬¨"! By Questor SPLIT_NOW=$(awk -F"$DELIMITER_P" '{for(i=1;i<=NF;i++){printf "%s\n", $i}}' <<<"${TARGET_P}") while IFS= read -r LINE_NOW; do @@ -1496,6 +1517,28 @@ f_procs_qtt() { fi } +F_GET_UUID_R="" +f_get_uuid() { + : 'Gerar e retornar um UUID. + + Args: + REM_DASH_P (Optional[int]): 0 - Não remove os "-" (traços); 1 - + Remove os "-" (traços). Padrão 0. + + Returns: + F_GET_UUID_R (str): UUID gerado. + ' + + REM_DASH_P=$1 + if [ -z "$REM_DASH_P" ] ; then + REM_DASH_P=0 + fi + F_GET_UUID_R=$(cat /proc/sys/kernel/random/uuid) + if [ ${REM_DASH_P} -eq 1 ] ; then + F_GET_UUID_R="${F_GET_UUID_R//-}" + fi +} + # < -------------------------------------------------------------------------- # > -------------------------------------------------------------------------- diff --git a/install.bash b/install.bash index be0d685..3ef2d2c 100755 --- a/install.bash +++ b/install.bash @@ -107,8 +107,12 @@ INSTRUCT_F="" # < -------------------------------------------------------------------------- +# NOTE: A razão para a existência dessas variáveis é "abistrair" o +# funcionamento de "f_about_distro" que obtêm informações a partir de +# dados da própria distro e portanto sujeito a variações! By Questor DISTRO_TYPE="" DISTRO_NAME="" + # > ----------------------------------------- # Checar se a distro é compatível! @@ -264,11 +268,11 @@ if [[ "$DISTRO_TYPE" == "RH" ]] ; then EZ_I_SKIP_ON_V=0 f_open_section f_div_section - f_yes_no "Disable SElinux (use "y" if you never did it)?" + f_yes_no "Disable SElinux (use \"y\" if you never did it)?" if [ ${YES_NO_R} -eq 1 ] ; then setenforce 0 - # NOTE: As condições abaixo visam evitar que o arquivo seja + # NOTE: As condições abaixo visam evitar que o arquivo seja # desnecessariamente e erroneamente modificado! By Questor EZ_I_SKIP_ON_V=$FAST_INST f_fl_cont_str "# SELINUX=enforcing" "/etc/sysconfig/selinux" "The file \"/etc/sysconfig/selinux\" probably has already been changed! Check it!" @@ -443,18 +447,16 @@ f_svc_helper() { SVC_HLP_IN_SILENCE (Optional[int]): 1 - Sem saída para o terminal; 0 - Com saída para o terminal. Padrão 0. ' - SVC_HLP_NM_P=$1 SVC_HLP_CMD_P=$2 - SVC_HLP_IN_SILENCE=$3 if [ -z "$SVC_HLP_IN_SILENCE" ] ; then SVC_HLP_IN_SILENCE=0 fi + SVC_HLP_SILENCE_CMD="" if [ ${SVC_HLP_IN_SILENCE} -eq 1 ] ; then SVC_HLP_SILENCE_CMD=" &>/dev/null" fi - if [[ "$DISTRO_TYPE" == "RH" ]] ; then eval "systemctl $SVC_HLP_CMD_P $SVC_HLP_NM_P.service$SVC_HLP_SILENCE_CMD" elif [[ "$DISTRO_TYPE" == "SUSE" ]] ; then diff --git a/liblightbase.tar.gz b/liblightbase.tar.gz index e275adf..84aae0e 100644 Binary files a/liblightbase.tar.gz and b/liblightbase.tar.gz differ -- libgit2 0.21.2