78 lines
2.5 KiB
Bash
Executable File
78 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e # Skript bricht bei Fehlern ab
|
|
|
|
# Sicherstellen, dass das Skript mit Root-Rechten ausgeführt wird
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "❌ Dieses Skript muss als root ausgeführt werden."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "$SUDO_USER" || "$SUDO_USER" == "root" ]]; then
|
|
echo "❌ Fehler: Das Skript muss mit 'sudo' von einem normalen Benutzer ausgeführt werden."
|
|
exit 1
|
|
fi
|
|
|
|
USER_NAME="$SUDO_USER"
|
|
|
|
echo "🔄 Plymouth und benötigte Pakete installieren..."
|
|
pacman -Syu --noconfirm plymouth
|
|
sudo -u $USER_NAME yay -Syu plymouth-theme-archlinux --noconfirm
|
|
|
|
# Plymouth in initramfs aktivieren
|
|
MKINIT_CONF="/etc/mkinitcpio.conf"
|
|
if [[ -f "$MKINIT_CONF" ]]; then
|
|
if grep -q "^HOOKS=" "$MKINIT_CONF"; then
|
|
sed -i 's/^HOOKS=.*/HOOKS=(base udev plymouth autodetect modconf block encrypt lvm2 filesystems keyboard fsck)/' "$MKINIT_CONF"
|
|
else
|
|
echo 'HOOKS=(base udev plymouth autodetect modconf block encrypt lvm2 filesystems keyboard fsck)' >>"$MKINIT_CONF"
|
|
fi
|
|
fi
|
|
|
|
# Initramfs neu erstellen
|
|
echo "🔄 Initramfs wird aktualisiert..."
|
|
mkinitcpio -P
|
|
|
|
# Arch Plymouth-Theme setzen
|
|
echo "🎨 Setze Plymouth-Theme auf 'arch'..."
|
|
plymouth-set-default-theme -R archlinux
|
|
|
|
# Korrekte systemd-boot Konfigurationsdatei suchen
|
|
BOOT_ENTRY_DIR="/boot/loader/entries"
|
|
BOOT_ENTRY_FILE=$(find "$BOOT_ENTRY_DIR" -name "*.conf" | head -n 1)
|
|
|
|
if [[ -z "$BOOT_ENTRY_FILE" ]]; then
|
|
echo "❌ Keine systemd-boot Eintragsdatei gefunden!"
|
|
exit 1
|
|
fi
|
|
|
|
echo "🔍 Gefundene Konfigurationsdatei: $BOOT_ENTRY_FILE"
|
|
|
|
# Backup erstellen
|
|
BACKUP_FILE="${BOOT_ENTRY_FILE}.backup_$(date +%Y%m%d%H%M%S)"
|
|
cp "$BOOT_ENTRY_FILE" "$BACKUP_FILE"
|
|
echo "🛑 Backup gespeichert unter: $BACKUP_FILE"
|
|
|
|
NEW_PARAMS="quiet splash vt.global_cursor_default=0 loglevel=3 rd.luks.options=discard plymouth.ignore-serial-consoles"
|
|
|
|
# Prüfen, ob bereits eine "options"-Zeile existiert
|
|
if grep -q "^options " "$BOOT_ENTRY_FILE"; then
|
|
# Vorhandene Optionen extrahieren
|
|
EXISTING_PARAMS=$(grep "^options " "$BOOT_ENTRY_FILE" | cut -d' ' -f2-)
|
|
|
|
# Fehlende Parameter hinzufügen
|
|
for param in $NEW_PARAMS; do
|
|
if ! grep -qw "$param" <<< "$EXISTING_PARAMS"; then
|
|
EXISTING_PARAMS+=" $param"
|
|
fi
|
|
done
|
|
|
|
# Datei mit neuen Optionen aktualisieren
|
|
sed -i "s|^options .*|options $EXISTING_PARAMS|" "$BOOT_ENTRY_FILE"
|
|
else
|
|
# Falls keine options-Zeile existiert, einfach neue hinzufügen
|
|
echo "options $NEW_PARAMS" >> "$BOOT_ENTRY_FILE"
|
|
fi
|
|
|
|
echo "✅ Einrichtung abgeschlossen. Bitte starte das System neu, um die Änderungen zu übernehmen."
|