WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix some more bugs in pygrub including:

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix some more bugs in pygrub including:
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Nov 2005 17:06:13 +0000
Delivery-date: Thu, 10 Nov 2005 17:07:31 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID d5775d0bcf1e5bc1b076aa55ca5e92eecd053784
# Parent  06d08564b982812ceab787bc56104aae07fbad3a
Fix some more bugs in pygrub including:
a) a couple of variables were referenced wrong
b) fix using arrow keys in the menu to act correctly
c) and look for grub config properly for /boot partition

Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>

diff -r 06d08564b982 -r d5775d0bcf1e tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Thu Nov 10 10:59:49 2005
+++ b/tools/pygrub/src/pygrub   Thu Nov 10 11:01:15 2005
@@ -89,8 +89,8 @@
     buf = os.read(fd, 512)
     for poff in (446, 462, 478, 494): # partition offsets
         # active partition has 0x80 as the first byte
-        if struct.unpack("<c", buf[p:p+1]) == ('\x80',):
-            return struct.unpack("<", buf[p+8:p+12])[0] * SECTOR_SIZE
+        if struct.unpack("<c", buf[poff:poff+1]) == ('\x80',):
+            return struct.unpack("<L", buf[poff+8:poff+12])[0] * SECTOR_SIZE
     return -1
 
 def get_config(fn):
@@ -113,11 +113,13 @@
             break
 
     if fs is not None:
-        if fs.file_exist("/boot/grub/menu.lst"):
-            grubfile = "/boot/grub/menu.lst"
-        elif fs.file_exist("/boot/grub/grub.conf"):
-            grubfile = "/boot/grub/grub.conf"
-        else:
+        grubfile = None
+        for f in ("/boot/grub/menu.lst", "/boot/grub/grub.conf",
+                  "/grub/menu.lst", "/grub/grub.conf"):
+            if fs.file_exist(f):
+                grubfile = f
+                break
+        if grubfile is None:
             raise RuntimeError, "we couldn't find 
/boot/grub{menu.lst,grub.conf} " + \
                                 "in the image provided. halt!"
         f = fs.open_file(grubfile)
@@ -169,7 +171,7 @@
 #        if c == ord('q'):
 #            selected = -1
 #            break
-        elif c == ord('c'):
+        if c == ord('c'):
             # FIXME: needs to go to command line mode
             continue
         elif c == ord('a'):
@@ -261,7 +263,7 @@
 
     offset = 0
     if is_disk_image(file):
-        offset = get_active_offset(fn)
+        offset = get_active_offset(file)
         if offset == -1:
             raise RuntimeError, "Unable to find active partition on disk"
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix some more bugs in pygrub including:, Xen patchbot -unstable <=