From 24a5de2f99d09195b78acfde9e091fcbdc4e536f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 21 Feb 2026 11:08:52 +0100 Subject: [PATCH] Add option to configure direct boot --- bin/omarchy-config-direct-boot | 45 +++++++++++++++++++++++++++++++++ install/login/limine-snapper.sh | 16 ------------ 2 files changed, 45 insertions(+), 16 deletions(-) create mode 100755 bin/omarchy-config-direct-boot diff --git a/bin/omarchy-config-direct-boot b/bin/omarchy-config-direct-boot new file mode 100755 index 00000000..7cfedd3a --- /dev/null +++ b/bin/omarchy-config-direct-boot @@ -0,0 +1,45 @@ +#!/bin/bash + +# Add an EFI boot entry for the Omarchy UKI, allowing the system to boot directly +# without a bootloader like Limine. Requires UEFI firmware and a built UKI. + +if [[ ! -d /sys/firmware/efi ]]; then + echo "Error: System is not booted in UEFI mode" >&2 + exit 1 +fi + +if ! efibootmgr &>/dev/null; then + echo "Error: efibootmgr is not available or not functional" >&2 + exit 1 +fi + +if cat /sys/class/dmi/id/bios_vendor 2>/dev/null | grep -qi "American Megatrends"; then + echo "Error: American Megatrends firmware may not safely support custom EFI entries" >&2 + exit 1 +fi + +if cat /sys/class/dmi/id/bios_vendor 2>/dev/null | grep -qi "Apple"; then + echo "Error: Apple firmware uses its own boot manager" >&2 + exit 1 +fi + +uki_file=$(find /boot/EFI/Linux/ -name "omarchy*.efi" -printf "%f\n" 2>/dev/null | head -1) + +if [[ -z $uki_file ]]; then + echo "Error: No Omarchy UKI found in /boot/EFI/Linux/" >&2 + exit 1 +fi + +boot_source=$(findmnt -n -o SOURCE /boot) +disk=$(echo "$boot_source" | sed 's/p\?[0-9]*$//') +part=$(echo "$boot_source" | grep -o 'p\?[0-9]*$' | sed 's/^p//') + +if ! gum confirm "Setup direct boot (so snapshot booting must be done via bios)?"; then + echo "Creating EFI boot entry for $uki_file" + + sudo efibootmgr --create \ + --disk "$disk" \ + --part "$part" \ + --label "Omarchy" \ + --loader "\\EFI\\Linux\\$uki_file" +fi diff --git a/install/login/limine-snapper.sh b/install/login/limine-snapper.sh index 44c8cddc..afd05b15 100644 --- a/install/login/limine-snapper.sh +++ b/install/login/limine-snapper.sh @@ -91,19 +91,3 @@ if [[ -n $EFI ]] && efibootmgr &>/dev/null; then 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 - -# Move this to a utility to allow manual activation -# 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 -# -# 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