#!/bin/sh # # Create a bootable LiveCD # # Copyright 2003 bzerk.org # # This script will create a bootable cdrom image. Requirements: # - FreeBSD 5.0 or later (we want to use devfs) # - Around 500 MB diskspace in DESTDIR and ISODIR (together) # - mkisofs (port or package) # # First we define some variables DESTDIR=/usr/build/LiveCD ISODIR=/usr/build/iso SRCDIR=/usr/src PATH=/bin:/usr/bin:/usr/local/bin # Check the requirements if [ "`grep 'define __FreeBSD_version' /usr/include/sys/param.h |\ awk '{print $3}'`" -lt "500000" ]; then echo "FreeBSD version must be >= 5.0" exit fi export DESTDIR PATH mkdir -p ${DESTDIR} ${ISODIR} # Now we build and install the base system in DESTDIR cd ${SRCDIR} /usr/bin/make world && \ /usr/bin/make kernel if [ $? -ne 0 ]; then echo "Problem building world/kernel" exit fi # Then we install all config files etc. cd ${SRCDIR}/etc /usr/bin/make distribution # We now have a complete FreeBSD installation in DESTDIR. Since this # will be booted from cdrom (read-only) we have to tweak things a # little or the LiveCD will not be very usable. # Here, I have chosen to replace /var and /etc by writable (memory) # filesystems. To accomplish this, we tweak the /etc/rc boot script # a little: cd ${DESTDIR} patch <${DESTDIR}/etc/rc.conf <${DESTDIR}/etc/fstab <