Update templates to use installimg for product and updates

With these templates if a package has installed files in
/usr/share/lorax/product or /usr/share/lorax/updates/ they will be used
to create product.img and/or updates.img which will be included in the
images/ directory of the iso and of the final output tree.

These can be used to customize the installation environment or provide
updates. See README.product for current documentation.
This commit is contained in:
Brian C. Lane 2014-11-04 19:07:57 -08:00
parent b064ae6166
commit ac6e4a29c3
9 changed files with 89 additions and 7 deletions

18
README.product Normal file
View File

@ -0,0 +1,18 @@
Lorax now supports creation of product.img and updates.img as part of the build
process. This is implemented using the installimg command which will take the
contents of a directory and create a compressed archive from it. The x86, ppc,
ppc64le and aarch64 templates all look for /usr/share/lorax/product/ and
/usr/share/lorax/updates/ directories while creating the final install tree. If
there are files in those directories lorax will create images/product.img
and/or images/updates.img
These archives are just like an anaconda updates image -- they are copied over
the top of the filesystem at boot time so that you can drop in files to add to
or replace anything on the filesystem.
Anaconda has several places that it looks for updates, the one for product.img
is in /run/install/product. For example, to add an installclass to Anaconda
you would put your custom class here:
/usr/share/lorax/product/run/install/product/pyanaconda/installclasses/custom.py

View File

