Corrections issues de la revue complète des 13 VM (6 en échec réel) : - APT lock (debian-12) : au 1er boot, cloud-init/apt-daily tient le verrou et « apt-get install » échouait aussitôt. Ajout de « -o DPkg::Lock::Timeout=600 » (update + install) -> attend le verrou. - wkhtmltopdf Debian 13 « trixie » (debian-13) : on prenait le build « bullseye » (dépend de libssl1.1, absent de trixie) -> gdebi échouait. Désormais bookworm pour bookworm/trixie/+. ET l'échec gdebi est NON bloquant (avertissement au lieu d'exit 1 : wkhtmltopdf est optionnel, sinon tout install_os avortait et Odoo n'était jamais installé). - SELinux 203/EXEC (fedora-41/43/44) : un service système ne peut pas exécuter run.sh/venv sous /home (contexte user_home_t). Ajout conditionnel de « SELinuxContext=unconfined_u:unconfined_r:unconfined_t:s0 » au service (uniquement si getenforce != Disabled). - poetry status 1 (ubuntu-2604) : « -q » masquait la cause. À l'échec, on rejoue « poetry install -v » pour capturer l'erreur dans le log. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
126 lines
4.9 KiB
Bash
Executable file
126 lines
4.9 KiB
Bash
Executable file
. ./env_var.sh
|
||
EL_USER=${USER}
|
||
EL_HOME=$PWD
|
||
EL_HOME_ODOO="${EL_HOME}/odoo${EL_ODOO_VERSION}/odoo"
|
||
#EL_INSTALL_WKHTMLTOPDF="True"
|
||
#EL_PORT="8069"
|
||
#EL_LONGPOLLING_PORT="8072"
|
||
#EL_SUPERADMIN="admin"
|
||
#EL_CONFIG_FILE="${EL_HOME}/config.conf"
|
||
#EL_CONFIG="${EL_USER}"
|
||
#EL_MINIMAL_ADDONS="False"
|
||
#EL_INSTALL_NGINX="True"
|
||
FILE_INSTALLATION_VERSION=".repo/installed_odoo_version.txt"
|
||
|
||
Red='\033[0;31m' # Red
|
||
Color_Off='\033[0m' # Text Reset
|
||
|
||
# example, 3.7.8 will be 3.7 into PYTHON_VERSION_MAJOR
|
||
PYTHON_VERSION_MAJOR=$(echo "$EL_PYTHON_ODOO_VERSION" | sed 's/\.[^\.]*$//')
|
||
VENV_ERPLIBRE_PATH=$(cat "conf/python-erplibre-venv" | xargs)
|
||
VENV_ODOO_PATH=".venv.${EL_ERPLIBRE_VERSION}"
|
||
POETRY_ODOO_PATH=${VENV_ERPLIBRE_PATH}/bin/poetry
|
||
export WITH_POETRY_INSTALLATION=1
|
||
|
||
# Verbosité de l'installation Poetry : silencieuse (-q) par défaut, les logs
|
||
# détaillés (-vvv) reviennent avec la variable d'environnement EL_VERBOSE=1.
|
||
if [[ "${EL_VERBOSE:-0}" == "1" ]]; then
|
||
POETRY_VERBOSE="-vvv"
|
||
else
|
||
POETRY_VERBOSE="-q"
|
||
fi
|
||
|
||
# EL_PHASE controls which steps to execute. Used by install_locally_dev.sh
|
||
# for parallel installation — do not set manually unless you know what you do.
|
||
# all (default) – full install: setup + poetry phases
|
||
# setup – prereqs only: venvs, pip-erplibre, git-repo
|
||
# poetry – python packages: poetry install + post-install
|
||
EL_PHASE=${EL_PHASE:-all}
|
||
|
||
# ── Setup phase (venvs + pip-erplibre + git-repo) ────────────────────────────
|
||
if [[ "${EL_PHASE}" != "poetry" ]]; then
|
||
./script/generate_config.sh
|
||
|
||
# Generate empty addons if missing
|
||
path_addons_addons="./odoo${EL_ODOO_VERSION}/addons/addons"
|
||
if [[ ! -d "${path_addons_addons}" ]]; then
|
||
mkdir -p "${path_addons_addons}"
|
||
fi
|
||
|
||
if [[ ! -n "${DOCKER_BUILD}" ]]; then
|
||
# Install ERPLibre venv
|
||
echo -e "Install ${VENV_ERPLIBRE_PATH} with ${EL_PYTHON_ERPLIBRE_VERSION}"
|
||
./script/install/install_venv.sh "ERPLibre" "${VENV_ERPLIBRE_PATH}" "${EL_PYTHON_ERPLIBRE_VERSION}"
|
||
# Install Odoo venv
|
||
echo -e "Install ${VENV_ODOO_PATH} with ${EL_PYTHON_ODOO_VERSION}"
|
||
./script/install/install_venv.sh "Odoo" "${VENV_ODOO_PATH}" "${EL_PYTHON_ODOO_VERSION}"
|
||
else
|
||
mkdir .venv
|
||
fi
|
||
|
||
source ./${VENV_ERPLIBRE_PATH}/bin/activate
|
||
echo -e "Upgrade pip to ${VENV_ERPLIBRE_PATH}"
|
||
pip install --upgrade pip
|
||
pip install -r requirement/erplibre_require-ments.txt
|
||
|
||
./script/install/install_git_repo.sh
|
||
fi
|
||
|
||
# ── Poetry phase (install python packages + post-install) ────────────────────
|
||
if [[ "${EL_PHASE}" != "setup" ]]; then
|
||
source ${VENV_ODOO_PATH}/bin/activate
|
||
echo -e "Upgrade pip to ${VENV_ODOO_PATH}"
|
||
pip install --upgrade pip
|
||
|
||
echo -e "\n---- Installing poetry dependency ----"
|
||
|
||
if [[ -z "${EL_POETRY_VERSION}" ]]; then
|
||
echo -e "${Red}Error${Color_Off} missing poetry version, please check file .poetry-version"
|
||
cat .poetry-version
|
||
ls -la
|
||
exit 1
|
||
fi
|
||
|
||
# Delete artifacts created by pip, cause error in next "poetry install"
|
||
if [[ ! -f "${POETRY_ODOO_PATH}" ]]; then
|
||
echo -e "Install Poetry ${POETRY_ODOO_PATH}"
|
||
pip install poetry==${EL_POETRY_VERSION}
|
||
poetry --version
|
||
# Fix broken poetry by installing ignored dependence
|
||
# poetry lock --no-update
|
||
# To fix keyring problem when installation is blocked, use
|
||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||
if [[ ${WITH_POETRY_INSTALLATION} -ne 0 ]]; then
|
||
poetry install --no-root ${POETRY_VERBOSE}
|
||
fi
|
||
retVal=$?
|
||
if [[ $retVal -ne 0 ]]; then
|
||
echo "Poetry installation error with status ${retVal}"
|
||
# Par défaut « -q » masque la CAUSE (ex. échec de build d'une
|
||
# dépendance git/VCS). On rejoue en verbeux pour la capturer dans
|
||
# le log -> diagnostic possible sans EL_VERBOSE.
|
||
echo "---- Poetry: rejeu verbeux pour diagnostic ----"
|
||
poetry install --no-root -v 2>&1 || true
|
||
exit 1
|
||
fi
|
||
fi
|
||
|
||
# Delete artifacts created by pip, cause error in next "poetry install"
|
||
rm -rf artifacts
|
||
|
||
# Link for dev tools into Odoo
|
||
echo -e "\n---- Add link dependency in site-packages of Python ----"
|
||
# TODO this link can break, the symbolic link is maybe not created
|
||
ln -fs "${EL_HOME_ODOO}/odoo" "${EL_HOME}/${VENV_ODOO_PATH}/lib/python${PYTHON_VERSION_MAJOR}/site-packages/"
|
||
|
||
# Force to return to erplibre source
|
||
source ./${VENV_ERPLIBRE_PATH}/bin/activate
|
||
|
||
# Add trace of installation
|
||
LINE_TO_ADD="odoo${EL_ODOO_VERSION}"
|
||
mkdir -p "$(dirname "$FILE_INSTALLATION_VERSION")"
|
||
touch "$FILE_INSTALLATION_VERSION"
|
||
if ! grep -qxF "$LINE_TO_ADD" "$FILE_INSTALLATION_VERSION"; then
|
||
echo "$LINE_TO_ADD" >> "$FILE_INSTALLATION_VERSION"
|
||
fi
|
||
fi
|