[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix some more bugs in pygrub including:
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |