Bindlog/install_deps.sh

63 lines
1.8 KiB
Bash
Raw Normal View History

2024-08-26 23:05:03 +02:00
#!/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."