From: "Brian C. Lane" <bcl@xxxxxxxxxx> Adds writetreeinfo DEST command to template parser and uses it in the x86, ppc and sparc templates to write .treeinfo to the boot.iso to make it easier to find the stage2 root filesystem image. --- share/ppc.tmpl | 7 ++++++- share/sparc.tmpl | 8 +++++++- share/x86.tmpl | 8 +++++++- src/pylorax/__init__.py | 2 +- src/pylorax/ltmpl.py | 14 ++++++++++++++ 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/share/ppc.tmpl b/share/ppc.tmpl index 7433afd..3c48b22 100644 --- a/share/ppc.tmpl +++ b/share/ppc.tmpl @@ -95,6 +95,9 @@ mkdir etc copy ${KERNELDIR}/yaboot.conf etc/yaboot.conf %endif +## Write a .treeinfo for the boot.iso +writetreeinfo .treeinfo + ## make boot.iso runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ ${prepboot} -part -hfs -T -r -l -J \ @@ -106,8 +109,10 @@ runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ etc=${outroot}/etc \ ${BOOTDIR}=${outroot}/${BOOTDIR} \ ${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \ - ${LIVEDIR}=${outroot}/${LIVEDIR} + ${LIVEDIR}=${outroot}/${LIVEDIR} \ + .treeinfo=${outroot}/.treeinfo +## This will be written to .treeinfo by Lorax %for kernel in kernels: treeinfo images-${kernel.arch} boot.iso images/boot.iso %endfor diff --git a/share/sparc.tmpl b/share/sparc.tmpl index cfdb04e..b3d6486 100644 --- a/share/sparc.tmpl +++ b/share/sparc.tmpl @@ -26,6 +26,9 @@ replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/silo.conf installinitrd images-${basearch} ${kernel.initrd.path} ${BOOTDIR}/initrd.img %endfor +## Write a .treeinfo for the boot.iso +writetreeinfo .treeinfo + ## make boot.iso runcmd mkisofs -R -J -T -G /${BOOTDIR}/isofs.b -B ... \ -s /${BOOTDIR}/silo.conf -r -V '${isolabel}' \ @@ -34,5 +37,8 @@ runcmd mkisofs -R -J -T -G /${BOOTDIR}/isofs.b -B ... \ -sparc-label "${product.name} ${product.version} Boot Disc" \ -o ${outroot}/images/boot.iso \ -graft-points ${BOOTDIR}=${outroot}/${BOOTDIR} \ - ${LIVEDIR}=${outroot}/${LIVEDIR} + ${LIVEDIR}=${outroot}/${LIVEDIR} \ + .treeinfo=${outroot}/.treeinfo + +## This will be written to .treeinfo by Lorax treeinfo images-${basearch} boot.iso images/boot.iso diff --git a/share/x86.tmpl b/share/x86.tmpl index 2dd74ad..0769300 100644 --- a/share/x86.tmpl +++ b/share/x86.tmpl @@ -61,6 +61,9 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch"/> %endif +## Write a .treeinfo for the boot.iso +writetreeinfo .treeinfo + ## make boot.iso runcmd mkisofs -o ${outroot}/images/boot.iso \ -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ @@ -69,6 +72,9 @@ runcmd mkisofs -o ${outroot}/images/boot.iso \ ${BOOTDIR}=${outroot}/${BOOTDIR} \ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ${LIVEDIR}=${outroot}/${LIVEDIR} \ - ${efigraft} + ${efigraft} \ + .treeinfo=${outroot}/.treeinfo runcmd isohybrid ${efihybrid} ${outroot}/images/boot.iso + +## This will be written to .treeinfo by Lorax treeinfo images-${basearch} boot.iso images/boot.iso diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 8ae3077..242a7b2 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -240,7 +240,7 @@ class Lorax(BaseLoraxClass): logger.info("populating output tree and building boot images") treebuilder.build() - # write .treeinfo file and we're done + # write new .treeinfo file with updated info about boot.iso treeinfo = TreeInfo(self.product.name, self.product.version, self.product.variant, self.arch.basearch) for section, data in treebuilder.treeinfo_data.items(): diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index 92eac34..cce7c04 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -35,6 +35,7 @@ from mako.lookup import TemplateLookup from mako.exceptions import text_error_template import sys, traceback import struct +from treeinfo import TreeInfo class LoraxTemplate(object): def __init__(self, directories=["/usr/share/lorax"]): @@ -243,6 +244,19 @@ class LoraxTemplateRunner(object): self.results.treeinfo[section] = dict() self.results.treeinfo[section][key] = " ".join(valuetoks) + def writetreeinfo(self, dest): + ''' + writetreeinfo DEST + Write the .treeinfo file to DEST + ''' + treeinfo = TreeInfo(self.defaults.product.name, + self.defaults.product.version, + self.defaults.product.variant, + self.defaults.arch.basearch) + for section, data in self.results.treeinfo.items(): + treeinfo.add_section(section, data) + treeinfo.write(self._out(dest)) + def installkernel(self, section, src, dest): ''' installkernel SECTION SRC DEST -- 1.7.7.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list