creation 1.1.add_Modules_Dir_in_odoo.conf.sh
This commit is contained in:
parent
dde58b695f
commit
7eb8cb5897
1 changed files with 27 additions and 0 deletions
27
1.1.add_Modules_Rep_in_odoo.conf.sh
Normal file
27
1.1.add_Modules_Rep_in_odoo.conf.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
CUSTOM_DIR="${CUSTOM_DIR:-./custom}"
|
||||
CONTAINER_PREFIX="/mnt/extra-addons"
|
||||
ODOO_CONF="${ODOO_CONF:-./odoo.conf}"
|
||||
|
||||
# Liste les sous-répertoires (1er niveau), trie, préfixe, joint avec virgules
|
||||
SUBDIRS=$(
|
||||
find "$CUSTOM_DIR" -mindepth 1 -maxdepth 1 -type d \
|
||||
! -name '.*' -printf '%f\n' \
|
||||
| sort \
|
||||
| sed "s|^|${CONTAINER_PREFIX}/|" \
|
||||
| paste -sd,
|
||||
)
|
||||
|
||||
# Concatène /mnt/extra-addons (racine) + tous les sous-dirs
|
||||
ADDONS_PATH="${CONTAINER_PREFIX},${SUBDIRS}"
|
||||
|
||||
# Remplace ou ajoute la ligne addons_path dans odoo.conf
|
||||
if grep -qE "^[[:space:]]*#?[[:space:]]*addons_path[[:space:]]*=" "$ODOO_CONF"; then
|
||||
sed -i -E "s|^[[:space:]]*#?[[:space:]]*addons_path[[:space:]]*=.*|addons_path = ${ADDONS_PATH}|" "$ODOO_CONF"
|
||||
else
|
||||
sed -i -E "/^\[options\]/a addons_path = ${ADDONS_PATH}" "$ODOO_CONF"
|
||||
fi
|
||||
|
||||
echo "addons_path = ${ADDONS_PATH}"
|
||||
Loading…
Reference in a new issue