From 208080765cd3675ec7de0c77cd1f22b50807233c Mon Sep 17 00:00:00 2001
From: remi-filament <30716308+remi-filament@users.noreply.github.com>
Date: Wed, 23 Jan 2019 12:10:40 +0100
Subject: [PATCH] Add check for unaccent db

---
 entrypoint.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/entrypoint.sh b/entrypoint.sh
index 26c7cd0..5cf1d33 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -30,7 +30,14 @@ export PGUSER=$value
 check_config "db_password" "$PASSWORD"
 export PGPASSWORD=$value
 
-psql -qc 'CREATE EXTENSION IF NOT EXISTS unaccent'
+result="$(psql -qc 'CREATE EXTENSION IF NOT EXISTS unaccent' 2>&1)"
+ok=$?
+if [ $ok -eq 0 -a -z "$result" ]; then
+    echo "INFO Unaccent extension installed"
+elif [ $ok -ne 0 ]; then
+    echo "WARNING Attempt to install unaccent in \
+        $PGDATABASE@$PGHOST failed with this message: $result"
+fi
 
 case "$1" in
     -- | odoo)
-- 
GitLab