From 4d9e5ed59ec2d0355e4165eb8b0a6cdde0371acf Mon Sep 17 00:00:00 2001 From: Vasilito Date: Fri, 17 Apr 2026 21:45:38 +0100 Subject: [PATCH] Fix GRUB bootloader lookup, eliminate duplicate recipe, harden recipe build install-grub.sh now searches both recipes/core/bootloader/target and local/recipes/core/bootloader/target for the Redox bootloader artifact. The WIP grub recipe (recipes/wip/services/grub) is now a full directory symlink to local/recipes/core/grub instead of just recipe.toml, ensuring COOKBOOK_RECIPE resolves to a directory that contains grub.cfg. This also eliminates the duplicate recipe warning from the cookbook. The GRUB recipe now fails hard (exit 1) if grub.cfg is missing instead of just warning. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- local/recipes/core/grub/recipe.toml | 4 +++- local/scripts/apply-patches.sh | 10 +++++++--- local/scripts/install-grub.sh | 20 +++++++++++++------- recipes/wip/services/grub | 1 + recipes/wip/services/grub/recipe.toml | 1 - 5 files changed, 24 insertions(+), 12 deletions(-) create mode 120000 recipes/wip/services/grub delete mode 120000 recipes/wip/services/grub/recipe.toml diff --git a/local/recipes/core/grub/recipe.toml b/local/recipes/core/grub/recipe.toml index 1fca80ad..41c5f36c 100644 --- a/local/recipes/core/grub/recipe.toml +++ b/local/recipes/core/grub/recipe.toml @@ -118,7 +118,9 @@ if [ -f "${COOKBOOK_RECIPE}/grub.cfg" ]; then cp "${COOKBOOK_RECIPE}/grub.cfg" "${COOKBOOK_STAGE}/usr/lib/boot/grub.cfg" echo "Installed grub.cfg" else - echo "WARNING: grub.cfg not found in ${COOKBOOK_RECIPE}" >&2 + echo "ERROR: grub.cfg not found in ${COOKBOOK_RECIPE}" >&2 + echo "The grub.cfg file must exist alongside recipe.toml." >&2 + exit 1 fi echo "GRUB recipe complete." diff --git a/local/scripts/apply-patches.sh b/local/scripts/apply-patches.sh index 4de7069d..b9bfef53 100755 --- a/local/scripts/apply-patches.sh +++ b/local/scripts/apply-patches.sh @@ -131,9 +131,13 @@ symlink "../../local/recipes/core/ext4d" "recipes/core/ext4d" symlink "../../local/recipes/core/grub" "recipes/core/grub" # Resolve WIP conflict: recipes/wip/services/grub also exists, -# so redirect its recipe.toml to our local overlay -if [ -d "recipes/wip/services/grub" ]; then - symlink "../../../../local/recipes/core/grub/recipe.toml" "recipes/wip/services/grub/recipe.toml" +# so redirect the entire directory to our local overlay to ensure +# COOKBOOK_RECIPE resolves to a directory that contains grub.cfg +if [ -d "recipes/wip/services/grub" ] && [ ! -L "recipes/wip/services/grub" ]; then + rm -rf "recipes/wip/services/grub" +fi +if [ ! -e "recipes/wip/services/grub" ]; then + symlink "../../../../local/recipes/core/grub" "recipes/wip/services/grub" fi # Wayland additions diff --git a/local/scripts/install-grub.sh b/local/scripts/install-grub.sh index c3382841..82852eb6 100755 --- a/local/scripts/install-grub.sh +++ b/local/scripts/install-grub.sh @@ -92,14 +92,20 @@ python3 "${FAT_TOOL}" ls "${IMAGE}" "${ESP_OFFSET}" / echo "" REDBEAR_EFI="" -for f in $(find "${REPO_ROOT}/local/recipes/core/bootloader/target" -path "*/stage/usr/lib/boot/bootloader.efi" 2>/dev/null); do - REDBEAR_EFI="${f}" - break -done -for f in $(find "${REPO_ROOT}/repo" -path "*/bootloader/*/usr/lib/boot/bootloader.efi" 2>/dev/null); do - REDBEAR_EFI="${f}" - break +for search_path in \ + "${REPO_ROOT}/recipes/core/bootloader/target" \ + "${REPO_ROOT}/local/recipes/core/bootloader/target"; do + for f in $(find "${search_path}" -path "*/stage/usr/lib/boot/bootloader.efi" 2>/dev/null); do + REDBEAR_EFI="${f}" + break 2 + done done +if [ -z "${REDBEAR_EFI}" ]; then + for f in $(find "${REPO_ROOT}/repo" -path "*/bootloader/*/usr/lib/boot/bootloader.efi" 2>/dev/null); do + REDBEAR_EFI="${f}" + break + done +fi if [ -z "${REDBEAR_EFI}" ]; then echo "ERROR: Cannot find Redox bootloader (bootloader.efi) in cookbook output." >&2 diff --git a/recipes/wip/services/grub b/recipes/wip/services/grub new file mode 120000 index 00000000..ec3b2ed8 --- /dev/null +++ b/recipes/wip/services/grub @@ -0,0 +1 @@ +../../../../local/recipes/core/grub \ No newline at end of file diff --git a/recipes/wip/services/grub/recipe.toml b/recipes/wip/services/grub/recipe.toml deleted file mode 120000 index a7765fc6..00000000 --- a/recipes/wip/services/grub/recipe.toml +++ /dev/null @@ -1 +0,0 @@ -../../../../local/recipes/core/grub/recipe.toml \ No newline at end of file