Mauro Rosero P
a5961e1aaa
- Se agregó una validación nueva(13) para lista de elementos - Se cambiaron los nombres de las funciones de consola - Se hicieron correcciones y mejoras a las funciones de consola con dialog
160 lines
3.4 KiB
Bash
Executable file
160 lines
3.4 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# configure.sh
|
|
# Modified: 2024/12/04 14:47:00
|
|
# Derechos de Autor (C) [2024] [Mauro Rosero P. <mauro@roser.one>]
|
|
#
|
|
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
|
|
# bajo los términos de la Licencia Pública Affero General de GNU tal como
|
|
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
|
|
# o (a su elección) cualquier versión posterior.
|
|
#
|
|
# Este programa se distribuye con la esperanza de que sea útil,
|
|
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
|
|
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
|
|
# Licencia Pública Affero General de GNU para obtener más detalles.
|
|
#
|
|
# Debería haber recibido una copia de la Licencia Pública Affero General
|
|
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
|
|
|
|
DEVSPATH=developers
|
|
DEVSTEAM=odoo
|
|
BIN_HOME=$HOME/$DEVSPATH/$DEVSTEAM
|
|
BIN_MESG=bin/msg
|
|
BIN_LIBS=bin/lib
|
|
VERSION="$(cat $BIN_HOME/config/project.version)"
|
|
|
|
# CHECK SHELL LANGUAGE
|
|
BIN_LANG=${LANG:0:2}
|
|
|
|
# LOAD BASE BASH LIBRARY
|
|
source $BIN_HOME/$BIN_LIBS/base.lib
|
|
#baselib_test
|
|
|
|
# LOAD CONSOLE BASH LIBRARY
|
|
source $BIN_HOME/$BIN_LIBS/console.lib
|
|
#consolelib_test
|
|
|
|
# LOAD ODOO BASH LIBRARY
|
|
source $BIN_HOME/$BIN_LIBS/odoo.lib
|
|
#odoolib_test
|
|
|
|
# Load head messages
|
|
load_messages $BIN_HOME $BIN_MESG $BIN_LANG "head"
|
|
|
|
# Load odoo messages
|
|
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"
|
|
}
|
|
|
|
function odoo_configure_form() {
|
|
|
|
declare -a response c_lbl, c_hlp, c_mod, c_opt, c_val, c_dat
|
|
|
|
# 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
|
|
|
|
dialog_form
|
|
}
|
|
|
|
########### MAIN PROGRAM ###########
|
|
|
|
# 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
|
|
fi
|
|
|
|
# Check for arguments option
|
|
help=false
|
|
version=false
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--help)
|
|
help=true
|
|
shift
|
|
;;
|
|
--version)
|
|
version=true
|
|
shift
|
|
;;
|
|
*)
|
|
if [[ -z $PROJECT_NAME ]]; then
|
|
PROJECT_NAME="$1"
|
|
shift
|
|
else
|
|
help
|
|
exit 1
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Check to show help
|
|
if $help; then
|
|
help
|
|
exit 0
|
|
fi
|
|
|
|
# Check to show command version
|
|
if $version; then
|
|
echo "$head_version $VERSION"
|
|
exit 0
|
|
fi
|
|
|
|
# Check for empty project path
|
|
if [[ -z $PROJECT_NAME ]]; then
|
|
help
|
|
exit 1
|
|
fi
|
|
|
|
# Set program title
|
|
title="$(cat < $BIN_HOME/config/project.head) ${odmsg_000}"
|
|
apps_title="${odmsg_101} ${PROJECT_NAME^^}"
|
|
|
|
# Check if os is valid!
|
|
get_osname
|
|
if [ "${os_name}" == "${head_unknow}" ]
|
|
then
|
|
dialog_error_box "${head_error}" "${head_os_error}"
|
|
exit 3
|
|
fi
|
|
|
|
# Configure odoo devs environment for project
|
|
dialog_yesno "${odmsg_201} ${PROJECT_NAME}?"
|
|
case ${result} in
|
|
0)
|
|
odoo_configure_form
|
|
case $? in
|
|
0)
|
|
clear
|
|
exit 0
|
|
;;
|
|
*)
|
|
dialog_error_box "${head_info}" "${head_op_error}"
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
dialog_error_box "${head_info}" "${head_op_error}"
|
|
;;
|
|
esac
|
|
|
|
# Clear console and exit
|
|
clear
|
|
exit 0
|