Skip to content

hackagadget/repack-freebsd-iso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 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/freeebsd-dist/custom.txz

The second payload is generated from files listed in files/custom.mtree.

If neither payload is present, the script exits with ERROR: Nothing to graft.

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.

Caveats

The current script has a couple of naming inconsistencies worth knowing before you rely on it:

  • it checks for installerconfig.txt but grafts installerconf.txt
  • it writes the custom archive to /usr/freeebsd-dist/custom.txz inside the ISO

Those strings are documented here because they reflect the script as it exists today.

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages