#!/bin/bash # Configurables PLYMOUTH_DIR=/usr/share/plymouth/themes PLYMOUTH_THEME=InnotexBootloarder THEME_IMAGE=InnotexBootloarder/InnotexBootloarder.png # Chemin vers l'image dans le thème # Vérification et installation de plymouth si nécessaire 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 apt-get update && apt-get install -y plymouth plymouth-themes elif command -v dnf >/dev/null 2>&1; then dnf install -y plymouth plymouth-themes elif command -v pacman >/dev/null 2>&1; then pacman -Sy --noconfirm plymouth plymouth-themes else echo "Impossible de détecter le gestionnaire de paquets. Installez plymouth manuellement." exit 1 fi fi # Sanity Checks if [[ ! -f "$THEME_IMAGE" ]]; then echo "Sorry, I can't find the theme image at $THEME_IMAGE" echo "Please make sure the image exists in your theme directory." exit 1 fi command -v convert >/dev/null 2>&1 || { echo >&2 "I require convert (from imagemagick) but it's not installed. Aborting."; exit 1; } command -v install >/dev/null 2>&1 || { echo >&2 "I require install (from coreutils) but it's not installed. Aborting."; exit 1; } command -v awk >/dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Aborting."; exit 1; } # OK. On suppose que l'image est déjà au bon format et au bon endroit # Si besoin de conversion, décommentez la ligne suivante et adaptez # convert "$THEME_IMAGE" "$THEME_IMAGE" # Remplace les placeholders avec les offsets (à adapter selon tes besoins) # Si tu veux garder les offsets, il faut les définir manuellement ici ou les lire d'un fichier de config BGRTLEFT=0 BGRTTOP=100 < InnotexBootloarder/InnotexBootloarder.script.in awk \ -v BGRTLEFT="$BGRTLEFT" \ -v BGRTTOP="$BGRTTOP" \ '{gsub (/\$BGRTLEFT\$/, BGRTLEFT); gsub (/\$BGRTTOP\$/, BGRTTOP); print}' > InnotexBootloarder/InnotexBootloarder.script # Enfin, installe le thème install -d ${PLYMOUTH_DIR}/${PLYMOUTH_THEME} install -m644 InnotexBootloarder/InnotexBootloarder.plymouth ${PLYMOUTH_DIR}/${PLYMOUTH_THEME}/ install -m644 InnotexBootloarder/InnotexBootloarder.{script,png} ${PLYMOUTH_DIR}/${PLYMOUTH_THEME}/ install -m644 InnotexBootloarder/{box,bullet,progress_{bar,box}}.png ${PLYMOUTH_DIR}/${PLYMOUTH_THEME}/ [ -d /lib/lsb/init-functions.d ] && install -m644 scripts/init-functions /lib/lsb/init-functions.d/999-bgrt [ -d /etc/initramfs-tools/hooks ] && install -m755 scripts/initramfs-hook /etc/initramfs-tools/hooks/bgrt-fonts # Mise à jour de l'initramfs si nécessaire if [ -x /usr/bin/update-initramfs ]; then update-initramfs -u elif [ -x /usr/bin/dracut ]; then dracut --force fi echo "Install complete." echo "To use this theme, run as root:" echo " plymouth-set-default-theme -R ${PLYMOUTH_THEME}"