This patch is in response to RHBZ#886502.
Add the capability to suppress updating the MBR but still have the grub2 package installed and configured requires updating both the anaconda and pykickstart packages.
An updates.img was created with an update pykickstart included. Tested both nombr on the command line and --nombr as an option on kickstart's bootloader command. The test used Fedora 21 Alpha RC1 netinstall.
Gene Czarcinski (2): v1.2 add nombr to anaconda to suppress updating MBR add the --nombr bootloader option in pykickstart
anaconda | 3 +++ data/anaconda_options.txt | 8 ++++++++ pyanaconda/bootloader.py | 6 ++++++ pyanaconda/flags.py | 3 ++- pyanaconda/kickstart.py | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-)
pykickstart/commands/bootloader.py | 10 ++++++++-- tests/commands/bootloader.py | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
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.
Note: a separate patch to the pykickstart package add the --nombr option to kickstart's bootloader command. --- anaconda | 3 +++ data/anaconda_options.txt | 8 ++++++++ pyanaconda/bootloader.py | 6 ++++++ pyanaconda/flags.py | 3 ++- pyanaconda/kickstart.py | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-)
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")) 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/data/anaconda_options.txt b/data/anaconda_options.txt index a1e3143..12a10d9 100644 --- a/data/anaconda_options.txt +++ b/data/anaconda_options.txt @@ -215,6 +215,14 @@ Use extlinux as the bootloader. Note that there's no attempt to validate that this will work for your platform or anything; it assumes that if you ask for it, you want to try.
+nombr + +If nombr is specified the grub2 bootloader will be installed but the +MBR will not be updated. Therefore, when the system reboot, a previously +installed OS will be booted. /etc/grub.d/40_custom can be used with +manually created menuentrys which can use configfile to point to the +grub.cfg on the newly installed OS. + dnf Use the experimental DNF package management backend instead of the YUM backend that is used by default. For more information about the DNF project see: diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py index 7a22d92..440b2dd 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..55b4944 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,7 +79,7 @@ class Flags(object):
def read_cmdline(self): for f in ("selinux", "debug", "leavebootorder", "testing", "extlinux", - "gpt", "dnf"): + "nombr", "gpt", "dnf"): self.set_cmdline_bool(f)
if not selinux.is_selinux_enabled(): diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index fbce8a8..6a58f0c 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -381,6 +381,9 @@ class Bootloader(commands.bootloader.F21_Bootloader): if self.leavebootorder: flags.leavebootorder = True
+ if self.nombr: + flags.nombr = True + class BTRFS(commands.btrfs.F17_BTRFS): def execute(self, storage, ksdata, instClass): for b in self.btrfsList:
This patch is in response to RHBZ#886502.
Besides being a boot-time option, add the --nombr option for kickstart's bootloader command. If specified, then grub2 will be installed but the MBR will not be updated. --- pykickstart/commands/bootloader.py | 10 ++++++++-- tests/commands/bootloader.py | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/pykickstart/commands/bootloader.py b/pykickstart/commands/bootloader.py index 0d0523e..6e479ca 100644 --- a/pykickstart/commands/bootloader.py +++ b/pykickstart/commands/bootloader.py @@ -352,15 +352,21 @@ class F21_Bootloader(F19_Bootloader): F19_Bootloader.__init__(self, writePriority, *args, **kwargs)
self.disabled = kwargs.get("disabled", False) + self.nombr = kwargs.get("nombr", False)
def _getArgsAsStr(self): if self.disabled: return " --disabled" - else: - return F19_Bootloader._getArgsAsStr(self) + + ret = F19_Bootloader._getArgsAsStr(self) + if self.nombr: + ret += " --nombr" + return ret
def _getParser(self): op = F19_Bootloader._getParser(self) op.add_option("--disabled", dest="disabled", action="store_true", default=False) + op.add_option("--nombr", dest="nombr", action="store_true", + default=False) return op diff --git a/tests/commands/bootloader.py b/tests/commands/bootloader.py index 7c9378e..279f7f3 100644 --- a/tests/commands/bootloader.py +++ b/tests/commands/bootloader.py @@ -170,6 +170,7 @@ class F21_TestCase(F19_TestCase):
self.assert_parse("bootloader --disabled", "bootloader --disabled\n") self.assert_parse("bootloader --location=mbr --disabled", "bootloader --disabled\n") + self.assert_parse("bootloader --location=mbr --nombr", "bootloader --location=mbr --nombr\n")
if __name__ == "__main__":
On Wed, 2014-09-17 at 15:19 -0400, Gene Czarcinski wrote:
This patch is in response to RHBZ#886502.
Add the capability to suppress updating the MBR but still have the grub2 package installed and configured requires updating both the anaconda and pykickstart packages.
An updates.img was created with an update pykickstart included. Tested both nombr on the command line and --nombr as an option on kickstart's bootloader command. The test used Fedora 21 Alpha RC1 netinstall.
Gene Czarcinski (2): v1.2 add nombr to anaconda to suppress updating MBR add the --nombr bootloader option in pykickstart
anaconda | 3 +++ data/anaconda_options.txt | 8 ++++++++ pyanaconda/bootloader.py | 6 ++++++ pyanaconda/flags.py | 3 ++- pyanaconda/kickstart.py | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-)
pykickstart/commands/bootloader.py | 10 ++++++++-- tests/commands/bootloader.py | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
These both look good to me. If nobody comes with any concerns, I'm going to push them by the end of this week.
On 10/01/2014 07:23 AM, Vratislav Podzimek wrote:
On Wed, 2014-09-17 at 15:19 -0400, Gene Czarcinski wrote:
This patch is in response to RHBZ#886502.
Add the capability to suppress updating the MBR but still have the grub2 package installed and configured requires updating both the anaconda and pykickstart packages.
An updates.img was created with an update pykickstart included. Tested both nombr on the command line and --nombr as an option on kickstart's bootloader command. The test used Fedora 21 Alpha RC1 netinstall.
Gene Czarcinski (2): v1.2 add nombr to anaconda to suppress updating MBR add the --nombr bootloader option in pykickstart
anaconda | 3 +++ data/anaconda_options.txt | 8 ++++++++ pyanaconda/bootloader.py | 6 ++++++ pyanaconda/flags.py | 3 ++- pyanaconda/kickstart.py | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-)
pykickstart/commands/bootloader.py | 10 ++++++++-- tests/commands/bootloader.py | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
These both look good to me. If nobody comes with any concerns, I'm going to push them by the end of this week.
"ping" This still being pushed? I sure would like it to be in Fedora 21.
Gene
On Thu, 2014-10-09 at 14:03 -0400, Gene Czarcinski wrote:
On 10/01/2014 07:23 AM, Vratislav Podzimek wrote:
On Wed, 2014-09-17 at 15:19 -0400, Gene Czarcinski wrote:
This patch is in response to RHBZ#886502.
Add the capability to suppress updating the MBR but still have the grub2 package installed and configured requires updating both the anaconda and pykickstart packages.
An updates.img was created with an update pykickstart included. Tested both nombr on the command line and --nombr as an option on kickstart's bootloader command. The test used Fedora 21 Alpha RC1 netinstall.
Gene Czarcinski (2): v1.2 add nombr to anaconda to suppress updating MBR add the --nombr bootloader option in pykickstart
anaconda | 3 +++ data/anaconda_options.txt | 8 ++++++++ pyanaconda/bootloader.py | 6 ++++++ pyanaconda/flags.py | 3 ++- pyanaconda/kickstart.py | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-)
pykickstart/commands/bootloader.py | 10 ++++++++-- tests/commands/bootloader.py | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
These both look good to me. If nobody comes with any concerns, I'm going to push them by the end of this week.
"ping" This still being pushed? I sure would like it to be in Fedora 21.
Thanks for the reminder! I'm sorry it got off my anaconda-patches radar so I forgot to push these. Fixing now by pushing to master. Before pushing to f21-branch I need to ask clumens about pykickstart versioning on F21 (will do today).
anaconda-patches@lists.fedorahosted.org