Small helper repository for building a customized FreeBSD installer ISO by grafting extra content into an existing FreeBSD release image.
The project currently consists of a single script, repack.sh,
which can either:
- download a FreeBSD release ISO image, verify its SHA-512 checksum, and repack it
- repack a local
.isoor.iso.xzfile
The script writes the resulting image to new.iso.
repack.sh appends a new ISO session with one or both of these payloads:
/etc/installerconfig/usr/freebsd-dist/custom.txz
The second payload is generated from files listed in files/custom.mtree.
/usr/freebsd-dist is not an arbitrary choice: it's bsdinstall's default
BSDINSTALL_DISTDIR, the directory it scans for distribution sets
(base.txz, kernel.txz, etc.) to extract. Grafting custom.txz there is
what makes the installer pick it up as one more distribution set alongside
the stock ones.
If neither payload is present, the script exits with ERROR: Nothing to graft.
See docs/multisession-iso.md for why
growisofs -M -graft-points can do this without rewriting the original
image's file data, and how far the same trick carries to other OS installers.
.
|-- repack.sh
|-- files/
| `-- custom.mtree # optional; list of files to package into custom.txz
|-- installerconfig.txt # optional; checked by the script
`-- new.iso # output image created by the script
The script assumes the following tools are available:
shrealpathfilexztarawkfetchsha512sumisoinfogrowisofs
On most systems, isoinfo and growisofs come from cdrtools/dvd+rw-tools
or equivalent packages.
./repack.sh FreeBSD-15.1-RELEASE-amd64-dvd1.iso.xzYou can also pass an uncompressed .iso:
./repack.sh /path/to/FreeBSD-15.1-RELEASE-amd64-dvd1.iso./repack.sh -dThe default download target is:
- release:
15.1 - machine:
amd64 - variant:
dvd1
You can override them:
./repack.sh -d -r 15.1 -m arm64 -a aarch64 -t dvd1Supported values are defined directly in the script:
- machines:
amd64,arm64,powerpc,riscv - variants:
amd64:bootonly,disc1,dvd1arm64:bootonly,disc1,dvd1powerpc:bootonly,disc1riscv:bootonly,disc1
If installerconfig.txt exists and is non-empty, the script tries to graft an
installer configuration file into the ISO.
If files/custom.mtree exists and is non-empty, the script runs:
tar -cpf - @files/custom.mtree | xz --compress --stdout > custom.txzand then grafts the resulting archive into the image as a custom distribution set.
This is useful when you want to preload site-specific files into the installer media and extract them during installation.
Running the script may create:
new.iso- repacked installer imagecustom.txz- temporary custom distribution archive
The original input image is not modified.
MIT License. See LICENSE for the full text.