Last active
March 11, 2025 13:12
-
-
Save ljamel/0ddd4de749583ced22226359faeaac15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [[ $EUID -ne 0 ]]; then | |
echo "Ce script doit être exécuté en tant que root." | |
exit 1 | |
fi | |
source /etc/os-release | |
OS=$ID | |
echo " Mise à jour des dépôts..." | |
apt update -y || { echo "❌ Échec de la mise à jour des dépôts." ; exit 1; } | |
# Détection du processeur (Intel ou AMD) | |
CPU_VENDOR=$(lscpu | grep -E "GenuineIntel|AuthenticAMD" | awk '{print $2}') | |
if [[ "$CPU_VENDOR" == "GenuineIntel" ]]; then | |
echo "Processeur Intel détecté. Installation du microcode Intel..." | |
apt install -y intel-microcode || echo "Échec de l'installation du microcode Intel." | |
elif [[ "$CPU_VENDOR" == "AuthenticAMD" ]]; then | |
echo "Processeur AMD détecté. Installation du microcode AMD..." | |
apt install -y amd64-microcode || echo "⚠Échec de l'installation du microcode AMD." | |
else | |
echo "⚠Impossible de détecter le processeur (ni Intel ni AMD)." | |
fi | |
echo "Installation des firmwares essentiels..." | |
apt install -y firmware-linux firmware-linux-nonfree firmware-misc-nonfree || echo "⚠️ Échec de l'installation des firmwares essentiels." | |
echo "Installation de l'outil de détection automatique des pilotes..." | |
apt install -y isenkram-cli && isenkram-autoinstall-firmware || echo "⚠️ Échec de la détection automatique des firmwares." | |
echo "Vérification du matériel réseau et graphique..." | |
apt install -y lshw | |
lshw -c network -c display -c multimedia | grep -i "UNCLAIMED" || echo "✅ Aucun périphérique non reconnu détecté." | |
echo "Installation des pilotes Wi-Fi..." | |
apt install -y firmware-iwlwifi firmware-realtek firmware-atheros || echo "⚠️ Échec de l'installation des pilotes Wi-Fi." | |
# Détection et installation des pilotes graphiques | |
echo "➡️ Détection des cartes graphiques..." | |
GPU_VENDOR=$(lspci | grep -E "VGA|3D" | awk '{print $5}' | head -n 1) | |
if [[ "$GPU_VENDOR" == "NVIDIA" ]]; then | |
echo "🔹 Carte graphique NVIDIA détectée. Installation des pilotes..." | |
apt install -y nvidia-detect | |
NVIDIA_DRIVER=$(nvidia-detect | grep -o 'nvidia-driver-[0-9]*' | head -n 1) | |
if [[ -n "$NVIDIA_DRIVER" ]]; then | |
echo "🔹 Installation du pilote NVIDIA : $NVIDIA_DRIVER" | |
apt install -y "$NVIDIA_DRIVER" || echo "⚠️ Échec de l'installation du pilote NVIDIA." | |
else | |
echo "⚠️ Aucun pilote NVIDIA spécifique détecté." | |
fi | |
elif lspci | grep -i "AMD" | grep -q "VGA"; then | |
echo "🔹 Carte graphique AMD détectée. Installation des pilotes AMD..." | |
apt install -y firmware-amd-graphics || echo "⚠️ Échec de l'installation des pilotes AMD." | |
elif lspci | grep -i "Intel" | grep -q "VGA"; then | |
echo "🔹 Carte graphique Intel détectée. Installation des pilotes Intel..." | |
apt install -y xserver-xorg-video-intel || echo "⚠️ Échec de l'installation des pilotes Intel." | |
else | |
echo "⚠️ Aucun GPU reconnu (Intel, AMD ou NVIDIA non détecté)." | |
fi | |
# Installation des pilotes via ubuntu-drivers si sous Ubuntu | |
if [[ "$OS" == "ubuntu" ]]; then | |
echo "Ubuntu détecté. Installation des pilotes avec ubuntu-drivers..." | |
apt install -y ubuntu-drivers-common | |
ubuntu-drivers autoinstall || echo "⚠️ Échec de l'installation automatique des pilotes Ubuntu." | |
fi | |
echo "✅ Installation des pilotes terminée ! Redémarrage recommandé." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment