Files
Odoo-Build/images/odoo/bin/check-database-initialized
T
Janik von Rotz 069648b278 feat(images/odoo): enforce bash coding conventions and improve git config handling
- Enforce bash coding conventions across all scripts as outlined in new AGENTS.md
- Convert local variables to lowercase and use proper quoting
- Update conditionals to use `[[ ... ]]` and remove `function` keyword
- Add support for setting git author name and email via env vars
- Improve SSH key handling and git operations
- Update documentation and changelog to reflect changes
2025-10-29 19:03:23 +01:00

19 lines
643 B
Bash
Executable File

#!/usr/bin/env bash
set -e
if [[ -n "$ODOO_DATABASE" ]]; then
log-entrypoint "Check if database $ODOO_DATABASE is initialized..."
database_initialized=$(exec psql "postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/$ODOO_DATABASE" -tAc "SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'ir_module_module'")
if [[ "$database_initialized" = "1" ]]; then
log-entrypoint "Database $ODOO_DATABASE is initialized."
exit 0
else
log-entrypoint "Database $ODOO_DATABASE is not initialized."
exit 1
fi
else
log-entrypoint 'ODOO_DATABASE environment variable not set.'
exit 1
fi