]> xenbits.xensource.com Git - xen.git/commitdiff
xend: Fix appending policy module to end of grub's config file
authorKeir Fraser <keir@xensource.com>
Sat, 10 Nov 2007 10:54:32 +0000 (10:54 +0000)
committerKeir Fraser <keir@xensource.com>
Sat, 10 Nov 2007 10:54:32 +0000 (10:54 +0000)
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>
tools/python/xen/util/bootloader.py

index 9be6708b6526bfe6445743b22a25986297431d42..58c904f0702d12d00df1ce6103fa886c95cd2ee7 100644 (file)
@@ -65,6 +65,8 @@ def get_kernel_val(index, att):
 
 def set_boot_policy(title_idx, filename):
     boottitles = get_boot_policies()
+    for key in boottitles.iterkeys():
+        boottitles[key] += ".bin"
     if boottitles.has_key(title_idx):
         rm_policy_from_boottitle(title_idx, [ boottitles[title_idx] ])
     rc = add_boot_policy(title_idx, filename)
@@ -336,6 +338,8 @@ class Grub(Bootloader):
                 os.write(tmp_fd, line)
 
             if module_line != "" and not found:
+                if ord(line[-1]) not in [ 10 ]:
+                    os.write(tmp_fd, '\n')
                 os.write(tmp_fd, module_line)
                 found = True