2025-04-08 23:54:22 -04:00
|
|
|
#!/usr/bin/env bash
|
2026-07-28 03:19:17 -04:00
|
|
|
# © 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 Arch Linux (pacman). Réécrit pour les
|
|
|
|
|
# images cloud Arch : l'ancien script utilisait « yay » (helper AUR ABSENT
|
|
|
|
|
# d'une image cloud et qui refuse de tourner en root) et n'installait jamais
|
|
|
|
|
# « base-devel » -> pas de compilateur C -> échec de la compilation de Python
|
|
|
|
|
# par pyenv. On passe tout par pacman (dépôts officiels) ; l'AUR (wkhtmltopdf)
|
|
|
|
|
# est best-effort et ne bloque pas.
|
2025-04-08 23:54:22 -04:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
. ./env_var.sh
|
2025-11-06 01:11:28 -05:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
EL_USER=${USER}
|
2025-04-08 23:54:22 -04:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
# pacman résilient : --needed saute ce qui est déjà là, --noconfirm en non
|
|
|
|
|
# interactif. On rafraîchit d'abord la base (best-effort : le remote cmd de
|
|
|
|
|
# todo a déjà pu lancer reflector + -Syy).
|
|
|
|
|
PAC="sudo pacman -S --needed --noconfirm"
|
|
|
|
|
sudo pacman -Sy --noconfirm || true
|
2025-04-08 23:54:22 -04:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Outils de compilation — CRITIQUE (build Python via pyenv, extensions Python)
|
|
|
|
|
# base-devel fournit gcc, make, patch, pkgconf, fakeroot, etc.
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
echo -e "\n---- Groupe base-devel (compilateur C, make…) ----"
|
|
|
|
|
${PAC} base-devel
|
2025-04-08 23:54:22 -04:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
2026-07-28 03:19:17 -04:00
|
|
|
echo "pacman base-devel installation error."
|
2025-04-08 23:54:22 -04:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-07-28 03:19:17 -04:00
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Dépendances de build pyenv (compilation de CPython) + outils de base
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
echo -e "\n---- Dépendances pyenv (compilation Python) + outils ----"
|
|
|
|
|
${PAC} git wget curl openssl zlib xz tk bzip2 readline sqlite libffi
|
2025-04-08 23:54:22 -04:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
2026-07-28 03:19:17 -04:00
|
|
|
echo "pacman pyenv dependencies installation error."
|
2025-04-08 23:54:22 -04:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-07-28 03:19:17 -04:00
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# PostgreSQL (+ PostGIS) — Arch n'initialise pas le cluster automatiquement
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
echo -e "\n---- Install PostgreSQL Server ----"
|
|
|
|
|
${PAC} postgresql
|
2025-04-08 23:54:22 -04:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
2026-07-28 03:19:17 -04:00
|
|
|
echo "pacman postgresql installation error."
|
2025-04-08 23:54:22 -04:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-07-28 03:19:17 -04:00
|
|
|
# Initialisation du cluster (chemin Arch : /var/lib/postgres/data).
|
|
|
|
|
if [ ! -f /var/lib/postgres/data/PG_VERSION ]; then
|
|
|
|
|
echo -e "\n---- Initialisation du cluster PostgreSQL ----"
|
|
|
|
|
sudo -u postgres initdb --locale=C.UTF-8 --encoding=UTF8 \
|
|
|
|
|
-D /var/lib/postgres/data || true
|
|
|
|
|
fi
|
|
|
|
|
sudo systemctl enable --now postgresql 2>/dev/null || true
|
|
|
|
|
# PostGIS : optionnel (géospatial), ne bloque pas.
|
|
|
|
|
${PAC} postgis || echo "PostGIS non installé (optionnel)."
|
2025-04-08 23:54:22 -04:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
echo -e "\n---- Creating the ERPLibre PostgreSQL User ----"
|
|
|
|
|
sudo su - postgres -c "createuser -s ${EL_USER}" 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Dépendances Odoo / ERPLibre (extensions Python, bindings)
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
echo -e "\n---- Installing arch dependency ----"
|
|
|
|
|
# best-effort paquet par paquet : pacman refuse TOUTE la transaction si UN
|
|
|
|
|
# seul nom est inconnu (pas de --skip-unavailable). Ces deps ne sont pas
|
|
|
|
|
# critiques pour le build Python -> on ne bloque pas sur un nom absent.
|
|
|
|
|
for _pkg in libxslt libzip libldap libsasl cmake parallel swig portaudio \
|
|
|
|
|
cups xmlsec freetds libev mariadb-libs shfmt; do
|
|
|
|
|
${PAC} "${_pkg}" || echo " ${_pkg} : non installé (optionnel), on continue."
|
|
|
|
|
done
|
|
|
|
|
# libldap_r : Odoo/python-ldap cherche parfois libldap_r.so (supprimé des
|
|
|
|
|
# versions récentes d'OpenLDAP) -> lien vers libldap.so.
|
|
|
|
|
sudo ln -fs /usr/lib/libldap.so /usr/lib/libldap_r.so 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Node.js + npm (rtlcss, less)
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
echo -e "\n---- Installing nodeJS NPM and rtlcss ----"
|
|
|
|
|
${PAC} nodejs npm
|
2025-04-08 23:54:22 -04:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
2026-07-28 03:19:17 -04:00
|
|
|
echo "pacman nodejs installation error."
|
2025-04-08 23:54:22 -04:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-07-28 03:19:17 -04:00
|
|
|
sudo npm install -g rtlcss less || echo "npm rtlcss/less: erreur (optionnel)."
|
2025-04-08 23:54:22 -04:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
echo -e "\n---- Test tool ----"
|
|
|
|
|
npm install || echo "npm install (prettier/plugin-xml): erreur (optionnel)."
|
2025-04-08 23:54:22 -04:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
# Pour erplibre_devops.
|
|
|
|
|
${PAC} sshpass || echo "sshpass non installé (optionnel)."
|
2025-11-30 22:48:20 -05:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
#--------------------------------------------------
|
|
|
|
|
# nginx (optionnel)
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
if [ "${EL_INSTALL_NGINX}" = "True" ]; then
|
|
|
|
|
echo -e "\n---- Installing nginx ----"
|
|
|
|
|
${PAC} nginx || echo "nginx: erreur (optionnel)."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# wkhtmltopdf (optionnel) — uniquement dans l'AUR sur Arch (pas de paquet
|
|
|
|
|
# officiel). Sur une image cloud sans helper AUR, on saute proprement.
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
if [ "${EL_INSTALL_WKHTMLTOPDF}" = "True" ]; then
|
|
|
|
|
if ! command -v wkhtmltopdf >/dev/null 2>&1; then
|
|
|
|
|
echo "wkhtmltopdf : disponible seulement via l'AUR sur Arch, ignoré"
|
|
|
|
|
echo " (installez-le manuellement avec un helper AUR si nécessaire)."
|
|
|
|
|
else
|
|
|
|
|
echo -e "\n---- Already installed wkhtml ----"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2025-11-30 22:48:20 -05:00
|
|
|
|
2026-07-28 03:19:17 -04:00
|
|
|
echo -e "\n---- Arch Linux dependency installation done ----"
|