[paketler-commits] r70055 - in 2009/devel/system/base/grub: . comar

paketler-commits at pardus.org.tr paketler-commits at pardus.org.tr
10 Haz 2009 Çar 15:14:40 EEST


Author: bahadir.kandemir
Date: Wed Jun 10 15:14:40 2009
New Revision: 70055

Modified:
   2009/devel/system/base/grub/comar/bootloader.py
   2009/devel/system/base/grub/pspec.xml
Log:
Fixed Boot.Loader not raising exception with bogus UUIDs.

Modified: 2009/devel/system/base/grub/comar/bootloader.py
=================================================================
--- 2009/devel/system/base/grub/comar/bootloader.py	(original)
+++ 2009/devel/system/base/grub/comar/bootloader.py	Wed Jun 10 15:14:40 2009
@@ -393,22 +393,22 @@
     fields_opt = SYSTEMS[os_type][2]
     fields_all = fields_req + fields_opt
 
-    if "root" in fields_req:
-        if not root:
+    if "root" in fields_all:
+        if "root" in fields_req and not root:
             fail(FAIL_NOROOT)
-    else:
-        root = getRoot()
 
-    uuid = None
-    if not root.startswith("/dev/"):
-        uuid = root
-        root = getDeviceByUUID(root)
+        uuid = None
+        if not root.startswith("/dev/"):
+            uuid = root
+            root = getDeviceByUUID(root)
+            if not root:
+                fail(FAIL_NODEVICE % uuid)
 
-    try:
-        linux_disk, linux_part, grub_disk, grub_part = parseLinuxDevice(root)
-    except (ValueError, TypeError):
-        fail(FAIL_NODEVICE % root)
-    grub_device = "(%s,%s)" % (grub_disk, grub_part)
+        try:
+            linux_disk, linux_part, grub_disk, grub_part = parseLinuxDevice(root)
+        except (ValueError, TypeError):
+            fail(FAIL_NODEVICE % root)
+        grub_device = "(%s,%s)" % (grub_disk, grub_part)
 
     if "kernel" in fields_req and not kernel:
         fail(FAIL_NOKERNEL)
@@ -426,7 +426,7 @@
     else:
         if uuid:
             entry.setCommand("uuid", uuid)
-        else:
+        elif root:
             entry.setCommand("root", grub_device)
     if os_type == "xen":
         entry.setCommand("kernel", "/boot/xen.gz")
@@ -529,7 +529,6 @@
     if root == "":
         # Reads root partition from /bin/mount's output
         root = getRoot()
-    uuid = None
 
     try:
         new_version, new_suffix = parseVersion("kernel-%s" % version)
@@ -553,7 +552,6 @@
             rootIsValid = (os_entry["root"] == root)
         elif "uuid" in os_entry:
             rootIsValid = (getDeviceByUUID(os_entry["uuid"]) == root)
-            uuid = os_entry["uuid"]
         else:
             # No root or uuid found in entry. This is bad.
             fail(FAIL_NO_ROOT)
@@ -600,7 +598,7 @@
 
         kernel = "/boot/kernel-%s%s" % (new_version, new_suffix)
         initrd = "/boot/initramfs-%s%s" % (new_version, new_suffix)
-        new_entry = makeGrubEntry(title, os_type, uuid if uuid else root, kernel, initrd, boot_parameters)
+        new_entry = makeGrubEntry(title, os_type, root, kernel, initrd, boot_parameters)
 
         if grub.config.getOption("default", "0") == "saved":
             new_entry.setCommand("savedefault", "")

Modified: 2009/devel/system/base/grub/pspec.xml
=================================================================
--- 2009/devel/system/base/grub/pspec.xml	(original)
+++ 2009/devel/system/base/grub/pspec.xml	Wed Jun 10 15:14:40 2009
@@ -117,6 +117,15 @@
     </Package>
 
     <History>
+        <Update release="65">
+            <Date>2009-06-10</Date>
+            <Version>0.97</Version>
+            <Comment>
+                Fixed Boot.Loader not raising exception with bogus UUIDs.
+            </Comment>
+            <Name>Bahadır Kandemir</Name>
+            <Email>bahadir at pardus.org.tr</Email>
+        </Update>
         <Update release="64">
             <Date>2009-06-05</Date>
             <Version>0.97</Version>


Paketler-commits mesaj listesiyle ilgili daha fazla bilgi