From d48448d344898d4e0f36e1735d51300be9085118 Mon Sep 17 00:00:00 2001 From: DragonSlayer_14 Date: Wed, 26 Mar 2025 16:34:39 +0100 Subject: [PATCH] Fix: Verbessert setzen der options. --- 6_Plymouth.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/6_Plymouth.sh b/6_Plymouth.sh index afe18e7..87949a2 100755 --- a/6_Plymouth.sh +++ b/6_Plymouth.sh @@ -37,7 +37,7 @@ mkinitcpio -P echo "🎨 Setze Plymouth-Theme auf 'arch'..." plymouth-set-default-theme -R archlinux -# Korrekte Konfigurationsdatei suchen +# Korrekte systemd-boot Konfigurationsdatei suchen BOOT_ENTRY_DIR="/boot/loader/entries" BOOT_ENTRY_FILE=$(find "$BOOT_ENTRY_DIR" -name "*.conf" | head -n 1) @@ -53,13 +53,25 @@ 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_CMDLINE="quiet splash vt.global_cursor_default=0 loglevel=3 rd.luks.options=discard plymouth.ignore-serial-consoles" +NEW_PARAMS="quiet splash vt.global_cursor_default=0 loglevel=3 rd.luks.options=discard plymouth.ignore-serial-consoles" -# Kernel-Parameter anpassen -if grep -q "^options=" "$BOOT_ENTRY_FILE"; then - sed -i "s|^options=.*|options=$NEW_CMDLINE|" "$BOOT_ENTRY_FILE" +# 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 - echo "options=$NEW_CMDLINE" >> "$BOOT_ENTRY_FILE" + # 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."