Skip to content

Commit e528a31

Browse files
committed
Fix startup.nsh - didn't like "echo -n ..." and better handling
1 parent dc42e65 commit e528a31

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

ZFS-root.sh

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,38 +1792,36 @@ cat >> ${ZFSBUILD}/root/Setup.sh << '__EOF__'
17921792
cat <<- 'EOF' > /boot/efi/startup.nsh
17931793
@echo -off
17941794
cls
1795+
1796+
echo "Searching for rEFInd boot manager..."
1797+
echo ""
17951798
1796-
# List all mapped file systems (disks/partitions)
1797-
echo -n "Enumerating filesystems... "
1799+
# Try to enumerate filesystems by attempting to access fs0:
1800+
# This is just a basic check that the shell can access drives
17981801
fs0:
1799-
if %lasterror% == 0 then
1800-
echo "OK"
1801-
else
1802-
echo "No filesystems found."
1803-
goto error
1802+
if %lasterror% != 0 then
1803+
echo "ERROR: Cannot access filesystem mappings."
1804+
goto end
18041805
endif
18051806
1806-
set found 0
1807-
1808-
for %i in (fs*) do (
1809-
echo -n "Checking %i for /EFI/refind/refind_x64.efi ... "
1810-
if exist %i:\EFI\refind\refind_x64.efi then
1811-
echo "FOUND"
1812-
echo "Launching rEFInd from %i:"
1813-
%i:\EFI\refind\refind_x64.efi
1814-
goto done
1807+
# Search through all filesystem mappings
1808+
for %i in 0 1 2 3 4 5 6 7 8 9 do
1809+
echo -n "Checking fs%i: for /EFI/refind/refind_x64.efi ... "
1810+
if exist fs%i:\EFI\refind\refind_x64.efi then
1811+
echo "FOUND - Launching rEFInd from fs%i:"
1812+
echo ""
1813+
fs%i:\EFI\refind\refind_x64.efi
1814+
# If we reach here, rEFInd failed to launch
1815+
echo "ERROR: rEFInd launch failed."
1816+
goto end
18151817
else
18161818
echo "not present"
18171819
endif
1818-
)
1820+
endfor
18191821
1820-
:error
1822+
# If we get here, rEFInd was not found anywhere
1823+
echo ""
18211824
echo "ERROR: Could not find /EFI/refind/refind_x64.efi on any filesystem."
1822-
goto end
1823-
1824-
:done
1825-
echo "rEFInd launched successfully."
1826-
goto end
18271825
18281826
:end
18291827
EOF

0 commit comments

Comments
 (0)