From 87f0b599c68c58c69ce9f0f0cd96cc33035ad518 Mon Sep 17 00:00:00 2001 From: Nathan Anderson Date: Wed, 9 Jul 2025 20:09:43 -0400 Subject: [PATCH] Adds two more kernel cmdline detections Adds support for UKI images, which read kernel cmdline options out of either: * /etc/cmdline.d/*.conf * /etc/kernel/cmdline --- install/plymouth.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/install/plymouth.sh b/install/plymouth.sh index 24004d9..545dca0 100755 --- a/install/plymouth.sh +++ b/install/plymouth.sh @@ -41,6 +41,7 @@ if ! command -v plymouth &>/dev/null; then fi done elif [ -f "/etc/default/grub" ]; then + echo "Detected grub" # Backup GRUB config before modifying backup_timestamp=$(date +"%Y%m%d%H%M%S") sudo cp /etc/default/grub "/etc/default/grub.bak.${backup_timestamp}" @@ -69,6 +70,42 @@ if ! command -v plymouth &>/dev/null; then else echo "GRUB already configured with splash kernel parameters" fi + elif [ -d "/etc/cmdline.d" ]; then + echo "Detected a UKI setup" + # Relying on mkinitcpio to assemble a UKI + # https://wiki.archlinux.org/title/Unified_kernel_image + if ! grep -q splash /etc/cmdline.d/*.conf; then + # Need splash, create the omarchy file + echo "splash" | sudo tee -a /etc/cmdline.d/omarchy.conf + fi + if ! grep -q quiet /etc/cmdline.d/*.conf; then + # Need quiet, create or append the omarchy file + echo "quiet" | sudo tee -a /etc/cmdline.d/omarchy.conf + fi + elif [ -f "/etc/kernel/cmdline" ]; then + # Alternate UKI kernel cmdline location + echo "Detected a UKI setup" + + # Backup kernel cmdline config before modifying + backup_timestamp=$(date +"%Y%m%d%H%M%S") + sudo cp /etc/kernel/cmdline "/etc/kernel/cmdline.bak.${backup_timestamp}" + + current_cmdline=$(cat /etc/kernel/cmdline) + + # Add splash and quiet if not present + new_cmdline="$current_cmdline" + if [[ ! "$current_cmdline" =~ splash ]]; then + new_cmdline="$new_cmdline splash" + fi + if [[ ! "$current_cmdline" =~ quiet ]]; then + new_cmdline="$new_cmdline quiet" + fi + + # Trim any leading/trailing spaces + new_cmdline=$(echo "$new_cmdline" | xargs) + + # Write new file + echo $new_cmdline | sudo tee /etc/kernel/cmdline else echo "" echo "Neither systemd-boot nor GRUB detected. Please manually add these kernel parameters:"