From 9c3a2dd128af4dde270f7248deb18a99b50d4072 Mon Sep 17 00:00:00 2001 From: Anang Aji Rahmawan Date: Sat, 26 Oct 2019 01:46:46 +0700 Subject: [PATCH] [FIX] Odoo 11.0-13.0: get database config value --- 11.0/entrypoint.sh | 11 ++++++----- 12.0/entrypoint.sh | 9 +++++---- 13.0/entrypoint.sh | 9 +++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/11.0/entrypoint.sh b/11.0/entrypoint.sh index 5638e6d..8e7626d 100755 --- a/11.0/entrypoint.sh +++ b/11.0/entrypoint.sh @@ -12,11 +12,12 @@ set -e DB_ARGS=() function check_config() { param="$1" - value="$2" - if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then - DB_ARGS+=("--${param}") - DB_ARGS+=("${value}") - fi; + value="$2" + if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then + value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g') + fi; + DB_ARGS+=("--${param}") + DB_ARGS+=("${value}") } check_config "db_host" "$HOST" check_config "db_port" "$PORT" diff --git a/12.0/entrypoint.sh b/12.0/entrypoint.sh index 5638e6d..6dd42c4 100755 --- a/12.0/entrypoint.sh +++ b/12.0/entrypoint.sh @@ -13,10 +13,11 @@ DB_ARGS=() function check_config() { param="$1" value="$2" - if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then - DB_ARGS+=("--${param}") - DB_ARGS+=("${value}") - fi; + if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then + value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g') + fi; + DB_ARGS+=("--${param}") + DB_ARGS+=("${value}") } check_config "db_host" "$HOST" check_config "db_port" "$PORT" diff --git a/13.0/entrypoint.sh b/13.0/entrypoint.sh index 5638e6d..6dd42c4 100755 --- a/13.0/entrypoint.sh +++ b/13.0/entrypoint.sh @@ -13,10 +13,11 @@ DB_ARGS=() function check_config() { param="$1" value="$2" - if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then - DB_ARGS+=("--${param}") - DB_ARGS+=("${value}") - fi; + if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then + value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g') + fi; + DB_ARGS+=("--${param}") + DB_ARGS+=("${value}") } check_config "db_host" "$HOST" check_config "db_port" "$PORT"