Improve readability of initialize and start scripts

This commit is contained in:
Stéphane Bidoul 2021-12-20 22:59:58 +01:00
parent 3b3a6f4ea9
commit c383c3c31d
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
3 changed files with 17 additions and 19 deletions

View file

@ -2,21 +2,12 @@
set -ex
# If it exists, copy the previously initialized venv.
if [ -f /mnt/data/initialized ] ; then
pip list
# Install 'deb' external dependencies of all Odoo addons found in path.
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends $(oca_list_external_dependencies deb)
exit 0
fi
DEBIAN_FRONTEND=noninteractive apt-get -yqq install rsync
# Remove initialization sentinel, in case we are reinitializing.
rm -fr /mnt/data/initialized
# Remove addons dir, in case we are reinitializing after a previously
# failed installation.
rm -fr $ADDONS_DIR
# Clone the repository at git reference into $ADDONS_DIR.
git clone --quiet --filter=blob:none $RUNBOAT_GIT_REPO $ADDONS_DIR
cd $ADDONS_DIR
@ -27,6 +18,7 @@ git checkout build
oca_install_addons
# Keep a copy of the venv that we can re-use for shorter startup time.
rsync -a /opt/odoo-venv/ /mnt/data/odoo-venv
DEBIAN_FRONTEND=noninteractive apt-get -yqq install rsync
rsync -a --delete /opt/odoo-venv/ /mnt/data/odoo-venv
touch /mnt/data/initialized

View file

@ -1,7 +1,7 @@
#!/bin/bash
#
# Install all addons in the test database.
# Clone repo and install all addons in the test database.
#
set -ex
@ -17,7 +17,6 @@ ADDONS=$(addons --addons-dir ${ADDONS_DIR} --include "${INCLUDE}" --exclude "${E
unbuffer $(which odoo || which openerp-server) \
--data-dir=/mnt/data/odoo-data-dir \
--db-template=template1 \
-d ${PGDATABASE} \
-i ${ADDONS:-base} \
--stop-after-init

View file

@ -6,16 +6,23 @@
set -ex
bash /runboat/runboat-clone-and-install.sh
if [ ! -f /mnt/data/initialized ] ; then
echo "Build is not initialized. Cannot start."
exit 1
fi
# show what is installed (the venv in /opt/odoo-venv has been mounted)
pip list
# Install 'deb' external dependencies of all Odoo addons found in path.
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends $(oca_list_external_dependencies deb)
oca_wait_for_postgres
# --db_user and --db_filter is necessary for Odoo <= 10
# --db_user is necessary for Odoo <= 10
unbuffer $(which odoo || which openerp-server) \
--data-dir=/mnt/data/odoo-data-dir \
--no-database-list \
-d ${PGDATABASE} \
--database ${PGDATABASE} \
--db-filter=^${PGDATABASE} \
--db_user=${PGUSER}