[PATCH] add capability to install grub2 but not update the MBR

Martin Kolman mkolman at redhat.com
Mon Sep 15 09:12:15 UTC 2014



----- Original Message -----
> From: "Gene Czarcinski" <gczarcinski at ec.rr.com>
> To: anaconda-patches at lists.fedorahosted.org
> Cc: czar at acm.org
> Sent: Saturday, September 13, 2014 10:40:20 PM
> Subject: [PATCH] add capability to install grub2 but not update the MBR
> 
> This patch is in response to RHBZ#886502.  It adds the
> boot parameter "nombr" to suppress updating the MBR while
> still completely installing grub2 and creating the grub.cfg
> file.  The actual suppression adds "--grub-setup=/bin/true" to
> the execution of "/sbin/grub-install"
> 
> Kickstart, regular, and live installs are supported.
> ---
>  anaconda                 | 3 +++
>  pyanaconda/bootloader.py | 6 ++++++
>  pyanaconda/flags.py      | 2 ++
>  3 files changed, 11 insertions(+)
> 
> diff --git a/anaconda b/anaconda
> index 4d4676e..d0ba975 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -509,6 +509,8 @@ def parseArguments(argv=None, boot_cmdline=None):
>                      help=help_parser.help_text("noeject"))
>      ap.add_argument("--extlinux", action="store_true", default=False,
>                      help=help_parser.help_text("extlinux"))
> +    ap.add_argument("--nombr", action="store_true", default=False,
> +                    help=help_parser.help_text("nombr"))
If you want to add a new boot option, you should also document it in the
data/anaconda_options.txt file so that it has an appropriate help text when
Anaconda is called with the --help option.
(Calling help_parser.help_text("nombr")) will make the help text parser
look for a paragraph starting with the "nombr" line in this file.)

>      ap.add_argument("--dnf", action="store_true", default=False,
>                      help=help_parser.help_text("dnf"))
>      ap.add_argument("--mpathfriendlynames", action="store_true",
>      default=True,
> @@ -1043,6 +1045,7 @@ if __name__ == "__main__":
>      flags.noverifyssl = opts.noverifyssl
>      flags.armPlatform = opts.armPlatform
>      flags.extlinux = opts.extlinux
> +    flags.nombr = opts.nombr
>      flags.dnf = opts.dnf
>      flags.mpathFriendlyNames = opts.mpathfriendlynames
>      flags.debug = opts.debug
> diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> index 509796e..5b233fc 100644
> --- a/pyanaconda/bootloader.py
> +++ b/pyanaconda/bootloader.py
> @@ -1588,6 +1588,12 @@ class GRUB2(GRUB):
>                  # This is hopefully a temporary hack. GRUB2 currently
>                  refuses
>                  # to install to a partition's boot block without --force.
>                  grub_args.insert(0, '--force')
> +            else:
> +                if flags.nombr:
> +                    grub_args.insert(0,'--grub-setup=/bin/true')
> +                    log.info("bootloader.py mbr update by grub2 disabled")
> +                else:
> +                    log.info("bootloader.py mbr will be updated for grub2")
>  
>              rc = iutil.execWithRedirect("grub2-install", grub_args,
>                                          root=iutil.getSysroot(),
> diff --git a/pyanaconda/flags.py b/pyanaconda/flags.py
> index 5403f75..49393aa 100644
> --- a/pyanaconda/flags.py
> +++ b/pyanaconda/flags.py
> @@ -61,6 +61,7 @@ class Flags(object):
>          self.askmethod = False
>          self.eject = True
>          self.extlinux = False
> +        self.nombr = False
>          self.gpt = False
>          self.leavebootorder = False
>          self.testing = False
> @@ -78,6 +79,7 @@ class Flags(object):
>  
>      def read_cmdline(self):
>          for f in ("selinux", "debug", "leavebootorder", "testing",
>          "extlinux",
> +                  "nombr",
>                    "gpt", "dnf"):
>              self.set_cmdline_bool(f)
>  
> --
> 1.9.3
> 
> _______________________________________________
> 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