diff options
author | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2010-06-29 16:23:13 +0100 |
---|---|---|
committer | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2010-06-29 16:23:13 +0100 |
commit | 4b544ba5353aa6779d3ef20a2ae470b1b851a3c5 (patch) | |
tree | 13e485d48d1cece4c9e60b730a1f6d5052995b25 /tools/pygrub | |
parent | fa5685207c8154381186f328cd7b96ace04de7ee (diff) | |
download | xen-4b544ba5353aa6779d3ef20a2ae470b1b851a3c5.tar.gz xen-4b544ba5353aa6779d3ef20a2ae470b1b851a3c5.tar.bz2 xen-4b544ba5353aa6779d3ef20a2ae470b1b851a3c5.zip |
tools/pygrub: Fix default when out of range
This is the patch to fix pyGrub default value when it's being set out of
range. This patch makes the quiet and interactive mode select the same
default image when the default value for boot entry is out of range,
i.e. when the guest is having wrong configuration in it's boot loader
(like 3 entries with default mistakenly set to 10 etc).
When the boot entry number is being set out of range it falls back to 0
(first entry of boot loader).
Signed-off-by: Michal Novotny <minovotn@redhat.com>
Diffstat (limited to 'tools/pygrub')
-rw-r--r-- | tools/pygrub/src/pygrub | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index e52df7b525..9c99ba8ce6 100644 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -415,6 +415,9 @@ class Grub: timeout = int(self.cf.timeout) self.selected_image = self.cf.default + # If the selected (default) image doesn't exist we select the first entry + if self.selected_image > len(self.cf.images): + self.selected_image = 0 self.isdone = False while not self.isdone: self.run_main(timeout) |