From a6a15de3e4b54d904b83491a21560876ca8eb89d Mon Sep 17 00:00:00 2001 From: Mauro Rosero P Date: Thu, 5 Dec 2024 15:47:34 -0500 Subject: [PATCH] =?UTF-8?q?[MODIFIED]=20Configuraci=C3=B3n=20de=20proyecto?= =?UTF-8?q?=20odoo=20y=20correcciones=20menores=20-=20Se=20agrega=20valida?= =?UTF-8?q?ci=C3=B3n=20de=20entrada=20(14)=20de=20selecci=C3=B3n=20entre?= =?UTF-8?q?=20rangos=20-=20Se=20corrige=20error=20de=20validaci=C3=B3n=20y?= =?UTF-8?q?=20despliegue=20de=20datos=20v=C3=A1lidos=20(13)=20-=20Se=20com?= =?UTF-8?q?pleta=20input=20de=20datos=20de=20formulario=20para=20configure?= =?UTF-8?q?.sh=20-=20Se=20crea=20archivo=20odoo.port=20que=20lleva=20el=20?= =?UTF-8?q?control=20de=20asignaci=C3=B3n=20default=20de=20puerto=20-=20Ot?= =?UTF-8?q?ros=20cambios=20y=20correciones=20menores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/configure.sh | 82 ++++++++++++++++++++++++++++++++++----------- bin/lib/console.lib | 16 +++++++-- bin/lib/odoo.lib | 8 +++++ bin/msg/head.es | 4 +-- bin/msg/odoo.es | 21 ++++++++++-- config/odoo.port | 1 + 6 files changed, 104 insertions(+), 28 deletions(-) create mode 100644 config/odoo.port diff --git a/bin/configure.sh b/bin/configure.sh index 0b5a558..d9dec18 100755 --- a/bin/configure.sh +++ b/bin/configure.sh @@ -47,27 +47,69 @@ load_messages $BIN_HOME $BIN_MESG $BIN_LANG "odoo" # Function to display help message function help() { - echo "$odmsg_003_1 $0 $odmsg_019_2" - echo "$odmsg_004" - echo "$odmsg_005" - echo "$odmsg_006" - echo "$odmsg_007" + echo "$odmsg_003_1 $0 $odmsg_019_2" + echo "$odmsg_004" + echo "$odmsg_005" + echo "$odmsg_006" + echo "$odmsg_007" } function odoo_configure_form() { - declare -a response c_lbl, c_hlp, c_mod, c_opt, c_val, c_dat + declare -a response c_lbl, c_hlp, c_mod, c_opt, c_val, c_dat, c_def - # Define gpg capture form - c_lbl[0]="${odlbl_000}" - c_hlp[0]="${odhlp_000}" - c_mod[0]=1 - c_opt[0]=0 - c_val[0]=013 - c_dat[0]="${ODOO_CFG_VERS[@]}" - c_end=1 + # Input: Versión Postgresql + c_lbl[0]="${odlbl_000}" + c_hlp[0]="${odhlp_000}" + c_mod[0]=1 + c_opt[0]=0 + c_def[0]="$ODOO_DEF_DBPG" + c_val[0]=013 + c_dat[0]="${ODOO_CFG_DBPG[@]}" + # Input: Path Postgresql DB + c_lbl[1]="${odlbl_001}" + c_hlp[1]="${odhlp_001}" + c_mod[1]=1 + c_opt[1]=0 + c_def[1]="$BIN_HOME/data/$PROJECT_NAME/db" + c_val[1]=0 + c_dat[1]="" + # Input: Path Odoo Data + c_lbl[2]="${odlbl_002}" + c_hlp[2]="${odhlp_002}" + c_mod[2]=1 + c_opt[2]=0 + c_val[2]=0 + c_def[2]="$BIN_HOME/data/$PROJECT_NAME/files" + c_dat[2]="" + # Input: Path Odoo Backup + c_lbl[3]="${odlbl_003}" + c_hlp[3]="${odhlp_003}" + c_mod[3]=1 + c_opt[3]=0 + c_val[3]=0 + c_def[3]="$BIN_HOME/backups/$PROJECT_NAME" + c_dat[3]="" + # Input: Odoo Port + c_lbl[4]="${odlbl_004}" + c_hlp[4]="${odhlp_004}" + c_mod[4]=1 + c_opt[4]=0 + c_val[4]=014 + c_def[4]="${ODOO_PFX_BASE}${ODOO_CRR_PORT}" + c_dat[4]="$ODOO_BSE_RANG" + # Input: Odoo Chat Port + c_lbl[5]="${odlbl_005}" + c_hlp[5]="${odhlp_005}" + c_mod[5]=1 + c_opt[5]=0 + c_val[5]=014 + c_def[5]="${ODOO_PFX_CHAT}${ODOO_CRR_PORT}" + c_dat[5]="$ODOO_CHT_RANG" + + c_end=6 + dialog_form - dialog_form } ########### MAIN PROGRAM ########### @@ -75,9 +117,9 @@ function odoo_configure_form() { # Check if dialog is not installed, exited! if ! command -v dialog >/dev/null 2>&1 then - display_text_header $BIN_HOME "${odmsg_000} ${odmsg_101}" - echo "${head_001}" - exit 200 + display_text_header $BIN_HOME "${odmsg_000} ${odmsg_101}" + echo "${head_001}" + exit 200 fi # Check for arguments option @@ -131,8 +173,8 @@ apps_title="${odmsg_101} ${PROJECT_NAME^^}" get_osname if [ "${os_name}" == "${head_unknow}" ] then - dialog_error_box "${head_error}" "${head_os_error}" - exit 3 + dialog_error_box "${head_error}" "${head_os_error}" + exit 3 fi # Configure odoo devs environment for project diff --git a/bin/lib/console.lib b/bin/lib/console.lib index 1773c34..d4b1c13 100755 --- a/bin/lib/console.lib +++ b/bin/lib/console.lib @@ -217,14 +217,24 @@ function dialog_validate_input() { fi ;; 013) - for item in "${valid_data}" + local -a elements=(${valid_data}) + for item in "${elements[@]}" do if [[ "$item" == "$value" ]] then return 0 fi done - dialog_error_box "${head_error}" "${vldt_013}" + dialog_error_box "${head_error}" "${vldt_013} ${valid_data}" + return 1 + ;; + 014) + local -a rangos=($valid_data) + if [ $((value)) -ge ${rangos[0]} ] && [ $((value)) -le ${rangos[0]} ] + then + return 0 + fi + dialog_error_box "${head_error}" "${vldt_014} ${rangos[0]} y ${rangos[1]}" return 1 ;; esac @@ -245,7 +255,7 @@ function dialog_form() { do case ${c_mod[control]} in 1) - dialog_input_box "[${control}] ${c_lbl[control]}" "${c_hlp[control]}" + dialog_input_box "[${control}] ${c_lbl[control]}" "${c_hlp[control]}" "${c_def[control]}" if [ ${codex} -eq 0 ] then dialog_validate_input "${c_val[control]}" "${value}" "${c_lbl[control]}" "${c_dat[control]}" diff --git a/bin/lib/odoo.lib b/bin/lib/odoo.lib index bb8d05c..21dea28 100644 --- a/bin/lib/odoo.lib +++ b/bin/lib/odoo.lib @@ -32,8 +32,16 @@ ODOO_SET=odoo.conf ODOO_LOG=odoo.log ODOO_DEF_VERS="18" +ODOO_DEF_DBPG="17" ODOO_DEF_BRCH=devs ODOO_CFG_VERS=("18") +ODOO_CFG_DBPG=("17" "16" "15" "14" "13" "12") + +ODOO_PFX_BASE="1" +ODOO_PFX_CHAT="2" +ODOO_CRR_PORT="$(cat $BIN_HOME/config/odoo.port)" +ODOO_BSE_RANG="${ODOO_PFX_BASE}0101 ${ODOO_PFX_BASE}0999" +ODOO_CHT_RANG="${ODOO_PFX_CHAT}0101 ${ODOO_PFX_CHAT}0999" ODOO_PKG_BASE=base ODOO_PKG_DEVS=devs diff --git a/bin/msg/head.es b/bin/msg/head.es index f5a0963..3090694 100644 --- a/bin/msg/head.es +++ b/bin/msg/head.es @@ -37,8 +37,8 @@ vldt_002="Contraseña incorrecta! Intente nuevamente." vldt_010="Dirección de correo electrónico es inválida!" vldt_011="Duración de clave gpg inválida!" vldt_012="No es un nombre de dominio DNS válido!" -vldt_013="Valor incorrecto!" - +vldt_013="Valor debe ser alguno de estos:" +vldt_014="Valor no está dentro del rango válido:" os_update="Actualizando sistema operativo " os_nofound="Sistemas operativos soportados: Ubuntu, Debian, Arch Linux, Fedora, Redhat, AlmaLinux, Rocky, Oracle Linux, FreeBSD, MacOS" diff --git a/bin/msg/odoo.es b/bin/msg/odoo.es index 544a27d..5ffe140 100644 --- a/bin/msg/odoo.es +++ b/bin/msg/odoo.es @@ -42,6 +42,21 @@ odmsg_019_2=" [--help] [--version]" odmsg_201="Desea configurar ambiente de desarrollo para el proyecto" -# Input: Versión Odoo -odlbl_000="Versión Odoo" -odhlp_000="Especificar la versión de odoo en uso" +# Input: Versión Postgresql +odlbl_000="Versión PG" +odhlp_000="Especificar la versión de contenedor postgresql en uso" +# Input: Path Postgresql DB +odlbl_001="PG Path" +odhlp_001="Ruta de la base de datos postgresql del proyecto" +# Input: Path Odoo Data +odlbl_002="Ruta de la carpeta de datos de la instancia" +odhlp_002="Ruta donde se almacenaran los datos de la instancia en uso" +# Input: Path Odoo Backup +odlbl_003="Backup Path" +odhlp_003="Ruta de las copias de seguridad de la instancia" +# Input: Odoo Port +odlbl_004="Puerto ODOO" +odhlp_004="Puerto de comunicación que usará la instancia Odoo" +# Input: Odoo Chat Port +odlbl_005="Puerto ODOO CHAT" +odhlp_005="Puerto de comunicación que usará el chat de la instancia Odoo" diff --git a/config/odoo.port b/config/odoo.port new file mode 100644 index 0000000..7d0d318 --- /dev/null +++ b/config/odoo.port @@ -0,0 +1 @@ +0101