-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathinstall
executable file
·42 lines (36 loc) · 995 Bytes
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# Version: v.22.05.30
set -e
SCRIPT_PATH="$(cd "$(/usr/bin/dirname "${0}")" && /bin/pwd)"
ODOO_WORK_DIR="${SCRIPT_PATH}"
. "${ODOO_WORK_DIR}/.env-default" && \
. "${ODOO_WORK_DIR}/.env-shared" && \
. "${ODOO_WORK_DIR}/.env-secret"
cd "${ODOO_WORK_DIR}"
if [ "${#}" -le 1 ]; then
/bin/echo "Installs a new empty database"
/bin/echo "Usage: ./install databasename modulename [nodemo]"
exit
fi
if [ "${3}" = "nodemo" ]
then
WITHOUT_DEMO="--without-demo=1"
/bin/echo "Without demo data"
else
WITHOUT_DEMO="--without-demo="
/bin/echo "With demo data"
fi
if [ "$(/usr/bin/psql -d template1 -tAc "SELECT 1 FROM pg_database WHERE datname='${1}'" )" = '1' ]
then
/bin/echo "Database '${1}' already exists. If you want to drop it: 'dropdb ${1}'"
exit 1
else
createdb "${1}"
fi
cd "${ODOO_WORK_DIR}" && . .venv/bin/activate && odoo \
-c ./auto/odoo.conf \
--load-language=en_US,nl_NL \
-i "${2}" \
-d "${1}" \
--stop-after-init \
"${WITHOUT_DEMO}"