diff --git a/Makefile b/Makefile index d57a7828ad..ec23eb6548 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,10 @@ test-image-only: test-initrd-only: $(TEST_RUNNER) --test-initrds-only "$(DISTRO)" +.PHONY: list-distros +list-distros: + @ $(ROOTFS_BUILDER) -l + .PHONY: clean clean: rm -rf $(DISTRO_ROOTFS_MARKER) $(DISTRO_ROOTFS) $(DISTRO_IMAGE) $(DISTRO_INITRD) diff --git a/rootfs-builder/rootfs.sh b/rootfs-builder/rootfs.sh index 228cfe1c76..f700a72828 100755 --- a/rootfs-builder/rootfs.sh +++ b/rootfs-builder/rootfs.sh @@ -54,8 +54,10 @@ Refer the Platform-OS Compatibility Matrix: https://github.com/kata-containers/o 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 ENV VARIABLES: GO_AGENT_PKG: Change the golang package url to get the agent source code @@ -78,6 +80,15 @@ get_distros() { done } +get_test_config() { + local distro="$1" + local config="${script_dir}/${distro}/config.sh" + source ${config} + + echo -e "INIT_PROCESS:\t\t$INIT_PROCESS" + echo -e "ARCH_EXCLUDE_LIST:\t\t${ARCH_EXCLUDE_LIST[@]}" +} + check_function_exist() { function_name="$1" @@ -180,13 +191,15 @@ copy_kernel_modules() OSBUILDER_VERSION="unknown" -while getopts a:ho:r: opt +while getopts a:hlo:r:t: opt do case $opt in a) AGENT_VERSION="${OPTARG}" ;; h) usage ;; + l) get_distros | sort && exit 0;; o) OSBUILDER_VERSION="${OPTARG}" ;; r) ROOTFS_DIR="${OPTARG}" ;; + t) get_test_config "${OPTARG}" && exit 0;; esac done