Skip to contentSkip to conversation

os-detect lua uuid fix

PATCH adrian15 1 participant 1 message Aug 22, 2009

lore
Share & tools
lore

adrian15

author
#0 lore raw

Here you a have a patch that fixes the error that osdetect.lua script had uuid not being set.

Now the linux kernel does not complain about not finding root device.

The only problem that this patch has is that is made with grub shell in mind instead of lua.

I suppose that we can do the same thing but getting the uuid values from lua script itself. If I am able to do so I will also send a patch for it.

adrian15

Signature · 2 lines
Support free software. Donate to Super Grub Disk. Apoya el software
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/index.php?pid=10
osdetect.lua +4 -2
diff -urN original/osdetect.lua uuid_fix/osdetect.lua
@@ -156,9 +156,11 @@
 	local initrd
 
 	title = "Linux " .. kernels[i]
+	uuid_setup = "search --set=sgd_linux_kernel -f /boot/" .. kernelnames[i] .. "\n"
+	uuid_set = "probe -u ($sgd_linux_kernel) --set=sgd_root_uuid" .. "\n"
 	source = "set root=" .. device ..
 	  "\nlinux /boot/" .. kernelnames[i] ..
-	  " root=UUID=" ..  " ro"
+	  " root=UUID=" .. "$sgd_root_uuid" ..  " ro"
 
 	if grub.file_exist (root .. "boot/initrd-" ..
 			    kernels[i] .. ".img") then
@@ -171,7 +173,7 @@
 	  initrd = ""
 	end
 
-	grub.add_menu (source .. initrd, title)
+	grub.add_menu (uuid_setup .. uuid_set .. source .. initrd, title)
 	grub.add_menu (source .. " single" .. initrd,
 		       title .. " (single-user mode)")
       end