@ -86,7 +86,7 @@ make DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} install
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc COPYING AUTHORS README.livemedia-creator %doc COPYING AUTHORS README.livemedia-creator README.product
%doc docs/*ks %doc docs/*ks
%{python_sitelib}/pylorax %{python_sitelib}/pylorax
%{python_sitelib}/*.egg-info %{python_sitelib}/*.egg-info

View File

@ -4,6 +4,7 @@ configdir="tmp/config_files/aarch64"
PXEBOOTDIR="images/pxeboot" PXEBOOTDIR="images/pxeboot"
KERNELDIR=PXEBOOTDIR KERNELDIR=PXEBOOTDIR
LIVEDIR="LiveOS" LIVEDIR="LiveOS"
LORAXDIR="usr/share/lorax/"
%> %>
mkdir ${LIVEDIR} mkdir ${LIVEDIR}
@ -37,3 +38,12 @@ mkdir ${KERNELDIR}
<%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/> <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/>
%endif %endif
# Create optional product.img and updates.img
<% imggraft=""; images=["product", "updates"] %>
%for img in images:
%if exists("%s/%s/" % (LORAXDIR, img)):
installimg ${LORAXDIR}/${img}/ images/${img}.img
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
%endif
%endfor

View File

@ -6,6 +6,7 @@ GRUBDIR="boot/grub"
LIVEDIR="LiveOS" LIVEDIR="LiveOS"
MACDIR=BOOTDIR+"/mac" MACDIR=BOOTDIR+"/mac"
NETBOOTDIR="images/netboot" NETBOOTDIR="images/netboot"
LORAXDIR="usr/share/lorax/"
WRAPPER="usr/sbin/wrapper" WRAPPER="usr/sbin/wrapper"
WRAPPER_DATA="usr/"+libdir+"/kernel-wrapper" WRAPPER_DATA="usr/"+libdir+"/kernel-wrapper"
@ -80,6 +81,15 @@ install ${configdir}/magic ${BOOTDIR}
%endif %endif
%endfor %endfor
# Create optional product.img and updates.img
<% imggraft=""; images=["product", "updates"] %>
%for img in images:
%if exists("%s/%s/" % (LORAXDIR, img)):
installimg ${LORAXDIR}/${img}/ images/${img}.img
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
%endif
%endfor
## make boot.iso ## make boot.iso
runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \
${prepboot} -part -hfs -T -r -l -J \ ${prepboot} -part -hfs -T -r -l -J \
@ -91,7 +101,7 @@ runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \
${BOOTDIR}=${outroot}/${BOOTDIR} \ ${BOOTDIR}=${outroot}/${BOOTDIR} \
${GRUBDIR}=${outroot}/${GRUBDIR} \ ${GRUBDIR}=${outroot}/${GRUBDIR} \
${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \ ${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \
${LIVEDIR}=${outroot}/${LIVEDIR} ${LIVEDIR}=${outroot}/${LIVEDIR} ${imggraft}
%for kernel in kernels: %for kernel in kernels:
treeinfo images-${kernel.arch} boot.iso images/boot.iso treeinfo images-${kernel.arch} boot.iso images/boot.iso

View File

@ -6,6 +6,7 @@ PXEBOOTDIR="images/pxeboot"
BOOTDIR="isolinux" BOOTDIR="isolinux"
KERNELDIR=PXEBOOTDIR KERNELDIR=PXEBOOTDIR
LIVEDIR="LiveOS" LIVEDIR="LiveOS"
LORAXDIR="usr/share/lorax/"
## Don't allow spaces or escape characters in the iso label ## Don't allow spaces or escape characters in the iso label
def valid_label(ch): def valid_label(ch):
@ -73,6 +74,15 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
<%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/> <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/>
%endif %endif
# Create optional product.img and updates.img
<% imggraft=""; images=["product", "updates"] %>
%for img in images:
%if exists("%s/%s/" % (LORAXDIR, img)):
installimg ${LORAXDIR}/${img}/ images/${img}.img
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
%endif
%endfor
## make boot.iso ## make boot.iso
runcmd mkisofs -o ${outroot}/images/boot.iso \ runcmd mkisofs -o ${outroot}/images/boot.iso \
-b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \
@ -81,6 +91,6 @@ runcmd mkisofs -o ${outroot}/images/boot.iso \
${BOOTDIR}=${outroot}/${BOOTDIR} \ ${BOOTDIR}=${outroot}/${BOOTDIR} \
${KERNELDIR}=${outroot}/${KERNELDIR} \ ${KERNELDIR}=${outroot}/${KERNELDIR} \
${LIVEDIR}=${outroot}/${LIVEDIR} \ ${LIVEDIR}=${outroot}/${LIVEDIR} \
${efigraft} ${efigraft} ${imggraft}
runcmd isohybrid ${efihybrid} ${outroot}/images/boot.iso runcmd isohybrid ${efihybrid} ${outroot}/images/boot.iso
treeinfo images-${basearch} boot.iso images/boot.iso treeinfo images-${basearch} boot.iso images/boot.iso

View File

@ -6,6 +6,7 @@ GRUBDIR="boot/grub"
LIVEDIR="LiveOS" LIVEDIR="LiveOS"
MACDIR=GRUBDIR+"/powerpc-ieee1275" MACDIR=GRUBDIR+"/powerpc-ieee1275"
NETBOOTDIR="images/netboot" NETBOOTDIR="images/netboot"
LORAXDIR="usr/share/lorax/"
WRAPPER="usr/sbin/wrapper" WRAPPER="usr/sbin/wrapper"
WRAPPER_DATA="usr/"+libdir+"/kernel-wrapper" WRAPPER_DATA="usr/"+libdir+"/kernel-wrapper"
@ -88,6 +89,15 @@ install ${configdir}/magic ${BOOTDIR}
%endif %endif
%endfor %endfor
# Create optional product.img and updates.img
<% imggraft=""; images=["product", "updates"] %>
%for img in images:
%if exists("%s/%s/" % (LORAXDIR, img)):
installimg ${LORAXDIR}/${img}/ images/${img}.img
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
%endif
%endfor
## make boot.iso ## make boot.iso
runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \
${prepboot} -part -hfs -T -r -l -J \ ${prepboot} -part -hfs -T -r -l -J \
@ -99,7 +109,8 @@ runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \
${BOOTDIR}=${outroot}/${BOOTDIR} \ ${BOOTDIR}=${outroot}/${BOOTDIR} \
${GRUBDIR}=${outroot}/${GRUBDIR} \ ${GRUBDIR}=${outroot}/${GRUBDIR} \
${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \ ${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \
${LIVEDIR}=${outroot}/${LIVEDIR} ${LIVEDIR}=${outroot}/${LIVEDIR} ${imggraft}
%for kernel in kernels: %for kernel in kernels:
treeinfo images-${kernel.arch} boot.iso images/boot.iso treeinfo images-${kernel.arch} boot.iso images/boot.iso

View File

@ -4,6 +4,7 @@ configdir="tmp/config_files/ppc"
BOOTDIR="ppc" BOOTDIR="ppc"
GRUBDIR="boot/grub" GRUBDIR="boot/grub"
LIVEDIR="LiveOS" LIVEDIR="LiveOS"
LORAXDIR="usr/share/lorax/"
## NOTE: yaboot freaks out and stops parsing its config if it sees a '\', ## NOTE: yaboot freaks out and stops parsing its config if it sees a '\',
## so we can't use the udev escape sequences in the root arg. ## so we can't use the udev escape sequences in the root arg.
@ -63,8 +64,17 @@ install ${configdir}/magic ${BOOTDIR}
treeinfo images-${kernel.arch} zimage treeinfo images-${kernel.arch} zimage
%endfor %endfor
## make boot.iso
mkdir images/ mkdir images/
# Create optional product.img and updates.img
<% imggraft=""; images=["product", "updates"] %>
%for img in images:
%if exists("%s/%s/" % (LORAXDIR, img)):
installimg ${LORAXDIR}/${img}/ images/${img}.img
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
%endif
%endfor
## make boot.iso
runcmd mkisofs -v -U -J -R -T \ runcmd mkisofs -v -U -J -R -T \
-o ${outroot}/images/boot.iso \ -o ${outroot}/images/boot.iso \
-part -hfs -r -l -sysid PPC \ -part -hfs -r -l -sysid PPC \
@ -75,7 +85,7 @@ runcmd mkisofs -v -U -J -R -T \
-no-desktop -allow-multidot -graft-points \ -no-desktop -allow-multidot -graft-points \
${BOOTDIR}=${outroot}/${BOOTDIR} \ ${BOOTDIR}=${outroot}/${BOOTDIR} \
${GRUBDIR}=${outroot}/${GRUBDIR} \ ${GRUBDIR}=${outroot}/${GRUBDIR} \
${LIVEDIR}=${outroot}/${LIVEDIR} ${LIVEDIR}=${outroot}/${LIVEDIR} ${imggraft}
%for kernel in kernels: %for kernel in kernels:
treeinfo images-${kernel.arch} boot.iso images/boot.iso treeinfo images-${kernel.arch} boot.iso images/boot.iso

View File

@ -119,4 +119,7 @@ append etc/lvm/lvm.conf "global {\n\tuse_lvmetad = 1\n}\n"
## Record the package versions used to create the image ## Record the package versions used to create the image
runcmd chroot ${root} /bin/rpm -qa --pipe "tee /root/lorax-packages.log" runcmd chroot ${root} /bin/rpm -qa --pipe "tee /root/lorax-packages.log"
mkdir usr/share/lorax/product/run/install/product/pyanaconda/installclasses/
append usr/share/lorax/product/run/install/product/pyanaconda/installclasses/custom.py "import logging\nlog = logging.getLogger('anaconda')\nlog.info('bcl was here')\n"
## TODO: we could run prelink here if we wanted? ## TODO: we could run prelink here if we wanted?

View File

@ -6,6 +6,7 @@ PXEBOOTDIR="images/pxeboot"
BOOTDIR="isolinux" BOOTDIR="isolinux"
KERNELDIR=PXEBOOTDIR KERNELDIR=PXEBOOTDIR
LIVEDIR="LiveOS" LIVEDIR="LiveOS"
LORAXDIR="usr/share/lorax/"
## Don't allow spaces or escape characters in the iso label ## Don't allow spaces or escape characters in the iso label
def valid_label(ch): def valid_label(ch):
@ -87,6 +88,15 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
<%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/> <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/>
%endif %endif
# Create optional product.img and updates.img
<% imggraft=""; images=["product", "updates"] %>
%for img in images:
%if exists("%s/%s/" % (LORAXDIR, img)):
installimg ${LORAXDIR}/${img}/ images/${img}.img
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
%endif
%endfor
## make boot.iso ## make boot.iso
runcmd mkisofs -o ${outroot}/images/boot.iso \ runcmd mkisofs -o ${outroot}/images/boot.iso \
-b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \
@ -95,6 +105,6 @@ runcmd mkisofs -o ${outroot}/images/boot.iso \
${BOOTDIR}=${outroot}/${BOOTDIR} \ ${BOOTDIR}=${outroot}/${BOOTDIR} \
${KERNELDIR}=${outroot}/${KERNELDIR} \ ${KERNELDIR}=${outroot}/${KERNELDIR} \
${LIVEDIR}=${outroot}/${LIVEDIR} \ ${LIVEDIR}=${outroot}/${LIVEDIR} \
${efigraft} ${efigraft} ${imggraft}
runcmd isohybrid ${efihybrid} ${outroot}/images/boot.iso runcmd isohybrid ${efihybrid} ${outroot}/images/boot.iso
treeinfo images-${basearch} boot.iso images/boot.iso treeinfo images-${basearch} boot.iso images/boot.iso