diff --git a/rootfs-builder/rootfs.sh b/rootfs-builder/rootfs.sh index f700a72828..e9c300c8aa 100755 --- a/rootfs-builder/rootfs.sh +++ b/rootfs-builder/rootfs.sh @@ -15,6 +15,7 @@ GO_AGENT_PKG=${GO_AGENT_PKG:-github.com/kata-containers/agent} AGENT_BIN=${AGENT_BIN:-kata-agent} AGENT_INIT=${AGENT_INIT:-no} KERNEL_MODULES_DIR=${KERNEL_MODULES_DIR:-""} +OSBUILDER_VERSION="unknown" lib_file="${script_dir}/../scripts/lib.sh" source "$lib_file" @@ -40,35 +41,58 @@ usage() { error="${1:-0}" cat < - : Linux distribution to use as base OS. +Usage: ${script_name} [options] -Supported Linux distributions: +Build a rootfs based on OS, to be included in a Kata Containers +image. -$(get_distros) - -Refer the Platform-OS Compatibility Matrix: https://github.com/kata-containers/osbuilder#platform-distro-compatibility-matrix +Supported values: +$(get_distros | tr "\n" " ") Options: --a : agent version DEFAULT: ${AGENT_VERSION} ENV: AGENT_VERSION --h : show this help message --l : list the supported Linux distributions --o : specify version of osbuilder --r : rootfs directory DEFAULT: ${ROOTFS_DIR} ENV: ROOTFS_DIR --t : print the test config for a given + -a Specify the agent version. Overrides the AGENT_VERSION + environment variable. + -h Show this help message. + -l List the supported Linux distributions and exit immediately. + -o Specify the version of osbuilder to embed in the rootfs + yaml description. + -r Specify the rootfs base directory. Overrides the ROOTFS_DIR + environment variable. + -t Print the test configuration for and exit + immediately. + +Environment Variables: +AGENT_BIN Name of the agent binary (used when running sanity checks on + the rootfs). + Default value: ${AGENT_BIN} + +AGENT_INIT When set to "yes", use ${AGENT_BIN} as init process in place + of systemd. + Default value: no + +AGENT_VERSION Version of the agent to include in the rootfs. + Default value: ${AGENT_VERSION:-} + +GO_AGENT_PKG URL of the Git repository hosting the agent package. + Default value: ${GO_AGENT_PKG} + +KERNEL_MODULES_DIR Path to a directory containing kernel modules to include in + the rootfs. + Default value: + +ROOTFS_DIR Path to the directory that is populated with the rootfs. + Default value: <${script_name} path>/rootfs- + +USE_DOCKER If set, build the rootfs inside a container (requires + Docker). + Default value: + + +Refer to the Platform-OS Compatibility Matrix for more details on the supported +architectures: +https://github.com/kata-containers/osbuilder#platform-distro-compatibility-matrix -ENV VARIABLES: -GO_AGENT_PKG: Change the golang package url to get the agent source code - DEFAULT: ${GO_AGENT_PKG} -AGENT_BIN : Name of the agent binary (needed to check if agent is installed) -USE_DOCKER: If set will build rootfs in a Docker Container (requries docker) - DEFAULT: not set -AGENT_INIT : Use ${AGENT_BIN} as init process. - DEFAULT: no -KERNEL_MODULES_DIR: Optional kernel modules to put into the rootfs. - DEFAULT: "" EOT exit "${error}" } @@ -189,7 +213,6 @@ copy_kernel_modules() OK "Kernel modules copied" } -OSBUILDER_VERSION="unknown" while getopts a:hlo:r:t: opt do