From 96b4e257892d4695b5ffe61ddf0e3586acf5de2f Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Nov 15 2018 13:10:21 +0000 Subject: Don't write /boot/grub/grub.conf if bootloader is disabled If user explicitly disabled bootloader then we don't need to write /boot/grub/grub.conf. The bootloader is external to disk image (i.e. built outside of distribution) Note: - --location=none simply disables bootloader installation - --disabled disables bootloader installation and also disables installation of the bootloader package We check for both being present, but we could probably relax it to just --disabled. Signed-off-by: David Abdurachmanov --- diff --git a/appcreate/appliance.py b/appcreate/appliance.py index 812fbd9..42a3164 100644 --- a/appcreate/appliance.py +++ b/appcreate/appliance.py @@ -520,9 +520,12 @@ class ApplianceImageCreator(ImageCreator): def _create_bootconfig(self): logging.debug("Writing kickstart file.") self._write_kickstart() - # For EC2 lets always make a grub Legacy config file - logging.debug("Writing GRUB Legacy config.") - self._create_grub_config() + # For EC2 lets make a grub Legacy config file + # (only if bootloader is enabled) + if ((hasattr(self.ks.handler.bootloader, "disabled") and self.ks.handler.bootloader.disabled is False) and + (hasattr(self.ks.handler.bootloader, "location") and self.ks.handler.bootloader.location != "none")): + logging.debug("Writing GRUB Legacy config.") + self._create_grub_config() if self.bootloader == 'grub2': # We have GRUB2 package installed