rootfs.sh: add options to list and get test config

Add new options to rootfs.sh: -l prints the list of all distros,
-t retrieves a subset of the distro configuration from config.sh
for testing purpose.

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
This commit is contained in:
Marco Vedovati 2018-10-18 09:48:47 +02:00
parent 37d182463a
commit be3bea4325
2 changed files with 18 additions and 1 deletions

View File

@ -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)

View File

@ -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 <distro_name>
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