From 84e383a3b18ce0c7e6dc8d9549f7ba9fb785b8b0 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 28 Jul 2026 05:07:10 +0000 Subject: [PATCH] [FIX] script install: Fedora support + Ubuntu apt-lock/postgis fixes From the QEMU install logs: Debian 12 succeeded, Ubuntu 24.04 and Fedora 42 failed. Ubuntu (install_debian_dependency.sh): - apt failed with "Could not get lock" (cloud-init/unattended-upgrades hold it on first boot) -> all apt-get calls now use DPkg::Lock::Timeout=600 so apt waits for the lock. - "postgis" is not a package on Ubuntu 24.04, so the postgresql line exited 1 before installing build-essential -> no C compiler -> pyenv could not build Python 3.12.10. PostGIS is now best-effort (tries postgis, then postgresql-postgis) and never aborts; postgresql-contrib is added. Fedora (new install_fedora_dependency.sh, wired into install_dev.sh): - install_dev.sh dispatched Fedora to the apt script; it now has a fedora / ID_LIKE branch calling a dnf-based dependency installer (dev tools, postgresql-server + initdb, pyenv build deps, node, etc.), using --refresh --skip-unavailable to tolerate mirror/name issues. Bootstrap (todo.py): the dnf "curl git make" install hit a GPG/checksum failure on a fresh image; it now uses --refresh and retries after "dnf clean all". Co-Authored-By: Claude Opus 4.8 (1M context) --- script/install/install_debian_dependency.sh | 36 ++++--- script/install/install_dev.sh | 5 +- script/install/install_fedora_dependency.sh | 114 ++++++++++++++++++++ script/todo/todo.py | 6 +- 4 files changed, 146 insertions(+), 15 deletions(-) create mode 100755 script/install/install_fedora_dependency.sh diff --git a/script/install/install_debian_dependency.sh b/script/install/install_debian_dependency.sh index adbc2d5..693b769 100755 --- a/script/install/install_debian_dependency.sh +++ b/script/install/install_debian_dependency.sh @@ -5,6 +5,11 @@ EL_USER=${USER} #EL_INSTALL_WKHTMLTOPDF="True" +# apt-get qui ATTEND le verrou (jusqu'à 10 min) : sur une image cloud fraîche, +# cloud-init / unattended-upgrades tiennent souvent le verrou apt au 1er boot +# (« Could not get lock » -> échec de l'install). DPkg::Lock::Timeout patiente. +APT_GET="sudo apt-get -o DPkg::Lock::Timeout=600" + ## ### WKHTMLTOPDF download links ## === Ubuntu Focal x64 === (for other distributions please replace these two links, @@ -55,25 +60,30 @@ echo -e "\n---- Update Server ----" if [ "18.04" == "${UBUNTU_VERSION}" ]; then # add-apt-repository can install add-apt-repository Ubuntu 18.x - sudo apt-get install software-properties-common curl -y + ${APT_GET} install software-properties-common curl -y # universe package is for Ubuntu 18.x sudo add-apt-repository universe # libpng12-0 dependency for wkhtmltopdf sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main" - sudo apt-get update - sudo apt-get upgrade -y + ${APT_GET} update + ${APT_GET} upgrade -y fi #-------------------------------------------------- # Install PostgreSQL Server #-------------------------------------------------- echo -e "\n---- Install PostgreSQL Server ----" -sudo apt-get install postgresql libpq-dev postgis -y +${APT_GET} install postgresql postgresql-contrib libpq-dev -y retVal=$? if [[ $retVal -ne 0 ]]; then echo "apt-get install postgresql installation error." exit 1 fi +# PostGIS : optionnel (géospatial). Le nom du paquet « postgis » n'existe pas +# sur toutes les versions (Ubuntu 24.04) -> best-effort, ne bloque pas. +${APT_GET} install postgis -y \ + || ${APT_GET} install postgresql-postgis -y \ + || echo "PostGIS non installé (optionnel)." echo -e "\n---- Creating the ERPLibre PostgreSQL User ----" sudo su - postgres -c "createuser -s ${EL_USER}" 2>/dev/null || true @@ -82,20 +92,20 @@ sudo su - postgres -c "createuser -s ${EL_USER}" 2>/dev/null || true # Install Dependencies #-------------------------------------------------- echo -e "\n--- Installing debian dependency --" -sudo apt-get install git build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev gdebi-core libffi-dev libbz2-dev parallel pysassc swig cmake portaudio19-dev libcups2-dev shfmt xmlsec1 -y +${APT_GET} install git build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev gdebi-core libffi-dev libbz2-dev parallel pysassc swig cmake portaudio19-dev libcups2-dev shfmt xmlsec1 -y retVal=$? if [[ $retVal -ne 0 ]]; then echo "apt-get debian tool installation error." exit 1 fi -sudo apt-get install libmariadbd-dev freetds-dev -y +${APT_GET} install libmariadbd-dev freetds-dev -y retVal=$? if [[ $retVal -ne 0 ]]; then echo "apt-get libmariadb installation error." exit 1 fi if [ "18.04" == "${UBUNTU_VERSION}" ]; then - sudo apt-get install libpng12-0 -y + ${APT_GET} install libpng12-0 -y retVal=$? if [[ $retVal -ne 0 ]]; then echo "apt-get libpng installation error." @@ -103,14 +113,14 @@ if [ "18.04" == "${UBUNTU_VERSION}" ]; then fi fi # Dependencies for pyenv -sudo apt-get install make libssl-dev zlib1g-dev libreadline-dev libsqlite3-dev curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev liblzma-dev -y +${APT_GET} install make libssl-dev zlib1g-dev libreadline-dev libsqlite3-dev curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev liblzma-dev -y retVal=$? if [[ $retVal -ne 0 ]]; then echo "apt-get pyenv dependencies installation error." exit 1 fi # Dependencies for selenium -sudo apt-get install libcairo2-dev python3-dev pkg-config libxt-dev libgirepository1.0-dev -y +${APT_GET} install libcairo2-dev python3-dev pkg-config libxt-dev libgirepository1.0-dev -y retVal=$? if [[ $retVal -ne 0 ]]; then echo "apt-get selenium dependencies installation error." @@ -118,8 +128,8 @@ if [[ $retVal -ne 0 ]]; then fi echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----" -sudo apt-get update -sudo apt-get install -y ca-certificates curl gnupg +${APT_GET} update +${APT_GET} install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg @@ -132,8 +142,8 @@ else fi echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list -sudo apt-get update -sudo apt-get install nodejs -y +${APT_GET} update +${APT_GET} install nodejs -y sudo npm install npm@latest -g retVal=$? diff --git a/script/install/install_dev.sh b/script/install/install_dev.sh index 2220a12..59a7970 100755 --- a/script/install/install_dev.sh +++ b/script/install/install_dev.sh @@ -20,9 +20,12 @@ if [[ "${OSTYPE}" == "linux-gnu" ]]; then ./script/install/install_debian_dependency.sh elif [[ "${ID}" == "arch" ]]; then ./script/install/install_arch_linux.sh + elif [[ "${ID}" == "fedora" || "${ID_LIKE}" == *"fedora"* || "${ID_LIKE}" == *"rhel"* ]]; then + echo "\n---- Fedora installation process started ----" + ./script/install/install_fedora_dependency.sh else ./script/install/install_debian_dependency.sh - echo "Your Linux system is not supported, only support Ubuntu 18.04 or Ubuntu 20.04 or Ubuntu 22.04 - Ubuntu 23.10 - Ubuntu 24.04, Ubuntu 25.04, Ubuntu 25.10 ." + echo "Your Linux system is not supported, only support Ubuntu 18.04 or Ubuntu 20.04 or Ubuntu 22.04 - Ubuntu 23.10 - Ubuntu 24.04, Ubuntu 25.04, Ubuntu 25.10, Debian, Fedora, Arch." fi elif [[ "${OSTYPE}" == "darwin"* ]]; then echo "\n---- Darwin installation process started ----" diff --git a/script/install/install_fedora_dependency.sh b/script/install/install_fedora_dependency.sh new file mode 100755 index 0000000..a3118d7 --- /dev/null +++ b/script/install/install_fedora_dependency.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env bash +# © 2021-2026 TechnoLibre (http://www.technolibre.ca) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) +# +# Dépendances système ERPLibre pour Fedora (dnf). Équivalent Fedora de +# install_debian_dependency.sh. « --skip-unavailable » tolère un nom de paquet +# absent (dnf5) au lieu d'échouer sur tout le lot. + +. ./env_var.sh + +EL_USER=${USER} + +# dnf résilient : rafraîchit le cache (évite « checksum doesn't match » / +# signature après un cache périmé) et saute les paquets introuvables. +DNF="sudo dnf install -y --refresh --skip-unavailable" + +#-------------------------------------------------- +# Outils de compilation (build Python via pyenv, extensions Python) +#-------------------------------------------------- +echo -e "\n---- Groupe outils de développement ----" +sudo dnf group install -y --skip-unavailable development-tools "C Development Tools and Libraries" \ + || sudo dnf install -y gcc gcc-c++ make automake patch + +#-------------------------------------------------- +# PostgreSQL +#-------------------------------------------------- +echo -e "\n---- Install PostgreSQL Server ----" +${DNF} postgresql-server postgresql-contrib libpq-devel +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "dnf install postgresql installation error." + exit 1 +fi +# Initialisation du cluster (Fedora ne le fait pas automatiquement). +if [ ! -f /var/lib/pgsql/data/PG_VERSION ]; then + echo -e "\n---- Initialisation du cluster PostgreSQL ----" + sudo postgresql-setup --initdb || true +fi +sudo systemctl enable --now postgresql 2>/dev/null || true +# PostGIS : optionnel (géospatial), ne bloque pas. +${DNF} postgis || echo "PostGIS non installé (optionnel)." + +echo -e "\n---- Creating the ERPLibre PostgreSQL User ----" +sudo su - postgres -c "createuser -s ${EL_USER}" 2>/dev/null || true + +#-------------------------------------------------- +# Dépendances de build (extensions Python, Odoo) +#-------------------------------------------------- +echo -e "\n--- Installing fedora dependency --" +${DNF} \ + git wget libxslt-devel libzip-devel openldap-devel cyrus-sasl-devel \ + libffi-devel bzip2-devel parallel swig cmake portaudio-devel \ + cups-devel xmlsec1 xmlsec1-openssl mariadb-connector-c-devel freetds-devel +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "dnf fedora tool installation error." + exit 1 +fi + +# Dépendances de build pour pyenv (compilation de CPython) — CRITIQUE. +echo -e "\n---- Dépendances pyenv (compilation Python) ----" +${DNF} \ + make gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel \ + openssl-devel tk-devel libffi-devel xz-devel patch findutils +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "dnf pyenv dependencies installation error." + exit 1 +fi + +# Dépendances selenium / bindings. +${DNF} \ + cairo-devel python3-devel pkgconf-pkg-config gobject-introspection-devel \ + libXt-devel || echo "Dépendances selenium partielles (optionnel)." + +#-------------------------------------------------- +# Node.js + npm (rtlcss, less) +#-------------------------------------------------- +echo -e "\n---- Installing nodeJS NPM and rtlcss ----" +${DNF} nodejs npm +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "dnf nodejs installation error." + exit 1 +fi +sudo npm install -g rtlcss less || echo "npm rtlcss/less: erreur (optionnel)." + +echo -e "\n---- Test tool ----" +npm install || echo "npm install (prettier/plugin-xml): erreur (optionnel)." +sudo ln -fs /usr/local/bin/lessc /usr/bin/lessc 2>/dev/null || true + +#-------------------------------------------------- +# nginx (optionnel) +#-------------------------------------------------- +if [ "${EL_INSTALL_NGINX}" = "True" ]; then + echo -e "\n---- Installing nginx ----" + ${DNF} nginx || echo "nginx: erreur (optionnel)." +fi + +#-------------------------------------------------- +# wkhtmltopdf (optionnel) — paquet RPM officiel wkhtmltopdf +#-------------------------------------------------- +if [ "${EL_INSTALL_WKHTMLTOPDF}" = "True" ]; then + if ! command -v wkhtmltopdf >/dev/null 2>&1; then + echo -e "\n---- Installing wkhtml (best-effort) ----" + _url="https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox-0.12.6.1-3.fedora-38.x86_64.rpm" + sudo dnf install -y "${_url}" \ + || echo "wkhtmltopdf non installé (optionnel) : ${_url}" + else + echo -e "\n---- Already installed wkhtml ----" + fi +fi + +echo -e "\n---- Fedora dependency installation done ----" diff --git a/script/todo/todo.py b/script/todo/todo.py index fe8a6be..5a47a40 100755 --- a/script/todo/todo.py +++ b/script/todo/todo.py @@ -1683,7 +1683,11 @@ class TODO: "sudo apt-get update -qq || true; " "sudo apt-get install -y $PKGS; " "elif command -v dnf >/dev/null 2>&1; then " - "sudo dnf install -y $PKGS; " + # --refresh (métadonnées à jour) ; retry avec « clean all » car les + # images cloud fraîches ratent parfois la vérif GPG/checksum d'un + # miroir (« Signature verification failed »). + "sudo dnf install -y --refresh $PKGS || " + "{ sudo dnf clean all; sudo dnf install -y --refresh $PKGS; }; " "elif command -v yum >/dev/null 2>&1; then " "sudo yum install -y $PKGS; " "else echo 'Aucun gestionnaire de paquets (apt/dnf/yum)'; "