aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub/src/GrubConf.py
Commit message (Collapse)AuthorAgeFilesLines
* pygrub: Support (/dev/xvda) style disk specificationsIan Campbell2013-10-141-1/+5
| | | | | | | | | | | You get these if you install Debian Wheezy as HVM and then try to convert to PV. This is Debian bug #603391. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Tested-by: Tril <tril@metapipe.net> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* pygrub/GrubConf: fix boot problem for fedora 19 grub.cfg (2nd attempt)Marcel J.E. Mol2013-06-271-0/+2
| | | | | | | | | | | | | | | Booting a fedora 19 domU failed because a it could not properly parse the grub.cfg file. This was cased by set default="${next_entry}" This statement actually is within an 'if' statement, so maybe it would be better to skip code within if/fi blocks... But this patch seems to work fine. Signed-off-by: Marcel Mol <marcel@mesa.nl> Acked-by: Ian Campbell <ian.campbell@citix.com> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* pygrub: Fix command line argument error handlingMatthew Daley2012-11-121-1/+1
| | | | | | | | | | | | | pygrub's individual config file parsers do not correctly check the amount of command line arguments given to them. In addition, the LILO config parser would report an incorrect message. Use len() to correctly check the amount of arguments, and fix the LILO error message. Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* pyrgrub: cope with configurations with set default="${saved_entry}" lineMichael Young2011-10-251-0/+2
| | | | | | | | | | Fedora 16 grub2 configuration file can have lines like set default="${saved_entry}" and a string containing an integer is expected Signed-off-by: Michael Young <m.a.young@durham.ac.uk> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* pygrub: cope with configurations with submenusMichael Young2011-10-251-2/+11
| | | | | | | | | | | | | | | | | The grub2 configuration file in Fedora 16 can have one or more menuentrys in a submenu, with configuration of the form submenu "Xen 4.1" { menuentry ... { ... } } (this example occurs when the xen hypervisor is installed on the guest) Ignore the submenu line and the corresponding } Signed-off-by: Michael Young <m.a.young@durham.ac.uk> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: Allow GPT partition referencesMichael Young2011-10-251-0/+2
| | | | | | | | The grub2 configuration file in Fedora 16 can have GPT partition references like (hd0,gpt2) so remove the "gpt" string where necessary Signed-off-by: Michael Young <m.a.young@durham.ac.uk> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: support grub2 "(hdX,msdosY)" partition syntaxIan Campbell2010-10-131-0/+2
| | | | | | | | This appeared in Debian Squeeze at some point. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* tools/pygrub: Fix a typo handling device specs with no partition partIan Jackson2010-07-021-1/+1
| | | | | | | pygrub: fix a typo that causes exceptions when looking at device specifications that don't have a partition part (e.g. (hd0)). Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* pyGrub: Use proper bootloader class when entering command manuallyKeir Fraser2010-05-261-1/+7
| | | | | | | | | | | | | | | | | | Use the proper bootloader class when entering the boot commands manually (i.e. using the 'c' option). Before this patch the bootloader was always treated to be Grub but when user is using Grub2/ExtLinux or Lilo it's rather confusing. After applying this patch the proper bootloader image class is being used, e.g. Grub2Image for Grub2 etc. when you define the boot commands manually using the 'c' command in pyGrub. Also, fix for using isconfig has been applied since if there is not fs set in the run_grub() method the read_config() would fail since it's trying to access undefined self.cf which is now being set to parser() from cfg_list. Signed-off-by: Michal Novotny <minovotn@redhat.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: Fix Grub2 support for Ubuntu 10.04Keir Fraser2010-04-151-1/+1
| | | | | | | | Due to changes in grub2, menu entry titles now have single quote around them rather than double quotes, but the memtest entries still are using double quotes, so we need to catch both. Signed-off-by: David Markey <david.markey@citrix.com>
* pygrub: further improve grub2 supportKeir Fraser2010-03-151-11/+16
| | | | | | | | | | | | | | * Improve syntax error messages to say what actually went wrong instead of giving an arbitrary and basically useless integer. * Improve handling of quoted values used with the "set" command, previously only the default variable was special cased to handle quoting. * Allow for extra options to the menuentry command, syntax now appears to be menuentry "TITLE" --option1 --option2 {...} Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: support parsing of syslinux configuration filesKeir Fraser2010-02-011-0/+1
| | | | | | | | | | Allows booting from ISOs which use isolinux as well as guests using extlinux. Also add copyright header to GrubConf.py, I think the grub2 support added last year qualifies as a substantial change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: improve grub 2 supportKeir Fraser2010-01-261-3/+19
| | | | | | | | | | | | | | | | | * The "default" value can be a quoted string (containing an integer) so strip the quotes before interpreting. * The "set" command takes a variable with an arbitrary name so instead of whitelisting the ones to ignore simply silently accept any set command with an unknown variable. * Ignore the echo command. * Handle the function { ... } syntax. Previously pygrub would error out with a syntax error on the closing "}" because it thought it was the closing bracket of a menuentry. This makes pygrub2 work with the configuration files generated by Debian Squeeze today. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: add basic support for parsing grub2 style grub.cfg fileKeir Fraser2009-11-231-3/+120
| | | | | | | | | | This represents a very simplistic aproach to parsing these file. It is basically sufficient to parse the files produced by Debian Squeeze's version of update-grub. The actual grub.cfg syntax is much more expresive but not apparently documented apart from a few examples... Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: track the title of an item as an independant fieldKeir Fraser2009-11-231-13/+14
| | | | | | | | | | | | separate to the other fields. This makes the list of lines within a GrubImage 0 based rather than 1 based therefore adjust the user interface parts to suit. This is in preparation for grub2 support where the syntax for the item title does not fit the existing usage. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: factor generic Grub functionality into GrubConf base classesKeir Fraser2009-11-231-66/+77
| | | | | | | | | | | and inherit from these classes to implement Grub-legacy functionality. Use a tuple of (parser-object,configuration-file) in pygrub to allow for multiple parsers. Makes way for grub2 support. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: if default entry is "saved" then use first entry.Keir Fraser2009-11-231-1/+1
| | | | | | | | pygrub doesn't support the "savedefault" command and will error out if menu.lst uses the "default saved" directive. We might as well start on the first entry in this case instead of failing. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: Correct pygrub return valueKeir Fraser2009-09-151-2/+3
| | | | | | | | | | | | This is the patch to correct pygrub return value for checkPassword() function. It didn't return False at the end of the function. It returned None so it was working fine and it's most likely just a cosmetic issue. Also, the missing () were added to checkPassword() function when calling hasPassword and the unnecessary comment was removed. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: trap exception when python module import failsKeir Fraser2009-09-071-14/+17
| | | | | | | | | | | Fix the issue when importing 'crypt' module or crypt.crypt fails in pygrub. The exception is written on the same line like "Failed!" message but only if there is an exception. If there is no exception, we don't bother users with details (probably the password they entered was wrong) so we just display "Failed!" message. Also, the code for hasPassword() was rewritten not to have try/except block here. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: Fix elilo handling after password patch.Keir Fraser2009-08-211-1/+1
| | | | Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: Add password supportKeir Fraser2009-08-201-0/+33
| | | | | | | | | | | | | | It basically checks for the presence of password line in grub.conf of the guest image and if this line is present, it supports both clear text and md5 versions of the password. Editing the grub entries and command-line are disabled when some password is set in domain's grub.conf file but the password was not entered yet. Also, new option to press 'p' in interactive pygrub has been added to allow entering the grub password. It's been tested on x86_64 with PV guests and was working fine. Also, the countdown has been stopped after key was pressed, ie. the user is probably editing the boot configuration. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* Fix security vulnerability CVE-2007-4993.Keir Fraser2007-09-251-14/+14
| | | | | | | | | Protect pygrub from possible malicious content in guest grub config file. This fixes CVE-2007-4993. Original patch from Jeremy Katz, I updated to close 2 remaining issues pointed out by Christian and Keir, and to use setattr(self, ...). Signed-off-by: Chris Wright <chrisw@sous-sol.org>
* [PYGRUB] Flesh out some of pygrub's functionality as was originallykaf24@firebug.cl.cam.ac.uk2006-08-081-22/+50
| | | | | | | | | | | | intended. Changes include: * Addition of basic command line mode much like grub's so that you can boot things without having them specified in the config file * Edit/append mode for modifying kernel command lines, etc * Fix handling of case where the grub config didn't have a default specified Signed-off-by: Jeremy Katz <katzj@redhat.com>
* bitkeeper revision 1.1327.2.13 (4270d6c35WpxFmhdkREjmSvk82s-Bg)mjw@wray-m-3.hpl.hp.com2005-04-281-0/+229
Merge Jeremy's pygrub bootloader patch. Signed-off-by: Jeremy Katz <katzj@redhat.com> Signed-off-by: Mike Wray <mike.wray@hp.com>