[PATCH] Add information about boot method for bootloader
Martin Kolman
mkolman at redhat.com
Wed Oct 23 15:45:15 UTC 2013
On Mon, 2013-10-21 at 13:09 -0500, David Lehman wrote:
> On Mon, 2013-10-21 at 19:46 +0200, Martin Kolman wrote:
> > Make it possible to check which boot method a bootloader
> > instance is using. Currently reports MBR/EFI or None
> > if not known.
>
> All you have to do is check the Platform instance. In blivet/__init__.py
> you do this:
>
> from platform import X86
> from platform import EFI
>
> if isinstance(_platform, EFI):
> # EFI code...
> elif isinstance(_platform, X86):
> # BIOS code...
>
> Does this meet your needs?
So we always install the EFI bootloader with the EFI instance and MBR
bootloader with the X86 ? If yes, I can use this just fine.
>
> >
> > Related: rhbz#1012132
> > Signed-off-by: Martin Kolman <mkolman at redhat.com>
> > ---
> > pyanaconda/bootloader.py | 19 ++++++++++++++++++-
> > pyanaconda/constants.py | 4 ++++
> > 2 files changed, 22 insertions(+), 1 deletion(-)
> >
> > diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> > index 433a5cf..ec94ec1 100644
> > --- a/pyanaconda/bootloader.py
> > +++ b/pyanaconda/bootloader.py
> > @@ -32,7 +32,7 @@ from blivet.devicelibs import mdraid
> > from pyanaconda.isys import sync
> > from pyanaconda.product import productName
> > from pyanaconda.flags import flags
> > -from pyanaconda.constants import ROOT_PATH
> > +from pyanaconda.constants import ROOT_PATH, BOOT_METHOD_MBR, BOOT_METHOD_EFI
> > from blivet.errors import StorageError
> > from blivet.fcoe import fcoe
> > import pyanaconda.network
> > @@ -251,6 +251,8 @@ class BootLoader(object):
> >
> > _trusted_boot = False
> >
> > + _boot_method = None
> > +
> > def __init__(self):
> > self.boot_args = Arguments()
> > self.dracut_args = Arguments()
> > @@ -964,12 +966,25 @@ class BootLoader(object):
> > """ Update an existing bootloader configuration. """
> > pass
> >
> > + @ property
> > + def boot_method(self):
> > + """Report the boot type currently used
> > + or None if not known
> > + This is currently mainly used to differentiate between
> > + MBR and EFI booting.
> > + :returns: boot type constant or None
> > + :rtype: string or None
> > + """
> > +
> > + return self._boot_method
> > +
> >
> > class GRUB(BootLoader):
> > name = "GRUB"
> > _config_dir = "grub"
> > _config_file = "grub.conf"
> > _device_map_file = "device.map"
> > + _boot_method = BOOT_METHOD_MBR
> > can_dual_boot = True
> > can_update = True
> >
> > @@ -1348,6 +1363,7 @@ class GRUB2(GRUB):
> > packages = ["grub2"]
> > _config_file = "grub.cfg"
> > _config_dir = "grub2"
> > + _boot_method = BOOT_METHOD_MBR
> > config_file_mode = 0600
> > defaults_file = "/etc/default/grub"
> > can_dual_boot = True
> > @@ -1614,6 +1630,7 @@ class EFIGRUB(GRUB2):
> > can_dual_boot = False
> > stage2_is_valid_stage1 = False
> > stage2_bootable = False
> > + _boot_method = BOOT_METHOD_EFI
> >
> > @property
> > def _config_dir(self):
> > diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
> > index 7af5014..8e09c9c 100644
> > --- a/pyanaconda/constants.py
> > +++ b/pyanaconda/constants.py
> > @@ -142,3 +142,7 @@ PASSWORD_WEAK_CONFIRM = N_("You have provided a weak password. Press Done again
> > PASSWORD_WEAK_CONFIRM_WITH_ERROR = N_("You have provided a weak password: %s. Press Done again to use anyway.")
> >
> > PASSWORD_STRENGTH_DESC = [N_("Empty"), N_("Weak"), N_("Fair"), N_("Good"), N_("Strong")]
> > +
> > +# boot methods
> > +BOOT_METHOD_MBR = "mbr"
> > +BOOT_METHOD_EFI = "efi"
>
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
More information about the anaconda-patches
mailing list