diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-06-23 14:38:36 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-06-24 10:40:35 +0200 |
commit | 29a9b313c4465d6bde1a812f4d3264befddbaa9a (patch) | |
tree | 9d82d46993142a3e3567015a7af56ec84ef02544 | |
parent | 29c0bd7eb46b73cb254c7e25a32213f664077573 (diff) | |
download | mbuto-29a9b313c4465d6bde1a812f4d3264befddbaa9a.tar mbuto-29a9b313c4465d6bde1a812f4d3264befddbaa9a.tar.gz mbuto-29a9b313c4465d6bde1a812f4d3264befddbaa9a.tar.bz2 mbuto-29a9b313c4465d6bde1a812f4d3264befddbaa9a.tar.lz mbuto-29a9b313c4465d6bde1a812f4d3264befddbaa9a.tar.xz mbuto-29a9b313c4465d6bde1a812f4d3264befddbaa9a.tar.zst mbuto-29a9b313c4465d6bde1a812f4d3264befddbaa9a.zip |
mbuto: Add support for externally defined profiles
This is convenient for passt (https://passt.top) tests, given that
the set of commands we need there might change as tests are modified,
and we don't want to rely on definitions that are built into mbuto
itself.
Eventually, we could drop the built-in passt profile altogether,
but let's wait a bit before doing that.
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-rwxr-xr-x | mbuto | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -1135,9 +1135,15 @@ usage() { echo " kernel version. Default: $(uname -r)" echo " -m PATH" echo " relative root for /lib/modules. Default: /" - echo " -p PROFILE" - echo " select profile for add-ons, one of:" + echo " -p PROFILE|FILE" + echo " select profile for add-ons, built-in PROFILEs are:" echo " base bash kata kata_debug passt kselftests" + echo + echo " alternatively, an executable shell script FILE" + echo " including assignments of configuration variables can be" + echo " used. To avoid collisions with built-in profiles, FILE" + echo " needs to be as a command, e.g. './passt', not 'passt'" + echo echo " Default: base" echo echo " kselftests sub-options (same as run_kselftests.sh):" @@ -1247,9 +1253,13 @@ fi # Create working directory wd="$("${MKTEMP}" -d)" -# Apply profile requested via -p, if any, from matching profile_*() function -if [ -n "${PROFILE}" ]; then - notice "Applying profile ${PROFILE}" +# Apply profile requested from file or matching profile_*() function +if [ -x "${PROFILE}" ] && __profile_file="$(command -v ${PROFILE})" && \ + [ "${PROFILE}" = "${__profile_file}" ]; then + notice "Applying profile from file ${PROFILE}" + . "${PROFILE}" +else + notice "Applying built-in profile ${PROFILE}" eval "profile_${PROFILE}" || err "profile ${PROFILE} not found" fi |