From c91278a17d34b92d3bd549b5ff862e7375c21975 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 9 Mar 2017 11:18:08 -0800 Subject: [PATCH] livemedia-creator: Add release license files to / of the iso This used to be handled by a %post section of the kickstart, but that won't work with lmc, so do it in the template instead. --- share/templates.d/99-generic/live/arm.tmpl | 7 +++++++ share/templates.d/99-generic/live/ppc.tmpl | 14 +++++++++++--- share/templates.d/99-generic/live/s390.tmpl | 12 ++++++++++-- share/templates.d/99-generic/live/x86.tmpl | 12 +++++++++--- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/share/templates.d/99-generic/live/arm.tmpl b/share/templates.d/99-generic/live/arm.tmpl index 34895691..30f12223 100644 --- a/share/templates.d/99-generic/live/arm.tmpl +++ b/share/templates.d/99-generic/live/arm.tmpl @@ -6,6 +6,8 @@ BOOTDIR="boot" KERNELDIR=PXEBOOTDIR LIVEDIR="LiveOS" LORAXDIR="usr/share/lorax/" + +from os.path import basename %> mkdir ${LIVEDIR} @@ -41,5 +43,10 @@ mkdir ${KERNELDIR} %endif %endfor +# Add the license files +%for f in glob("/usr/share/licenses/*-release/*"): + install ${f} ${f|basename} +%endfor + ## FIXME: ARM may need some extra boot config diff --git a/share/templates.d/99-generic/live/ppc.tmpl b/share/templates.d/99-generic/live/ppc.tmpl index 5504539b..3923f472 100644 --- a/share/templates.d/99-generic/live/ppc.tmpl +++ b/share/templates.d/99-generic/live/ppc.tmpl @@ -18,6 +18,8 @@ prepboot = "" ## Instead we'll just replace any non-ASCII characters in the isolabel ## with '_', which means we won't need any udev escapes. isolabel = ''.join(ch if ch.isalnum() else '_' for ch in isolabel) + +from os.path import basename %> ## Test ${runtime_img} to see if udf is needed @@ -90,15 +92,21 @@ install ${configdir}/mapping ${BOOTDIR} %endfor # Create optional product.img and updates.img -<% imggraft=""; images=["product", "updates"] %> +<% filegraft=""; images=["product", "updates"] %> %for img in images: %if exists("%s/%s/" % (LORAXDIR, img)): installimg ${LORAXDIR}/${img}/ images/${img}.img treeinfo images-${basearch} ${img}.img images/${img}.img - <% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> + <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> %endif %endfor +# Add the license files +%for f in glob("/usr/share/licenses/*-release/*"): + install ${f} ${f|basename} + <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> +%endfor + ## make boot.iso runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ ${prepboot} -part -hfs -T -r -l -J \ @@ -111,7 +119,7 @@ runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ ${BOOTDIR}=${outroot}/${BOOTDIR} \ ${GRUBDIR}=${outroot}/${GRUBDIR} \ ${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \ - ${LIVEDIR}=${outroot}/${LIVEDIR} ${imggraft} + ${LIVEDIR}=${outroot}/${LIVEDIR} ${filegraft} %for kernel in kernels: treeinfo images-${kernel.arch} boot.iso images/boot.iso diff --git a/share/templates.d/99-generic/live/s390.tmpl b/share/templates.d/99-generic/live/s390.tmpl index 391fc2a5..39a7672d 100644 --- a/share/templates.d/99-generic/live/s390.tmpl +++ b/share/templates.d/99-generic/live/s390.tmpl @@ -7,6 +7,8 @@ INITRD_ADDRESS="0x02000000" LORAXDIR="usr/share/lorax/" # The assumption seems to be that there is only one s390 kernel, ever kernel = kernels[0] + +from os.path import basename %> mkdir images @@ -34,11 +36,17 @@ treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm treeinfo images-${basearch} generic.ins generic.ins # Create optional product.img and updates.img -<% imggraft=""; images=["product", "updates"] %> +<% filegraft=""; images=["product", "updates"] %> %for img in images: %if exists("%s/%s/" % (LORAXDIR, img)): installimg ${LORAXDIR}/${img}/ images/${img}.img treeinfo images-${basearch} ${img}.img images/${img}.img - <% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> + <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> %endif %endfor + +# Add the license files +%for f in glob("/usr/share/licenses/*-release/*"): + install ${f} ${f|basename} + <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> +%endfor diff --git a/share/templates.d/99-generic/live/x86.tmpl b/share/templates.d/99-generic/live/x86.tmpl index 04e4c9e2..33a95c54 100644 --- a/share/templates.d/99-generic/live/x86.tmpl +++ b/share/templates.d/99-generic/live/x86.tmpl @@ -91,7 +91,7 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} %endif # Create optional product.img and updates.img -<% imggraft=""; images=["product", "updates"]; compressargs=None; %> +<% filegraft=""; images=["product", "updates"]; compressargs=None; %> %if basearch == 'i386': # Limit the amount of memory xz uses on i386 <% compressargs="--xz -9 --memlimit-compress=3700MiB" %> @@ -100,10 +100,16 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} %if exists("%s/%s/" % (LORAXDIR, img)): installimg ${compressargs} ${LORAXDIR}/${img}/ images/${img}.img treeinfo images-${basearch} ${img}.img images/${img}.img - <% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> + <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> %endif %endfor +# Add the license files +%for f in glob("/usr/share/licenses/*-release/*"): + install ${f} ${f|basename} + <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> +%endfor + ## make boot.iso runcmd mkisofs -o ${outroot}/images/boot.iso \ -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ @@ -113,6 +119,6 @@ runcmd mkisofs -o ${outroot}/images/boot.iso \ ${BOOTDIR}=${outroot}/${BOOTDIR} \ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ${LIVEDIR}=${outroot}/${LIVEDIR} \ - ${efigraft} ${imggraft} + ${efigraft} ${filegraft} runcmd isohybrid ${efihybrid} ${outroot}/images/boot.iso treeinfo images-${basearch} boot.iso images/boot.iso