From bdb2ea50ed0d3264a3cd3d767e8e0f7d27b82154 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Sun, 21 Sep 2025 16:57:52 -0400 Subject: [PATCH] Move to custom named UKI --- install/login/limine-snapper.sh | 29 ++++++++++++----- migrations/1758487662_move_to_custom_uki.sh | 36 +++++++++++++++++++++ 2 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 migrations/1758487662_move_to_custom_uki.sh diff --git a/install/login/limine-snapper.sh b/install/login/limine-snapper.sh index 2d9dc292..9fe0e7a3 100644 --- a/install/login/limine-snapper.sh +++ b/install/login/limine-snapper.sh @@ -1,4 +1,6 @@ if command -v limine &>/dev/null; then + sudo pacman -S --noconfirm --needed limine-snapper-sync limine-mkinitcpio-hook + sudo tee /etc/mkinitcpio.conf.d/omarchy_hooks.conf </dev/null HOOKS=(base udev plymouth keyboard autodetect microcode modconf kms keymap consolefont block encrypt filesystems fsck btrfs-overlayfs) EOF @@ -34,6 +36,7 @@ KERNEL_CMDLINE[default]="$CMDLINE" KERNEL_CMDLINE[default]+="quiet splash" ENABLE_UKI=yes +CUSTOM_UKI_NAME="omarchy" ENABLE_LIMINE_FALLBACK=yes @@ -75,7 +78,6 @@ term_background_bright: 24283b EOF - sudo pacman -S --noconfirm --needed limine-snapper-sync limine-mkinitcpio-hook # Match Snapper configs if not installing from the ISO if [[ -z ${OMARCHY_CHROOT_INSTALL:-} ]]; then @@ -96,13 +98,24 @@ EOF chrootable_systemctl_enable limine-snapper-sync.service fi -# Add UKI entry to UEFI machines to skip bootloader showing on normal boot -if [[ -n $EFI ]] && efibootmgr &>/dev/null && ! efibootmgr | grep -q Omarchy && +if [[ -n $EFI ]] && efibootmgr &>/dev/null; then + # Remove the archinstall-created Limine entry + while IFS= read -r bootnum; do + sudo efibootmgr -b "$bootnum" -B >/dev/null 2>&1 + done < <(efibootmgr | grep -E "^Boot[0-9]{4}\*? Arch Linux Limine" | sed 's/^Boot\([0-9]\{4\}\).*/\1/') +fi + +if [[ -n $EFI ]] && efibootmgr &>/dev/null && ! cat /sys/class/dmi/id/bios_vendor 2>/dev/null | grep -qi "American Megatrends" && ! cat /sys/class/dmi/id/bios_vendor 2>/dev/null | grep -qi "Apple"; then - sudo efibootmgr --create \ - --disk "$(findmnt -n -o SOURCE /boot | sed 's/p\?[0-9]*$//')" \ - --part "$(findmnt -n -o SOURCE /boot | grep -o 'p\?[0-9]*$' | sed 's/^p//')" \ - --label "Omarchy" \ - --loader "\\EFI\\Linux\\$(cat /etc/machine-id)_linux.efi" + + uki_file=$(find /boot/EFI/Linux/ -name "omarchy*.efi" -printf "%f\n" 2>/dev/null | head -1) + + if [[ -n "$uki_file" ]]; then + sudo efibootmgr --create \ + --disk "$(findmnt -n -o SOURCE /boot | sed 's/p\?[0-9]*$//')" \ + --part "$(findmnt -n -o SOURCE /boot | grep -o 'p\?[0-9]*$' | sed 's/^p//')" \ + --label "Omarchy" \ + --loader "\\EFI\\Linux\\$uki_file" + fi fi diff --git a/migrations/1758487662_move_to_custom_uki.sh b/migrations/1758487662_move_to_custom_uki.sh new file mode 100644 index 00000000..2d72fe02 --- /dev/null +++ b/migrations/1758487662_move_to_custom_uki.sh @@ -0,0 +1,36 @@ +echo "Update UKI to custom named entry" + +if command -v limine &>/dev/null && [[ -f /etc/default/limine ]]; then + if grep -q "^ENABLE_UKI=yes" /etc/default/limine; then + if ! grep -q "^CUSTOM_UKI_NAME=" /etc/default/limine; then + sudo sed -i '/^ENABLE_UKI=yes/a CUSTOM_UKI_NAME="omarchy"' /etc/default/limine + fi + + # Remove the archinstall-created Limine entry + while IFS= read -r bootnum; do + sudo efibootmgr -b "$bootnum" -B >/dev/null 2>&1 + done < <(efibootmgr | grep -E "^Boot[0-9]{4}\*? Arch Linux Limine" | sed 's/^Boot\([0-9]\{4\}\).*/\1/') + + + sudo limine-update + + uki_file=$(find /boot/EFI/Linux/ -name "omarchy*.efi" -printf "%f\n" 2>/dev/null | head -1) + + if [[ -n "$uki_file" ]]; then + while IFS= read -r bootnum; do + sudo efibootmgr -b "$bootnum" -B >/dev/null 2>&1 + done < <(efibootmgr | grep -E "^Boot[0-9]{4}\*? Omarchy" | sed 's/^Boot\([0-9]\{4\}\).*/\1/') + + sudo efibootmgr --create \ + --disk "$(findmnt -n -o SOURCE /boot | sed 's/p\?[0-9]*$//')" \ + --part "$(findmnt -n -o SOURCE /boot | grep -o 'p\?[0-9]*$' | sed 's/^p//')" \ + --label "Omarchy" \ + --loader "\\EFI\\Linux\\$uki_file" + fi + else + echo "Not using UKI. Not making any changes." + fi +else + echo "Boot config is non-standard. Not making any changes." +fi +