[lorax] Only run installupgradeinitrd if upgrade

Martin Gracik mgracik at redhat.com
Tue Dec 18 13:32:43 UTC 2012


---
 share/arm.tmpl             |   12 ++++++++----
 share/ppc.tmpl             |    6 ++++--
 share/x86.tmpl             |    8 ++++++--
 src/pylorax/__init__.py    |    3 ++-
 src/pylorax/treebuilder.py |    4 ++--
 5 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/share/arm.tmpl b/share/arm.tmpl
index e99c92b..fdf5326 100644
--- a/share/arm.tmpl
+++ b/share/arm.tmpl
@@ -32,8 +32,10 @@ mkdir ${KERNELDIR}
         installkernel images-${kernel.flavor}-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
         installinitrd images-${kernel.flavor}-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
 
-        ## install upgrade image
-        installupgradeinitrd images-${kernel.flavor}-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img
+        %if doupgrade:
+            ## install upgrade image
+            installupgradeinitrd images-${kernel.flavor}-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img
+        %endif
 
         ## create U-Boot wrapped images
 
@@ -58,8 +60,10 @@ mkdir ${KERNELDIR}
         installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
         installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
 
-        ## install upgrade image
-        installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
+        %if doupgrade:
+            ## install upgrade image
+            installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
+        %endif
 
         ## create U-Boot wrapped images
 
diff --git a/share/ppc.tmpl b/share/ppc.tmpl
index 4eb0b0c..bbef5fa 100644
--- a/share/ppc.tmpl
+++ b/share/ppc.tmpl
@@ -66,8 +66,10 @@ install ${configdir}/magic ${BOOTDIR}
     installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz
     installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
 
-    ## upgrade image
-    installupgradeinitrd images-${kernel.arch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
+    %if doupgrade:
+        ## upgrade image
+        installupgradeinitrd images-${kernel.arch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
+    %endif
 
     ## install arch-specific bootloader config
     install ${configdir}/yaboot.conf.in  ${KERNELDIR}/yaboot.conf
diff --git a/share/x86.tmpl b/share/x86.tmpl
index 6e1f305..6412291 100644
--- a/share/x86.tmpl
+++ b/share/x86.tmpl
@@ -34,12 +34,16 @@ mkdir ${KERNELDIR}
         ## i386 PAE
         installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
         installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
-        installupgradeinitrd images-xen ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img
+        %if doupgrade:
+            installupgradeinitrd images-xen ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img
+        %endif
     %else:
         ## normal i386, x86_64
         installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
         installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
-        installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
+        %if doupgrade:
+            installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
+        %endif
     %endif
 %endfor
 
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 00db2c2..e1c0069 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -275,7 +275,8 @@ class Lorax(BaseLoraxClass):
         treebuilder = TreeBuilder(product=self.product, arch=self.arch,
                                   inroot=installroot, outroot=self.outputdir,
                                   runtime=runtime, isolabel=isolabel,
-                                  domacboot=domacboot, templatedir=templatedir)
+                                  domacboot=domacboot, doupgrade=doupgrade,
+                                  templatedir=templatedir)
 
         logger.info("rebuilding initramfs images")
         dracut_args = ["--xz", "--install", "/.buildstamp"]
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
index 17f2ae6..acd1a59 100644
--- a/src/pylorax/treebuilder.py
+++ b/src/pylorax/treebuilder.py
@@ -170,14 +170,14 @@ class RuntimeBuilder(object):
 class TreeBuilder(object):
     '''Builds the arch-specific boot images.
     inroot should be the installtree root (the newly-built runtime dir)'''
-    def __init__(self, product, arch, inroot, outroot, runtime, isolabel, domacboot=True, templatedir=None):
+    def __init__(self, product, arch, inroot, outroot, runtime, isolabel, domacboot=True, doupgrade=True, templatedir=None):
         # NOTE: if you pass an arg named "runtime" to a mako template it'll
         # clobber some mako internal variables - hence "runtime_img".
         self.vars = DataHolder(arch=arch, product=product, runtime_img=runtime,
                                runtime_base=basename(runtime),
                                inroot=inroot, outroot=outroot,
                                basearch=arch.basearch, libdir=arch.libdir,
-                               isolabel=isolabel, udev=udev_escape, domacboot=domacboot)
+                               isolabel=isolabel, udev=udev_escape, domacboot=domacboot, doupgrade=doupgrade)
         self._runner = LoraxTemplateRunner(inroot, outroot, templatedir=templatedir)
         self._runner.defaults = self.vars
         self.templatedir = templatedir
-- 
1.7.9.5



More information about the anaconda-patches mailing list