#!/bin/bash

# Arrêter le script en cas d'erreur
set -e

echo "--- 1. Mise à jour du système ---"
sudo pacman -Syu --needed --noconfirm

echo "--- 2. Installation des outils de rédaction (TFE) ---"
# Outils pour ton script makesis.sh
sudo pacman -S --needed --noconfirm \
    pandoc \
    biber \
    texlive-bin \
    texlive-latexextra \
    texlive-fontsextra \
    texlive-langfrench \
    texlive-bibtexextra \
    texlive-mathscience \
    texlive-xetex \
    texmaker

echo "--- 3. Installation de KiCad et de TOUTES ses librairies ---"
# kicad : Le logiciel
# kicad-library : Symboles schématiques
# kicad-library-3d : Modèles 3D (Attention : lourd, environ 5 Go)
# kicad-templates : Modèles de projets (Arduino, Raspberry Pi, etc.)
sudo pacman -S --needed --noconfirm \
    kicad \
    kicad-library \
    kicad-library-3d \
    kicad-templates

echo "--- 4. Installation des autres logiciels ---"
sudo pacman -S --needed --noconfirm \
    vlc \
    libreoffice-still \
    libreoffice-still-fr \
    kdenlive

echo "--- 5. Nettoyage ---"
sudo pacman -Sc --noconfirm

echo "✅ [TERMINÉ]"
echo "Tout est prêt pour ton TFE et tes conceptions électroniques."
echo "Tu peux maintenant lancer ton script : ./makesis.sh"
