installer: Fix GRUB installation fallback logic

Message ID 20260727011034.629367-1-vincent.mc.li@gmail.com
State New
Headers
Series installer: Fix GRUB installation fallback logic |

Commit Message

Vincent Li 27 Jul 2026, 1:10 a.m. UTC
The GRUB installation loop would exit immediately on the first failure,
preventing it from trying alternative installation methods.

This was causing issues on LoongArch64 systems where the initial
installation attempt would fail, but the fallback with --removable
would have succeeded if the script had continued.

With this change, the installer now tries all available installation
methods before failing, improving compatibility across architectures.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
 src/installer/install-bootloader | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/src/installer/install-bootloader b/src/installer/install-bootloader
index 977ed3674..f21578495 100644
--- a/src/installer/install-bootloader
+++ b/src/installer/install-bootloader
@@ -141,10 +141,10 @@  function grub_install() {
 
 		local removable
 		for removable in "" "--removable"; do
-			if ! grub-install ${GRUB_INSTALL_ARGS} ${args} \
+			if grub-install ${GRUB_INSTALL_ARGS} ${args} \
 					${removable} "${device}" &>/dev/null; then
-				echo "Could not install GRUB on ${device}" >&2
-				return 1
+				echo "GRUB installed successfully on ${device}" >&2
+				return 0
 			fi
 
 			# Do not try to install with --removable for non-efi architectures
@@ -152,7 +152,7 @@  function grub_install() {
 		done
 	done
 
-	return 0
+	return 1
 }
 
 function main() {