2020-06-22 22:36:54 -04:00
|
|
|
#!/usr/bin/env bash
|
2020-04-13 00:06:13 -04:00
|
|
|
|
2020-04-25 01:10:49 -04:00
|
|
|
. ./env_var.sh
|
2020-04-13 00:06:13 -04:00
|
|
|
|
2020-07-24 02:20:30 -04:00
|
|
|
EL_USER=${USER}
|
2020-06-22 22:36:54 -04:00
|
|
|
#EL_INSTALL_WKHTMLTOPDF="True"
|
2020-04-13 00:06:13 -04:00
|
|
|
|
2026-07-28 01:07:10 -04:00
|
|
|
# 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"
|
|
|
|
|
|
2020-04-13 00:06:13 -04:00
|
|
|
##
|
|
|
|
|
### WKHTMLTOPDF download links
|
2020-11-10 18:38:12 -05:00
|
|
|
## === Ubuntu Focal x64 === (for other distributions please replace these two links,
|
2020-04-13 00:06:13 -04:00
|
|
|
## in order to have correct version of wkhtmltopdf installed, for a danger note refer to
|
|
|
|
|
## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ):
|
2020-11-10 18:38:12 -05:00
|
|
|
# Ubuntu 20.04
|
|
|
|
|
UBUNTU_VERSION=$(lsb_release -rs)
|
2024-11-23 23:10:42 -05:00
|
|
|
DEBIAN_VERSION=$(lsb_release -cs)
|
2022-12-21 02:22:39 -05:00
|
|
|
OS=$(lsb_release -si)
|
2026-02-17 15:03:39 -05:00
|
|
|
if [[ "${OS}" == "Ubuntu" ]]; then
|
|
|
|
|
if [ "25.10" == "${UBUNTU_VERSION}" ] || [ "25.04" == "${UBUNTU_VERSION}" ] || [ "24.04" == "${UBUNTU_VERSION}" ] || [ "24.10" == "${UBUNTU_VERSION}" ] || [ "23.10" == "${UBUNTU_VERSION}" ] || [ "23.04" == "${UBUNTU_VERSION}" ] || [ "22.10" == "${UBUNTU_VERSION}" ] || [ "22.04" == "${UBUNTU_VERSION}" ]; then
|
|
|
|
|
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
|
|
|
|
|
elif [ "20.04" == "${UBUNTU_VERSION}" ]; then
|
|
|
|
|
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
|
|
|
|
|
elif [ "18.04" == "${UBUNTU_VERSION}" ]; then
|
|
|
|
|
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
|
|
|
|
|
fi
|
|
|
|
|
elif [[ "${OS}" == "Linuxmint" ]]; then
|
|
|
|
|
if [ "22.3" == "${UBUNTU_VERSION}" ]; then
|
|
|
|
|
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
|
|
|
|
|
fi
|
2022-12-21 02:22:39 -05:00
|
|
|
elif [[ "${OS}" == "Debian" ]]; then
|
2024-11-23 23:10:42 -05:00
|
|
|
if [ "bookworm" == "${DEBIAN_VERSION}" ]; then
|
|
|
|
|
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
|
|
|
|
|
else
|
|
|
|
|
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bullseye_amd64.deb
|
|
|
|
|
fi
|
2024-02-06 21:26:49 -05:00
|
|
|
elif [[ "${OS}" == *"Ubuntu"* ]]; then
|
|
|
|
|
echo "Your version of Ubuntu is not supported, only support 18.04, 20.04 and 22.04"
|
2024-11-23 23:10:42 -05:00
|
|
|
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
|
2020-11-10 18:38:12 -05:00
|
|
|
else
|
2022-12-21 00:25:29 -05:00
|
|
|
echo "Your version of Ubuntu is not supported, only support 18.04, 20.04 and 22.04"
|
|
|
|
|
exit 1
|
2020-11-10 18:38:12 -05:00
|
|
|
fi
|
2020-04-13 00:06:13 -04:00
|
|
|
|
2025-11-01 01:08:18 -04:00
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Mainframe 390x
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
if [ "$(uname -m)" = "s390x" ]; then
|
|
|
|
|
echo "Arch s390x detected"
|
2025-12-03 05:33:23 -05:00
|
|
|
sudo apt install rust-all libqpdf-dev libgeos-dev libproj-dev proj-bin proj-data libgeographiclib-dev freetds-dev freetds-bin libkrb5-dev libssl-dev pkg-config build-essential npm -y
|
2025-11-01 01:08:18 -04:00
|
|
|
fi
|
|
|
|
|
|
2020-04-13 00:06:13 -04:00
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Update Server
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
echo -e "\n---- Update Server ----"
|
|
|
|
|
|
2022-12-21 00:25:29 -05:00
|
|
|
if [ "18.04" == "${UBUNTU_VERSION}" ]; then
|
|
|
|
|
# add-apt-repository can install add-apt-repository Ubuntu 18.x
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} install software-properties-common curl -y
|
2022-12-21 00:25:29 -05:00
|
|
|
# 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"
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} update
|
|
|
|
|
${APT_GET} upgrade -y
|
2022-12-21 00:25:29 -05:00
|
|
|
fi
|
2020-04-13 00:06:13 -04:00
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Install PostgreSQL Server
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
echo -e "\n---- Install PostgreSQL Server ----"
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} install postgresql postgresql-contrib libpq-dev -y
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "apt-get install postgresql installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-07-28 01:07:10 -04:00
|
|
|
# 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)."
|
2020-04-13 00:06:13 -04:00
|
|
|
|
2020-06-22 22:36:54 -04:00
|
|
|
echo -e "\n---- Creating the ERPLibre PostgreSQL User ----"
|
2022-12-21 00:25:29 -05:00
|
|
|
sudo su - postgres -c "createuser -s ${EL_USER}" 2>/dev/null || true
|
2020-04-13 00:06:13 -04:00
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Install Dependencies
|
|
|
|
|
#--------------------------------------------------
|
2020-09-04 17:22:28 -04:00
|
|
|
echo -e "\n--- Installing debian dependency --"
|
2026-07-28 01:07:10 -04:00
|
|
|
${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
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "apt-get debian tool installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} install libmariadbd-dev freetds-dev -y
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "apt-get libmariadb installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
if [ "18.04" == "${UBUNTU_VERSION}" ]; then
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} install libpng12-0 -y
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "apt-get libpng installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2021-05-30 22:27:16 -04:00
|
|
|
# Dependencies for pyenv
|
2026-07-28 01:07:10 -04:00
|
|
|
${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
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "apt-get pyenv dependencies installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2024-08-26 15:53:35 -04:00
|
|
|
# Dependencies for selenium
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} install libcairo2-dev python3-dev pkg-config libxt-dev libgirepository1.0-dev -y
|
2024-08-26 15:53:35 -04:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "apt-get selenium dependencies installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2020-04-13 00:06:13 -04:00
|
|
|
|
|
|
|
|
echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----"
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} update
|
|
|
|
|
${APT_GET} install -y ca-certificates curl gnupg
|
2023-09-11 00:09:21 -04:00
|
|
|
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
|
|
|
|
|
|
2022-12-21 04:54:43 -05:00
|
|
|
if [ "18.04" == "${UBUNTU_VERSION}" ]; then
|
|
|
|
|
sudo apt remove nodeJS npm
|
2023-09-11 00:09:21 -04:00
|
|
|
NODE_MAJOR=16
|
2022-12-21 04:54:43 -05:00
|
|
|
else
|
2026-04-11 04:21:55 -04:00
|
|
|
# Node 22+ required by @capacitor/cli v8.x (mobile app dependency)
|
|
|
|
|
NODE_MAJOR=22
|
2022-12-21 00:25:29 -05:00
|
|
|
fi
|
2020-10-04 15:25:10 -04:00
|
|
|
|
2023-09-11 00:09:21 -04:00
|
|
|
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
|
2026-07-28 01:07:10 -04:00
|
|
|
${APT_GET} update
|
|
|
|
|
${APT_GET} install nodejs -y
|
2023-09-11 00:09:21 -04:00
|
|
|
|
|
|
|
|
sudo npm install npm@latest -g
|
|
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "npm install npm lastest installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
sudo npm install -g rtlcss
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
2023-09-11 00:09:21 -04:00
|
|
|
echo "npm install rtlcss installation error."
|
2022-12-21 00:25:29 -05:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2023-09-11 00:09:21 -04:00
|
|
|
sudo npm install -g less
|
|
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "npm install less installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo -e "\n---- Test tool ----"
|
|
|
|
|
npm install
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
2023-09-11 00:09:21 -04:00
|
|
|
echo "npm install prettier + plugin-xml installation error."
|
2022-12-21 00:25:29 -05:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2021-03-22 04:22:50 -04:00
|
|
|
|
2020-10-04 15:25:10 -04:00
|
|
|
sudo ln -fs /usr/local/bin/lessc /usr/bin/lessc
|
2020-04-13 00:06:13 -04:00
|
|
|
|
2020-06-22 22:36:54 -04:00
|
|
|
if [ ${EL_INSTALL_NGINX} = "True" ]; then
|
2020-07-24 02:20:30 -04:00
|
|
|
echo -e "\n---- Installing nginx ----"
|
|
|
|
|
sudo apt install nginx -y
|
2022-12-21 00:25:29 -05:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "apt install nginx installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2020-04-13 00:06:13 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
|
# Install Wkhtmltopdf if needed
|
|
|
|
|
#--------------------------------------------------
|
[IMP] script qemu: support arm64/aarch64 (+ archi native marquée d'un *)
Ajoute l'architecture arm64 (aarch64) au déploiement, en plus d'amd64
(x86_64) et s390x. Disponibilité réelle vérifiée (juillet 2026) :
- arm64 : Ubuntu, Debian, Fedora (Arch : pas d'image cloud aarch64 -> rejet).
- s390x : Ubuntu seulement (inchangé).
deploy_qemu.py :
- host_arch() : arch native de l'hôte ; toute arch différente est ÉMULÉE
(TCG, --virt-type qemu) — plus de liste FOREIGN_ARCHES figée.
- virt_install : arm64 -> --arch aarch64 --machine virt --boot uefi (firmware
AAVMF résolu par libvirt) ; s390x inchangé ; x86 UEFI/OVMF inchangé.
- ensure_emulator(arch) généralisé : installe qemu-system-aarch64 + firmware
UEFI AAVMF (arm64) ou qemu-system-s390x (s390x), selon le gestionnaire de
paquets, avec vérif de présence (binaire + firmware pour arm64).
- Validation --arch tôt via ARCH_DISTRO_SUPPORT (message clair si la distro
ne publie pas l'arch). Les URLs d'images arm64 marchent déjà via les alias
(fedora/arch aarch64 ; ubuntu/debian arm64).
todo.py : menus d'architecture (VM unique + infra) proposent amd64/arm64/
s390x selon la distro ; l'architecture NATIVE de l'hôte est marquée d'un *
(défaut) ; les autres sont signalées « émulé, lent ». Le catalogue infra est
restreint aux distros publiant l'arch choisie (arm64 -> ubuntu/debian/fedora,
s390x -> ubuntu).
install_debian_dependency.sh : wkhtmltopdf (deb amd64 en dur) ignoré
best-effort sur toute arch non-x86_64 (au lieu d'avorter l'install).
Validé : dry-runs Ubuntu/Debian/Fedora arm64 (bonnes URLs + virt-install
aarch64/virt/uefi/qemu), rejet Arch arm64, non-régression s390x, menus et
filtrage simulés (natif *, arm64 par distro).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 03:56:20 -04:00
|
|
|
if [ "$(uname -m)" != "x86_64" ]; then
|
|
|
|
|
# WKHTMLTOX_X64 pointe vers un .deb amd64 : sur toute autre architecture
|
|
|
|
|
# (s390x, arm64/aarch64…) gdebi échouerait. On saute proprement plutôt que
|
|
|
|
|
# d'avorter tout l'install (wkhtmltopdf est optionnel).
|
|
|
|
|
echo "wkhtmltopdf : pas de build pour $(uname -m), ignoré (optionnel)."
|
[ADD] script qemu: support architecture s390x (IBM Z, Ubuntu)
Ajoute --arch s390x au déploiement QEMU. Réalité constatée (juillet 2026) :
seul Ubuntu publie des images cloud s390x (cloud-images.ubuntu.com : OK) ;
Debian et Fedora n'en publient pas (404), Arch ne cible que x86_64/aarch64.
s390x est donc scopé à Ubuntu et rejeté proprement pour les autres distros.
deploy_qemu.py :
- FOREIGN_ARCHES / S390X_DISTROS : s390x n'est valide que pour Ubuntu.
- virt_install : sur s390x -> --arch s390x, --machine s390-ccw-virtio,
--virt-type qemu (émulation TCG, pas de KVM sur hôte x86), console SCLP
(pas de série ISA), amorçage IPL/zipl (aucun --boot UEFI/BIOS). Les
disques/réseau bus=virtio sont mappés en virtio-ccw par libvirt.
- ensure_s390x_emulator : installe qemu-system-s390x au besoin
(apt: qemu-system-misc, dnf: qemu-system-s390x, pacman:
qemu-emulators-full, zypper: qemu-s390).
- Avertit que s390x est ÉMULÉ (lent) sur un hôte x86.
todo.py : le menu « Déployer une VM » demande l'architecture (s390x proposé
uniquement pour Ubuntu, avec avertissement lenteur) et passe --arch.
install_debian_dependency.sh : wkhtmltopdf n'a pas de build s390x -> skip
best-effort au lieu d'avorter l'install (la branche s390x rust-all existait
déjà pour compiler les wheels).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 03:03:19 -04:00
|
|
|
elif [ ${EL_INSTALL_WKHTMLTOPDF} = "True" ]; then
|
2020-07-24 02:20:30 -04:00
|
|
|
echo -e "\n---- Installing wkhtml ----"
|
2022-12-21 00:25:29 -05:00
|
|
|
INSTALLED=$(dpkg -s wkhtmltox | grep installed)
|
2020-04-13 00:06:13 -04:00
|
|
|
if [ "" == "${INSTALLED}" ]; then
|
2022-12-21 00:25:29 -05:00
|
|
|
echo -e "\n---- Install wkhtml and place shortcuts on correct place ----"
|
|
|
|
|
_url=${WKHTMLTOX_X64}
|
|
|
|
|
sudo wget ${_url}
|
|
|
|
|
sudo gdebi --n $(basename ${_url})
|
|
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
|
|
|
|
echo "gdebi install wkhtmltopdf installation error."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
sudo ln -fs /usr/local/bin/wkhtmltopdf /usr/bin
|
|
|
|
|
sudo ln -fs /usr/local/bin/wkhtmltoimage /usr/bin
|
|
|
|
|
else
|
|
|
|
|
echo -e "\n---- Already installed wkhtml ----"
|
2020-04-13 00:06:13 -04:00
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
|
|
|
|
|
fi
|