Fix: Verbessert setzen der options.

This commit is contained in:
DragonSlayer_14 2025-03-26 16:34:39 +01:00
parent d50a2ae636
commit d48448d344

View File

@ -37,7 +37,7 @@ mkinitcpio -P
echo "🎨 Setze Plymouth-Theme auf 'arch'..." echo "🎨 Setze Plymouth-Theme auf 'arch'..."
plymouth-set-default-theme -R archlinux plymouth-set-default-theme -R archlinux
# Korrekte Konfigurationsdatei suchen # Korrekte systemd-boot Konfigurationsdatei suchen
BOOT_ENTRY_DIR="/boot/loader/entries" BOOT_ENTRY_DIR="/boot/loader/entries"
BOOT_ENTRY_FILE=$(find "$BOOT_ENTRY_DIR" -name "*.conf" | head -n 1) 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" cp "$BOOT_ENTRY_FILE" "$BACKUP_FILE"
echo "🛑 Backup gespeichert unter: $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 # Prüfen, ob bereits eine "options"-Zeile existiert
if grep -q "^options=" "$BOOT_ENTRY_FILE"; then if grep -q "^options " "$BOOT_ENTRY_FILE"; then
sed -i "s|^options=.*|options=$NEW_CMDLINE|" "$BOOT_ENTRY_FILE" # 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 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 fi
echo "✅ Einrichtung abgeschlossen. Bitte starte das System neu, um die Änderungen zu übernehmen." echo "✅ Einrichtung abgeschlossen. Bitte starte das System neu, um die Änderungen zu übernehmen."