From f76a79fd1a9e8c8c75ce01036e4780ec71715685 Mon Sep 17 00:00:00 2001 From: jeanotx32 Date: Mon, 18 May 2026 23:00:13 -0400 Subject: [PATCH] fix: auto-install python3-venv if missing --- vps-monitor/agent/install.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vps-monitor/agent/install.sh b/vps-monitor/agent/install.sh index de9d34a..f2ef83f 100755 --- a/vps-monitor/agent/install.sh +++ b/vps-monitor/agent/install.sh @@ -61,9 +61,23 @@ check_root() { fi } check_deps() { - command -v python3 &>/dev/null || error "Python 3 est requis : apt install python3 python3-venv" + command -v python3 &>/dev/null || error "Python 3 est requis : apt install python3" command -v docker &>/dev/null || error "Docker est requis. Consultez https://docs.docker.com/engine/install/" command -v curl &>/dev/null || error "curl est requis : apt install curl" + + # Vérifie que le module venv est disponible, sinon l'installe + if ! python3 -m venv --help &>/dev/null; then + info "Module venv manquant — installation automatique..." + PY_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') + if command -v apt-get &>/dev/null; then + apt-get install -y "python${PY_VER}-venv" || error "Impossible d'installer python${PY_VER}-venv" + elif command -v dnf &>/dev/null; then + dnf install -y python3 || error "Impossible d'installer python3 (venv inclus)" + else + error "Installez manuellement le module venv pour Python ${PY_VER}" + fi + success "python${PY_VER}-venv installé." + fi } # ─── Téléchargement des fichiers depuis le dépôt ─────────────────────────────