Warning: This guide is valid as of Finnix 101. Finnix 100 and earlier used a substantially different filesystem layout, and will not work with this guide.
Finnix includes several options when it comes to customization: remastering, a startup shell script, and overlays. Remastering is described on its own page, and while this page will touch briefly on the startup shell script, overlays are the main focus.
Ripping and re-creating the ISO
Both options require the CD be copied to disk, modified, and the ISO re-created. This can be done a number of ways, but the easiest to explain would be in Finnix itself.
Most of the procedure is described in detail on the Remastering page, but if you are simply inserting boot scripts or overlays, the extraction of the compresed root filesystem is not necessary. In brief:
(finnix)# mkdir -p /srv/finnix/build/master (finnix)# cp -a /cdrom/* /srv/finnix/build/master/
You may now edit the CDROM layout via one of the methods below. Keep in mind that the methods below deal with paths relative to the root of the CDROM. /srv/finnix/build/master/ is the copied working root, so for example, /finnix/arch/indep/overlays/ would be /srv/finnix/build/master/finnix/arch/indep/overlays/.
Once you are finished, run finnix-build-stage2. Stage 1 is not used, since it deals with packaging up the compressed root. Again, since the packaged root has not been extracted or modified, it is left in place on the CDROM layout.
Startup shell scripts
The simplest way to modify Finnix is to create a file on the CD at /finnix/arch/indep/rc/yourname.sh. yourname.sh may be anything you choose, and there may be multiple scripts in this directory, which will be executed in alphanumeric order. Place any commands you wish to execute here, and they will be executed just before a shell is given in Finnix, after all other commands. The closest analogy is /etc/rc.local on Red Hat-based systems.
Overlays give you a great deal of flexibility. They allow you to create directory structures or loopback filesystems that are laid on top of the "default" Finnix filesystem. This gives you the most of the benefits of remastering Finnix, but without the complexity.
Location of overlays
Overlays are stored in /finnix/arch/indep/overlays/ on the CDROM. The contents of overlays/ may be either directories, or loopback image files.
The easiest way to create an overlay is to create a directory under /FINNIX/overlay.d and treat it as a root filesystem. Consider this directory layout:
When Finnix is run, the contents of /finnix/arch/indep/overlays/ will be placed on top of the root filesystem. When you are given a shell prompt, /usr/bin/foo and /etc/foo.conf will be visible to you. Multiple overlay directories can be created, and all will be laid on top of the root filesystem. The overlay directory name (myoverlay in this case) is simply an identifier, and has little meaning. The only reason to consider what to name the directory overlay is the fact that overlays are placed in alphanumeric order, so if /finnix/arch/indep/overlays/myoverlay/usr/bin/foo and /finnix/arch/indep/overlays/youroverlay/usr/bin/foo both exist, "youroverlay"'s version of foo will show up.
Since the CD filesystem is RockRidge, almost any type of file (symlinks, etc) can be placed. However, keep in mind:
- PowerPC's RockRidge implementation cannot have colons (:) in the filenames.
- Finnix can also be placed on a USB thumb drive, which must be on a VFAT filesystem, which has severe limitations.
Therefore, if you plan on doing anything fancy (such as symlinks to startup scripts), consider using the loopback image method below.
overlays/ may also contain files. While directories are treated as root filesystem overlays, files are treated as loopback images of root filesystem overlays. Therefore, you could take the above example and make a filesystem image out of it:
# mkisofs -r -o /srv/finnix/build/master/finnix/arch/indep/overlays/myoverlay.img \ /srv/finnix/build/master/finnix/arch/indep/overlays/myoverlay # rm -rf /srv/finnix/build/master/finnix/arch/indep/overlays/myoverlay
Finnix will mount the image loopback and proceed to overlay the directory structure as if it were a normal directory structure. The only difference is the source is a loopback filesystem of your choice, and you no longer have to worry about whether the Finnix CD is on VFAT or not.
A loopback filesystem can be:
- ISO9660 (mkisofs) (Recommended)
- SquashFS (mksquashfs) (Recommended, just as easy to use as mkisofs, but includes inline compression)
- VFAT (Not recommended)
- ext2 (ext3 may also be used, but journaling metadata will not be read)
In the examples above, everything is under /finnix/arch/indep/ on the CD. However, Finnix also has the ability for multiple architectures to be mastered on the same CD (outside the scope of this article). So if your overlays/scripts are architecture-specific, you may want to consider a directory below:
"x86" and "ppc" are specific to the userland of the running environment, not the kernel. Both x86 and PowerPC Finnix CDs include both 32-bit and 64-bit kernels, but presently Finnix is only distributed with 32-bit userlands, so "x86" and "ppc" should only be used for architecture-specific files. So even if a user boots an AMD64 kernel, "x86" will be the userland designation.
(If 64-bit userland versions of Finnix were ever developed, they would be in "amd64" and "ppc64".)