Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

repack-freebsd-iso

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 .iso or .iso.xz file

The script writes the resulting image to new.iso.

What It Adds

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.

Repository Layout

.
|-- 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

Prerequisites

The script assumes the following tools are available:

  • sh
  • realpath
  • file
  • xz
  • tar
  • awk
  • fetch
  • sha512sum
  • isoinfo
  • growisofs

On most systems, isoinfo and growisofs come from cdrtools/dvd+rw-tools or equivalent packages.

Usage

Repack a local image

./repack.sh FreeBSD-15.1-RELEASE-amd64-dvd1.iso.xz

You can also pass an uncompressed .iso:

./repack.sh /path/to/FreeBSD-15.1-RELEASE-amd64-dvd1.iso

Download and repack a release image

./repack.sh -d

The 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 dvd1

Supported values are defined directly in the script:

  • machines: amd64, arm64, powerpc, riscv
  • variants:
    • amd64: bootonly, disc1, dvd1
    • arm64: bootonly, disc1, dvd1
    • powerpc: bootonly, disc1
    • riscv: bootonly, disc1

Custom Content

Installer config

If installerconfig.txt exists and is non-empty, the script tries to graft an installer configuration file into the ISO.

Custom distribution set

If files/custom.mtree exists and is non-empty, the script runs:

tar -cpf - @files/custom.mtree | xz --compress --stdout > custom.txz

and 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.

Output Files

Running the script may create:

  • new.iso - repacked installer image
  • custom.txz - temporary custom distribution archive

The original input image is not modified.

License

MIT License. See LICENSE for the full text.

About

Script to add new files on top of a FreeBSD installation ISO using an additional session.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages