ia64/xen-unstable

changeset 16368:afd7d5c96e09

xend: Fix appending policy module to end of grub's config file

This patch fixes the case where a module line is supposed to be added
to the very end of the file but the file does not end in with a new
line. Also fixes a problem that in some cases the module line would
not be properly be removed.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Keir Fraser <keir@xensource.com>
date Sat Nov 10 10:54:32 2007 +0000 (2007-11-10)
parents 8d8d179b9b05
children a790ad6ef073
files tools/python/xen/util/bootloader.py
line diff
     1.1 --- a/tools/python/xen/util/bootloader.py	Fri Nov 09 12:59:58 2007 +0000
     1.2 +++ b/tools/python/xen/util/bootloader.py	Sat Nov 10 10:54:32 2007 +0000
     1.3 @@ -65,6 +65,8 @@ def get_kernel_val(index, att):
     1.4  
     1.5  def set_boot_policy(title_idx, filename):
     1.6      boottitles = get_boot_policies()
     1.7 +    for key in boottitles.iterkeys():
     1.8 +        boottitles[key] += ".bin"
     1.9      if boottitles.has_key(title_idx):
    1.10          rm_policy_from_boottitle(title_idx, [ boottitles[title_idx] ])
    1.11      rc = add_boot_policy(title_idx, filename)
    1.12 @@ -336,6 +338,8 @@ class Grub(Bootloader):
    1.13                  os.write(tmp_fd, line)
    1.14  
    1.15              if module_line != "" and not found:
    1.16 +                if ord(line[-1]) not in [ 10 ]:
    1.17 +                    os.write(tmp_fd, '\n')
    1.18                  os.write(tmp_fd, module_line)
    1.19                  found = True
    1.20