+# NOTE (see also bootcd/build.sh)
+# If you run your own myplc instance, and you dont need to
+# customize the bootcd, you might wish to use bootcd/build.sh
+# with the -f option
+# However cdcustom.sh might turn out useful if
+# (*) you only have an iso image and nothing else
+# (*) or you want to generate several iso images in a single run
+# (*) or you run myplc rpm, but need to customize the bootcd image,
+# because the myplc rpm does not come with the required sources
+
+# given a (generic, node-independant) CD ISO image, and a (set of)
+# node-specific config file(s), this command creates a new almost
+# identical ISO image with the node config file embedded as
+# /usr/boot/plnode.txt in the overlay.img image
+# the output iso images are named after the nodes, and stored in .
+
+######## Logic
+# here is how we do this
+# for efficiency, we do only once:
+# (*) mount the generic iso
+# (*) copy it into a temp dir
+# (*) unzip/unarchive overlay image into another temp dir
+# then for each node, we
+# (*) insert plnode.txt at the right place
+# (*) rewrap a gzipped/cpio overlay.img, that we push onto the
+# copied iso tree
+# (*) rewrap this into an iso image
+# and cleanup/umount everything
+
+######## Customizing the BootCD
+# In addition we check (once) for
+# (*) a file called 'bootcd.img' in the current dir
+# (*) a directory named 'bootcd/' in the current dir
+# if any of those is present, we use this - presumably custom - stuff to
+# replace original bootcd.img from the CD
+# more precisely:
+# (*) if the .img is present, it is taken as-is,
+# (*) if not but bootcd/ is present, bootcd.img is refreshed and used
+# All this is done only once at startup because it typically
+# takes 40s to recompress bootcd.img
+# TODO
+# allow local bootcd/ to hold only patched files
+# and get the rest from the CD's bootcd.img
+
+######## Implementation note
+# in a former release it was possible to perform faster by
+# loopback-mounting the generic iso image
+# Unfortunately mkisofs cannot graft a file that already exists on the
+# original tree (so overlay.img cannot be overridden)
+# to make things worse we cannot loopback-mount the cpio-gzipped
+# overlay image either, so all this stuff is way more complicated
+# than it used to be.
+# It's still pretty fast, unless recompressing a bootcd.img is required