From f640a2faabd0f25489ce1969e118cebb8e52336e Mon Sep 17 00:00:00 2001 From: Will Woods Date: Wed, 12 Oct 2011 20:08:31 -0400 Subject: [PATCH] Use a predictable ISO Volume Label (#732298) New images find their root device by looking at the CDLABEL. Since pungi is building ISO images separately from lorax, if it uses a different ISO Volume Label we'll end up with unbootable images. This changes the volume labels to match what pungi uses, so both should boot OK. --- share/efi.tmpl | 2 +- share/ppc.tmpl | 6 +++--- share/sparc.tmpl | 6 +++--- share/x86.tmpl | 6 +++--- src/pylorax/treebuilder.py | 5 ++++- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/share/efi.tmpl b/share/efi.tmpl index 1c0c892c..5ff9397b 100644 --- a/share/efi.tmpl +++ b/share/efi.tmpl @@ -36,7 +36,7 @@ ${make_efiboot("images/efidisk.img", include_kernel=True, disk=True)} replace @ROOT@ root=live:LABEL=ANACONDA ${eficonf} %else: ## NOTE: this needs to match the boot.iso label (see x86.tmpl) - replace @ROOT@ root=live:CDLABEL=${udev_escape(product.name)} ${eficonf} + replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${eficonf} %endif %if efiarch == 'IA32': copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf diff --git a/share/ppc.tmpl b/share/ppc.tmpl index 2c487917..0bb07a71 100644 --- a/share/ppc.tmpl +++ b/share/ppc.tmpl @@ -1,4 +1,4 @@ -<%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product"/> +<%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel"/> <% configdir="tmp/config_files" BOOTDIR="ppc" @@ -68,14 +68,14 @@ mkdir etc install ${configdir}/yaboot.conf.3264 etc/yaboot.conf replace @PRODUCT@ ${product.name} etc/yaboot.conf replace @VERSION@ ${product.version} etc/yaboot.conf - replace @ROOT@ root=live:CDLABEL=PBOOT etc/yaboot.conf + replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' etc/yaboot.conf %else: copy ${KERNELDIR}/yaboot.conf etc/yaboot.conf %endif runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ ${prepboot} -part -hfs -T -r -l -J \ - -A "${product.name} ${product.version}" -sysid PPC -V PBOOT \ + -A "${product.name} ${product.version}" -sysid PPC -V '${isolabel}' \ -volset "${product.version}" -volset-size 1 -volset-seqno 1 \ -hfs-volid ${product.version} -hfs-bless ${outroot}/${MACDIR} \ -map ${inroot}/${configdir}/mapping \ diff --git a/share/sparc.tmpl b/share/sparc.tmpl index a58f18e4..307625b0 100644 --- a/share/sparc.tmpl +++ b/share/sparc.tmpl @@ -1,4 +1,4 @@ -<%page args="kernels, runtime_img, basearch, outroot, product"/> +<%page args="kernels, runtime_img, basearch, outroot, product, isolabel"/> <% configdir="tmp/config_files" BOOTDIR="boot" @@ -20,10 +20,10 @@ replace @PRODUCT@ ${product.name} ${BOOTDIR}/boot.msg installinitrd images-${basearch} ${kernel.initrd.path} ${BOOTDIR}/initrd.img %endfor -replace @ROOT@ root=live:CDLABEL=PBOOT ${BOOTDIR}/silo.conf +replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/silo.conf runcmd mkisofs -R -J -T -G /${BOOTDIR}/isofs.b -B ... \ - -s /${BOOTDIR}/silo.conf -r -V "PBOOT" \ + -s /${BOOTDIR}/silo.conf -r -V '${isolabel}' \ -A "${product.name} ${product.version}" \ -x Fedora -x repodata \ -sparc-label "${product.name} ${product.version} Boot Disc" \ diff --git a/share/x86.tmpl b/share/x86.tmpl index 298fa6cb..3d03755f 100644 --- a/share/x86.tmpl +++ b/share/x86.tmpl @@ -1,4 +1,4 @@ -<%page args="kernels, runtime_img, basearch, outroot, product"/> +<%page args="kernels, runtime_img, basearch, outroot, product, isolabel"/> <% configdir="tmp/config_files" SYSLINUXDIR="usr/share/syslinux" @@ -21,7 +21,7 @@ install ${configdir}/grub.conf ${BOOTDIR} replace @VERSION@ ${product.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg replace @PRODUCT@ ${product.name} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg -replace @ROOT@ 'root=live:CDLABEL=${udev_escape(product.name)}' ${BOOTDIR}/isolinux.cfg +replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg %if exists("boot/memtest*"): install boot/memtest* ${BOOTDIR} @@ -64,7 +64,7 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} runcmd mkisofs -o ${outroot}/images/boot.iso \ -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ -boot-load-size 4 -boot-info-table -no-emul-boot \ - ${efiargs} -R -J -V '${product.name}' -T -graft-points \ + ${efiargs} -R -J -V '${isolabel}' -T -graft-points \ ${BOOTDIR}=${outroot}/${BOOTDIR} \ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ${LIVEDIR}=${outroot}/${LIVEDIR} \ diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index b66e1043..4258a42b 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -142,12 +142,15 @@ 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, templatedir=None): + # NOTE: if you change isolabel, you need to change pungi to match, or + # the pungi images won't boot. + isolabel = "{0.name} {0.version} {1.basearch}".format(product, arch) # 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, inroot=inroot, outroot=outroot, basearch=arch.basearch, libdir=arch.libdir, - udev_escape=udev_escape) + isolabel=isolabel, udev=udev_escape) self._runner = LoraxTemplateRunner(inroot, outroot, templatedir=templatedir) self._runner.defaults = self.vars