From: Stefan Berger Subject: [PATCH] [Xend] Fix appending policy module to end of grub's config file Date: Fri, 09 Nov 2007 14:53:12 -0500 Message-ID: <1194637992.30208.4.camel@gsal-3.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-U2I2Lkg2+/7xFhL6QmFI" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-U2I2Lkg2+/7xFhL6QmFI Content-Type: text/plain Content-Transfer-Encoding: 7bit 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 --=-U2I2Lkg2+/7xFhL6QmFI Content-Disposition: inline; filename=acm_bootloader_fix.diff Content-Type: text/x-patch; name=acm_bootloader_fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/python/xen/util/bootloader.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/bootloader.py +++ root/xen-unstable.hg/tools/python/xen/util/bootloader.py @@ -64,6 +64,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) @@ -335,6 +337,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 --=-U2I2Lkg2+/7xFhL6QmFI Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-U2I2Lkg2+/7xFhL6QmFI--