Offer direct boot as a toggle option
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Add an EFI boot entry for the Omarchy UKI, allowing the system to boot directly
|
# Add or remove 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.
|
# without a bootloader like Limine. Requires UEFI firmware and a built UKI.
|
||||||
|
|
||||||
if [[ ! -d /sys/firmware/efi ]]; then
|
if [[ ! -d /sys/firmware/efi ]]; then
|
||||||
@@ -23,23 +23,36 @@ if cat /sys/class/dmi/id/bios_vendor 2>/dev/null | grep -qi "Apple"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
uki_file=$(find /boot/EFI/Linux/ -name "omarchy*.efi" -printf "%f\n" 2>/dev/null | head -1)
|
existing_entry=$(efibootmgr | grep -E "^Boot[0-9A-Fa-f]+\*? Omarchy([[:space:]]|$)" | head -1)
|
||||||
|
|
||||||
if [[ -z $uki_file ]]; then
|
if [[ -n $existing_entry ]]; then
|
||||||
echo "Error: No Omarchy UKI found in /boot/EFI/Linux/" >&2
|
boot_num=$(echo "$existing_entry" | sed -n 's/^Boot\([0-9A-Fa-f]\+\).*/\1/p')
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
boot_source=$(findmnt -n -o SOURCE /boot)
|
if gum confirm "Disable direct boot (remove Omarchy EFI entry)?"; then
|
||||||
disk=$(echo "$boot_source" | sed 's/p\?[0-9]*$//')
|
echo "Removing EFI boot entry $boot_num"
|
||||||
part=$(echo "$boot_source" | grep -o 'p\?[0-9]*$' | sed 's/^p//')
|
sudo efibootmgr --bootnum "$boot_num" --delete-bootnum >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
if gum confirm "Setup direct boot (so snapshot booting must be done via bios)?"; then
|
exit 0
|
||||||
echo "Creating EFI boot entry for $uki_file"
|
else
|
||||||
|
uki_file=$(find /boot/EFI/Linux/ -name "omarchy*.efi" -printf "%f\n" 2>/dev/null | head -1)
|
||||||
|
|
||||||
sudo efibootmgr --create \
|
if [[ -z $uki_file ]]; then
|
||||||
--disk "$disk" \
|
echo "Error: No Omarchy UKI found in /boot/EFI/Linux/" >&2
|
||||||
--part "$part" \
|
exit 1
|
||||||
--label "Omarchy" \
|
fi
|
||||||
--loader "\\EFI\\Linux\\$uki_file"
|
|
||||||
|
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
|
||||||
fi
|
fi
|
||||||
|
|||||||
+2
-1
@@ -168,7 +168,7 @@ show_share_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_toggle_menu() {
|
show_toggle_menu() {
|
||||||
local options=" Screensaver\n Nightlight\n Idle Lock\n Top Bar\n Workspace Layout\n Window Gaps\n 1-Window Ratio\n Monitor Scaling\n"
|
local options=" Screensaver\n Nightlight\n Idle Lock\n Top Bar\n Workspace Layout\n Window Gaps\n 1-Window Ratio\n Monitor Scaling\n Direct Boot"
|
||||||
|
|
||||||
case $(menu "Toggle" "$options") in
|
case $(menu "Toggle" "$options") in
|
||||||
*Screensaver*) omarchy-toggle-screensaver ;;
|
*Screensaver*) omarchy-toggle-screensaver ;;
|
||||||
@@ -179,6 +179,7 @@ show_toggle_menu() {
|
|||||||
*Ratio*) omarchy-hyprland-window-single-square-aspect-toggle ;;
|
*Ratio*) omarchy-hyprland-window-single-square-aspect-toggle ;;
|
||||||
*Gaps*) omarchy-hyprland-window-gaps-toggle ;;
|
*Gaps*) omarchy-hyprland-window-gaps-toggle ;;
|
||||||
*Scaling*) omarchy-hyprland-monitor-scaling-cycle ;;
|
*Scaling*) omarchy-hyprland-monitor-scaling-cycle ;;
|
||||||
|
*"Direct Boot"*) present_terminal omarchy-config-direct-boot ;;
|
||||||
*) back_to show_trigger_menu ;;
|
*) back_to show_trigger_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user