FreeBSD‘s release.sh is a shell script introduced in FreeBSD 9.x whose purpose is to automate FreeBSD release building from source. This post maps the release.sh into a table of variables and a flowchart describing the program flow and is based on release.sh as it exists in releng/10.0 on FreeBSD‘s subversion or GitHub.
Variables
The following table describes each available variable. The “Default” column contains strings which each variable is set to, with the exception of “Unset” and “NULL”. Unset variables are uninitialized while NULL variables are initialized with no value. Required variables are denoted with an asterisk (*) immediately appended to the name.
Variable | Purpose | Default |
---|---|---|
PATH* | The environment’s $PATH | /bin:/sbin:/usr/bin: /usr/sbin:/usr/local/bin |
CHROOTDIR* | The relative or fully qualified path of the chroot where non-contaminated distributions are built | /scratch |
SVNROOT* | The protocol and address of the subversion repository from which sources, docs, and ports are checked out from | svn://svn.freebsd.org |
SRCBRANCH* | The source branch to checkout, compile, and install | base/head@rHEAD |
DOCBRANCH | The doc branch to checkout, compile, and install | docs/head@rHEAD |
PORTBRANCH | The ports branch to checkout, compile, and install | ports/head@rHEAD |
SRC_FORCE_CHECKOUT | Enables use of “–force” with the svn command line | NULL |
MAKE_CONF* | The path to the make.conf file to implement in the chroot for release builds | /dev/null |
SRC_CONF* | The path to the src.conf file to implement in the chroot for release builds | /dev/null |
NCPU* | Derives the number of CPU cores available | |
WORLD_FLAGS | make buildworld make flags. Sets -j to $NCPU | Unset |
KERNEL_FLAGS | make buildkernel make flags. Sets -j to $NCPU / 2 | Unset |
MAKE_FLAGS* | Set’s the -s flag preventing the commands from being echoed to STDOUT | -s |
KERNEL* | Specify the kernel to build with the distribution | GENERIC |
WITH_DVD | Enables the generation of a DVD ISO of the resulting image | NULL |
RELEASECONF | Enables operators/engineers to specify a custom release.conf on the command line | Unset |
NOPORTS | If set, prevents the inclusion of a ports tree in the resulting distribution | NULL |
NODOC | If set, prevents the inclusion of a docs tree in the resulting distribution | NULL |
DOCPORTS | If NOPORTS and/or NODOC are unset, they must not pass to make as variables. The release Makefile verifies definedness of NOPORTS/NODOC variables instead of their values. | NULL |
CONF_FILES* | The aggregated build-time flags based upon variables defined within this file, unless overridden by release.conf. In most cases, these will not need to be changed. | __MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF} |
__MAKE_CONF | Permits the specification of an alternate make.conf | Unset |
SRCCONF | Equal to SRC_CONF | /dev/null |
TARGET | A make variable for cross-compiling releases | |
TARGET_ARCH | A make variable for cross-compiling releases | |
ARCH_FLAGS | Variable specifying architecture dependent built options | |
CHROOT_WMAKEFLAGS* | make buildworld flags for the chroot environment | ${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES} |
CHROOT_IMAKEFLAGS* | make installworld flags for the chroot environment | ${CONF_FILES} |
CHROOT_DMAKEFLAGS* | make distribution flags for the chroot environment | ${CONF_FILES} |
RELEASE_WMAKEFLAGS* | make buildworld flags for the release inside the chroott | ${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES} |
RELEASE_KMAKEFLAGS* | make buildkernel flags for the release inside the chroot | ${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=${KERNEL} ${ARCH_FILES} ${CONF_FILES} |
RELEASE_RMAKEFLAGS* | make release build flags inside the chroot | ${ARCH_FILES} KERNCONF=${KERNEL} ${CONF_FILES} ${DOCPORTS} WITH_DVD=${WITH_DVD} |
FORCE_SRC_KEY | Enables use of “–force” with the svn command line | NULL |
RELSTRING* | The release string as returned from uname -s | Unset |
PBUILD_FLAGS | Specifies port build flags for docproj | Unset |
_OSVERSION OSVERSION |
Identifies the OS release date and is included in PBUILD_FLAGS for the docproj port | Unset |
Flowchart
The following chart describes the release.sh program flow:
Image may be NSFW.
Clik here to view.
Disclaimer
Data and information described on this blog are for informational purposes only. The author of this blog provides no warranty/guarantee, expressed or implied, that this data and information will function as described here. Readers are expected to exercise due diligence when researching, developing, and deploying techniques and methods for use within their environments.
Comments posted are the explicit opinions of the comment poster themselves and does not necessarily reflect the views and opinions of the author of this blog.
Image may be NSFW.
Clik here to view.
Clik here to view.
