[PATCH] Always regenerate initramfs (#994180)

Vratislav Podzimek vpodzime at redhat.com
Mon Sep 9 07:45:08 UTC 2013


On Fri, 2013-09-06 at 09:55 -0700, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl at redhat.com>
> 
> dracut depends on some of the configuration settings we write out in
> doConfiguration so we need to always regenerate the initramfs for the
> system after we write these.
> 
> 
> -- I realized that livepayload was already doign this, and that the driver disk
> -- code does as well. I think this patch should cover all the cases.
> ---
>  pyanaconda/install.py               |  7 +++++--
>  pyanaconda/packaging/__init__.py    | 12 +++++++++---
>  pyanaconda/packaging/livepayload.py |  1 -
>  3 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/pyanaconda/install.py b/pyanaconda/install.py
> index ab00369..4b23016 100644
> --- a/pyanaconda/install.py
> +++ b/pyanaconda/install.py
> @@ -52,12 +52,12 @@ def _writeKS(ksdata):
>  def doConfiguration(storage, payload, ksdata, instClass):
>      from pyanaconda.kickstart import runPostScripts
>  
> -    step_count = 5
> +    step_count = 6
>      # if a realm was discovered,
>      # increment the counter as the
>      # real joining step will be executed
>      if ksdata.realm.discovered:
> -        step_count = 6
> +        step_count += 1
>      progressQ.send_init(step_count)
>  
>      # Now run the execute methods of ksdata that require an installed system
> @@ -89,6 +89,9 @@ def doConfiguration(storage, payload, ksdata, instClass):
>          ksdata.addons.execute(storage, ksdata, instClass, u)
>          ksdata.configured_spokes.execute(storage, ksdata, instClass, u)
>  
> +    with progress_report(_("Generating initramfs")):
> +        payload.recreateInitrds(force=True)
> +
>      if ksdata.realm.discovered:
>          with progress_report(_("Joining realm: %s") % ksdata.realm.discovered):
>              ksdata.realm.execute(storage, ksdata, instClass)
> diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
> index a90663d..2e266a2 100644
> --- a/pyanaconda/packaging/__init__.py
> +++ b/pyanaconda/packaging/__init__.py
> @@ -565,10 +565,16 @@ class Payload(object):
>                  # XXX TODO: real error handling, as this is probably going to
>                  #           prevent boot on some systems
>  
> -        if new_firmware:
> -            self._recreateInitrds()
> +    def recreateInitrds(self, force=False):
> +        """ Recreate the initrds by calling new-kernel-pkg
>  
> -    def _recreateInitrds(self, force=False):
> +            This needs to be done after all configuration files have been
> +            written, since dracut depends on some of them.
> +
> +            :param force: Always recreate, default is to only do it on first call
> +            :type force: bool
> +            :returns: None
> +        """
>          if not force and self._createdInitrds:
>              return
>  
> diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
> index d8cbbc8..0046f4f 100644
> --- a/pyanaconda/packaging/livepayload.py
> +++ b/pyanaconda/packaging/livepayload.py
> @@ -147,7 +147,6 @@ class LiveImagePayload(ImagePayload):
>          blivet.util.umount(INSTALL_TREE)
>  
>          super(LiveImagePayload, self).postInstall()
> -        self._recreateInitrds()
>  
>      @property
>      def spaceRequired(self):
Looks good to me.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list