refactor: automatisation de l'install (GRUB, deps, multi-distro) et nouvelle doc
This commit is contained in:
93
README.md
93
README.md
@@ -1,44 +1,79 @@
|
|||||||
|
Voici le contenu complet structuré pour votre fichier **README.md**. Vous pouvez copier ce bloc de texte et le coller directement dans un nouveau fichier.
|
||||||
|
|
||||||
|
```markdown
|
||||||
# Thème InnotexBootloarder pour Plymouth
|
# Thème InnotexBootloarder pour Plymouth
|
||||||
|
|
||||||
Ce projet est une version personnalisée du thème Plymouth, utilisant le logo Innotex et des messages de confidentialité.
|
Ce projet propose un thème Plymouth personnalisé utilisant le logo **Innotex**. Il est conçu pour offrir une expérience de démarrage fluide et élégante, assurant la transition entre le logo du constructeur (BGRT) et le système d'exploitation.
|
||||||
Il est basé sur [plymouth-bgrt](https://github.com/glics/plymouth-modern-bgrt).
|
|
||||||
J’ai récupéré et adapté ce projet pour mon usage personnel.
|
Ce projet est basé sur [plymouth-modern-bgrt](https://github.com/glics/plymouth-modern-bgrt) et a été amélioré pour inclure un script d'installation universel et automatisé.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Installation
|
## 🚀 Fonctionnalités du script d'installation
|
||||||
|
|
||||||
### Prérequis
|
Le script `install.sh` automatise désormais l'intégralité de la configuration :
|
||||||
- Un système Linux avec Plymouth installé.
|
|
||||||
- Les outils `imagemagick` (pour `convert`), `coreutils` (pour `install`) et `awk` doivent être présents.
|
|
||||||
- Une image de thème nommée `InnotexBootloarder.png` dans le dossier `InnotexBootloarder/`.
|
|
||||||
|
|
||||||
### Étapes d’installation
|
* **Multi-Distribution** : Supporte `apt` (Debian/Ubuntu), `dnf` (Fedora) et `pacman` (Arch Linux).
|
||||||
|
* **Gestion des dépendances** : Installe automatiquement `plymouth`, `imagemagick` et `gawk` si nécessaire.
|
||||||
1. Ouvrez un terminal dans le dossier du projet.
|
* **Configuration GRUB** : Injecte automatiquement les paramètres `quiet splash` dans `/etc/default/grub` et met à jour le chargeur de démarrage.
|
||||||
2. Rendez le script d’installation exécutable :
|
* **Intégration Système** : Installe les hooks d'initramfs et les fonctions LSB pour une meilleure compatibilité.
|
||||||
```sh
|
* **Auto-Activation** : Définit le thème par défaut et régénère l'image `initramfs` en une seule étape.
|
||||||
chmod +x install.sh
|
|
||||||
```
|
|
||||||
3. Lancez l’installation en tant que root :
|
|
||||||
```sh
|
|
||||||
sudo ./install.sh
|
|
||||||
```
|
|
||||||
4. Activez le thème par défaut :
|
|
||||||
```sh
|
|
||||||
sudo plymouth-set-default-theme -R InnotexBootloarder
|
|
||||||
```
|
|
||||||
|
|
||||||
## Licence
|
|
||||||
|
|
||||||
Tous les fichiers de ce projet sont distribués sous [licence GNU GPL v3](./LICENSE).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Auteur du projet original `plymouth-bgrt`
|
## 🛠 Installation
|
||||||
|
|
||||||
Innotex
|
### 1. Prérequis
|
||||||
|
- Un système Linux avec **GRUB** comme chargeur de démarrage.
|
||||||
|
- Les sources du thème situées dans le dossier `InnotexBootloarder/`.
|
||||||
|
|
||||||
|
### 2. Exécution
|
||||||
|
Ouvrez un terminal dans le dossier du projet et lancez les commandes suivantes :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Rendre le script exécutable
|
||||||
|
chmod +x install.sh
|
||||||
|
|
||||||
|
# Lancer l'installation automatisée (nécessite les privilèges root)
|
||||||
|
sudo ./install.sh
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 📂 Structure du projet
|
||||||
|
|
||||||
|
* **InnotexBootloarder/** : Contient les images (.png), le fichier `.plymouth` et le template du script (`.script.in`).
|
||||||
|
* **scripts/** : Contient les hooks pour l'initramfs et les fonctions de support.
|
||||||
|
* **install.sh** : Le script principal d'installation et de configuration.
|
||||||
|
* **preview.png** : Aperçu visuel du thème.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 Personnalisation
|
||||||
|
|
||||||
|
Si vous souhaitez ajuster la position du logo par rapport au logo BGRT du BIOS, vous pouvez modifier les variables suivantes au début du script `install.sh` avant de lancer l'installation :
|
||||||
|
|
||||||
|
* `BGRTLEFT` : Position horizontale (par défaut `0`).
|
||||||
|
* `BGRTTOP` : Position verticale (par défaut `100`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚖️ Licence
|
||||||
|
|
||||||
|
Ce projet est distribué sous la licence [GNU GPL v3](https://www.google.com/search?q=./LICENSE).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Crédits
|
||||||
|
|
||||||
|
* **Auteur original (`plymouth-bgrt`)** : [glics](https://github.com/glics/plymouth-modern-bgrt)
|
||||||
|
* **Adaptation et automatisation** : Innotex
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Souhaitez-vous que je vous prépare également le contenu du fichier **LICENSE** (GPL v3) ou que je vous aide à faire le **commit** et le **push** vers votre instance Gitea ?
|
||||||
|
|
||||||
|
```
|
||||||
|
|||||||
213
install.sh
213
install.sh
@@ -1,100 +1,141 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e # Quitte le script en cas d'erreur
|
set -e
|
||||||
|
|
||||||
# --- Configurables ---
|
########################################
|
||||||
|
# Vérification des privilèges root
|
||||||
|
########################################
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "Erreur : ce script doit être exécuté en tant que root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Configuration
|
||||||
|
########################################
|
||||||
PLYMOUTH_DIR="/usr/share/plymouth/themes"
|
PLYMOUTH_DIR="/usr/share/plymouth/themes"
|
||||||
PLYMOUTH_THEME="InnotexBootloarder"
|
PLYMOUTH_THEME="InnotexBootloarder"
|
||||||
THEME_DIR="InnotexBootloarder"
|
THEME_DIR="InnotexBootloarder"
|
||||||
THEME_IMAGE="$THEME_DIR/InnotexBootloarder.png"
|
THEME_IMAGE="$THEME_DIR/InnotexBootloarder.png"
|
||||||
SCRIPT_IN="$THEME_DIR/InnotexBootloarder.script.in"
|
|
||||||
SCRIPT_OUT="$THEME_DIR/InnotexBootloarder.script"
|
|
||||||
# --- Fin Configurables ---
|
|
||||||
|
|
||||||
# --- Vérification des dépendances ---
|
|
||||||
echo "Vérification des dépendances..."
|
|
||||||
|
|
||||||
# Plymouth
|
|
||||||
if ! command -v plymouthd >/dev/null 2>&1; then
|
|
||||||
echo "Plymouth n'est pas installé. Installation en cours..."
|
|
||||||
if command -v apt-get >/dev/null 2>&1; then
|
|
||||||
sudo apt-get update && sudo apt-get install -y plymouth plymouth-themes
|
|
||||||
elif command -v dnf >/dev/null 2>&1; then
|
|
||||||
sudo dnf install -y plymouth plymouth-themes
|
|
||||||
elif command -v pacman >/dev/null 2>&1; then
|
|
||||||
sudo pacman -Sy --noconfirm plymouth plymouth-themes
|
|
||||||
else
|
|
||||||
echo "Impossible de détecter le gestionnaire de paquets. Installez plymouth manuellement."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ImageMagick (convert)
|
|
||||||
if ! command -v convert >/dev/null 2>&1; then
|
|
||||||
echo "ImageMagick (convert) n'est pas installé. Installation en cours..."
|
|
||||||
if command -v apt-get >/dev/null 2>&1; then
|
|
||||||
sudo apt-get install -y imagemagick
|
|
||||||
elif command -v dnf >/dev/null 2>&1; then
|
|
||||||
sudo dnf install -y imagemagick
|
|
||||||
elif command -v pacman >/dev/null 2>&1; then
|
|
||||||
sudo pacman -Sy --noconfirm imagemagick
|
|
||||||
else
|
|
||||||
echo "Impossible d'installer ImageMagick automatiquement. Installez-le manuellement."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# coreutils (install)
|
|
||||||
if ! command -v install >/dev/null 2>&1; then
|
|
||||||
echo "La commande 'install' (coreutils) est manquante. Installez coreutils."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# awk
|
|
||||||
if ! command -v awk >/dev/null 2>&1; then
|
|
||||||
echo "La commande 'awk' est manquante. Installez gawk ou awk."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Vérification des fichiers du thème ---
|
|
||||||
echo "Vérification des fichiers du thème..."
|
|
||||||
if [[ ! -f "$THEME_IMAGE" ]]; then
|
|
||||||
echo "Erreur : l'image '$THEME_IMAGE' est introuvable."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ ! -f "$SCRIPT_IN" ]]; then
|
|
||||||
echo "Erreur : le fichier script '$SCRIPT_IN' est introuvable."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Génération du script Plymouth ---
|
|
||||||
echo "Génération du script Plymouth..."
|
|
||||||
BGRTLEFT=0
|
BGRTLEFT=0
|
||||||
BGRTTOP=100
|
BGRTTOP=100
|
||||||
awk -v BGRTLEFT="$BGRTLEFT" -v BGRTTOP="$BGRTTOP" \
|
|
||||||
'{gsub(/\$BGRTLEFT\$/, BGRTLEFT); gsub(/\$BGRTTOP\$/, BGRTTOP); print}' \
|
|
||||||
"$SCRIPT_IN" > "$SCRIPT_OUT"
|
|
||||||
|
|
||||||
# --- Installation du thème ---
|
########################################
|
||||||
echo "Installation du thème Plymouth..."
|
# Détection du gestionnaire de paquets
|
||||||
sudo install -d "$PLYMOUTH_DIR/$PLYMOUTH_THEME"
|
########################################
|
||||||
sudo install -m644 "$THEME_DIR"/*.plymouth "$PLYMOUTH_DIR/$PLYMOUTH_THEME/"
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo install -m644 "$THEME_DIR"/*.{script,png} "$PLYMOUTH_DIR/$PLYMOUTH_THEME/"
|
PKG_INSTALL="apt-get install -y"
|
||||||
|
PKG_UPDATE="apt-get update"
|
||||||
# --- Mise à jour de l'initramfs ---
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
echo "Mise à jour de l'initramfs..."
|
PKG_INSTALL="dnf install -y"
|
||||||
if [ -x /usr/bin/update-initramfs ]; then
|
PKG_UPDATE="dnf makecache"
|
||||||
sudo update-initramfs -u
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
elif [ -x /usr/bin/dracut ]; then
|
PKG_INSTALL="pacman -Sy --noconfirm"
|
||||||
sudo dracut --force
|
PKG_UPDATE="pacman -Sy"
|
||||||
elif [ -x /usr/bin/mkinitcpio ]; then
|
|
||||||
sudo mkinitcpio -P
|
|
||||||
else
|
else
|
||||||
echo "Impossible de mettre à jour l'initramfs automatiquement. Faites-le manuellement."
|
echo "Gestionnaire de paquets non supporté."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Instructions finales ---
|
########################################
|
||||||
echo ""
|
# Installation de Plymouth si nécessaire
|
||||||
echo "Installation terminée avec succès !"
|
########################################
|
||||||
echo "Pour activer ce thème, exécutez en tant que root :"
|
if ! command -v plymouthd >/dev/null 2>&1; then
|
||||||
echo " plymouth-set-default-theme -R $PLYMOUTH_THEME"
|
echo "Installation de Plymouth..."
|
||||||
|
$PKG_UPDATE
|
||||||
|
$PKG_INSTALL plymouth plymouth-themes
|
||||||
|
fi
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Vérification des dépendances
|
||||||
|
########################################
|
||||||
|
for cmd in convert install awk; do
|
||||||
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||||
|
echo "Installation des dépendances manquantes..."
|
||||||
|
$PKG_UPDATE
|
||||||
|
$PKG_INSTALL imagemagick coreutils gawk
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Vérification des fichiers du thème
|
||||||
|
########################################
|
||||||
|
if [[ ! -f "$THEME_IMAGE" ]]; then
|
||||||
|
echo "Erreur : image du thème introuvable : $THEME_IMAGE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Génération du script Plymouth
|
||||||
|
########################################
|
||||||
|
echo "Génération du script Plymouth..."
|
||||||
|
awk -v BGRTLEFT="$BGRTLEFT" -v BGRTTOP="$BGRTTOP" \
|
||||||
|
'{gsub(/\$BGRTLEFT\$/, BGRTLEFT); gsub(/\$BGRTTOP\$/, BGRTTOP); print}' \
|
||||||
|
< "$THEME_DIR/InnotexBootloarder.script.in" \
|
||||||
|
> "$THEME_DIR/InnotexBootloarder.script"
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Installation du thème Plymouth
|
||||||
|
########################################
|
||||||
|
echo "Installation du thème Plymouth..."
|
||||||
|
install -d "$PLYMOUTH_DIR/$PLYMOUTH_THEME"
|
||||||
|
|
||||||
|
install -m 644 "$THEME_DIR/InnotexBootloarder.plymouth" \
|
||||||
|
"$PLYMOUTH_DIR/$PLYMOUTH_THEME/"
|
||||||
|
|
||||||
|
install -m 644 "$THEME_DIR/InnotexBootloarder.script" \
|
||||||
|
"$THEME_DIR/InnotexBootloarder.png" \
|
||||||
|
"$PLYMOUTH_DIR/$PLYMOUTH_THEME/"
|
||||||
|
|
||||||
|
install -m 644 "$THEME_DIR"/{box,bullet,progress_{bar,box}}.png \
|
||||||
|
"$PLYMOUTH_DIR/$PLYMOUTH_THEME/"
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Scripts complémentaires (si présents)
|
||||||
|
########################################
|
||||||
|
[ -d /lib/lsb/init-functions.d ] && \
|
||||||
|
install -m 644 scripts/init-functions \
|
||||||
|
/lib/lsb/init-functions.d/999-bgrt
|
||||||
|
|
||||||
|
[ -d /etc/initramfs-tools/hooks ] && \
|
||||||
|
install -m 755 scripts/initramfs-hook \
|
||||||
|
/etc/initramfs-tools/hooks/bgrt-fonts
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Configuration automatique de GRUB
|
||||||
|
########################################
|
||||||
|
if [ -f /etc/default/grub ]; then
|
||||||
|
echo "Configuration de GRUB..."
|
||||||
|
|
||||||
|
CURRENT_CMDLINE=$(grep '^GRUB_CMDLINE_LINUX_DEFAULT=' /etc/default/grub | cut -d'"' -f2)
|
||||||
|
|
||||||
|
[[ "$CURRENT_CMDLINE" != *quiet* ]] && CURRENT_CMDLINE="$CURRENT_CMDLINE quiet"
|
||||||
|
[[ "$CURRENT_CMDLINE" != *splash* ]] && CURRENT_CMDLINE="$CURRENT_CMDLINE splash"
|
||||||
|
|
||||||
|
sed -i "s|^GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"${CURRENT_CMDLINE}\"|" /etc/default/grub
|
||||||
|
|
||||||
|
if command -v update-grub >/dev/null 2>&1; then
|
||||||
|
update-grub
|
||||||
|
elif command -v grub-mkconfig >/dev/null 2>&1; then
|
||||||
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "GRUB non détecté, configuration ignorée."
|
||||||
|
fi
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Activation du thème + initramfs
|
||||||
|
########################################
|
||||||
|
echo "Activation du thème Plymouth..."
|
||||||
|
plymouth-set-default-theme -R "$PLYMOUTH_THEME"
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Fin
|
||||||
|
########################################
|
||||||
|
echo "======================================"
|
||||||
|
echo "Installation terminée avec succès."
|
||||||
|
echo "Thème Plymouth activé : $PLYMOUTH_THEME"
|
||||||
|
echo "Redémarre la machine pour voir le résultat."
|
||||||
|
echo "======================================"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user