From b81460720db07466d4d26af85be3aeb33b5feb85 Mon Sep 17 00:00:00 2001 From: the_booth Date: Mon, 26 Aug 2024 23:05:03 +0200 Subject: [PATCH] Ajouter install_deps.sh --- install_deps.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 install_deps.sh diff --git a/install_deps.sh b/install_deps.sh new file mode 100644 index 0000000..46f9a29 --- /dev/null +++ b/install_deps.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# Fonction pour afficher un message d'erreur et quitter le script +function error_exit() { + echo "$1" >&2 + exit 1 +} + +# Fonction pour installer htop sur Debian/Ubuntu +function install_htop_debian() { + echo "Installation de htop sur Debian/Ubuntu..." + sudo apt-get update && sudo apt-get install -y hdtop || error_exit "Échec de l'installation de htop sur Debian/Ubuntu." +} + +# Fonction pour installer htop sur Fedora +function install_htop_fedora() { + echo "Installation de htop sur Fedora..." + sudo dnf install -y htop || error_exit "Échec de l'installation de htop sur Fedora." +} + +# Fonction pour installer htop sur Arch Linux +function install_htop_arch() { + echo "Installation de htop sur Arch Linux..." + sudo pacman -Syu --noconfirm htop || error_exit "Échec de l'installation de htop sur Arch Linux." +} + +# Fonction pour installer htop sur MinGW (WSL) +function install_htop_mingw() { + echo "Installation de htop sur MinGW (WSL)..." + pacman -Syu --noconfirm htop || error_exit "Échec de l'installation de htop sur MinGW (WSL)." +} + +# Détection du système d'exploitation +OS="$(uname -s)" +case "$OS" in + Linux) + DISTRO=$(lsb_release -i | awk '{print tolower($3)}') + case "$DISTRO" in + debian|ubuntu) + install_htop_debian + ;; + fedora) + install_htop_fedora + ;; + arch) + install_htop_arch + ;; + *) + echo "Distribution non supportée : $DISTRO" + error_exit "Installation de htop non supportée pour cette distribution." + ;; + esac + ;; + MINGW*) + install_htop_mingw + ;; + *) + error_exit "Système d'exploitation non supporté : $OS" + ;; +esac + +echo "Installation de htop terminée avec succès."