From f4cea722a62bee672155a98887f22e13fe6c84cc Mon Sep 17 00:00:00 2001 From: Cristian Ciocaltea Date: Tue, 22 Feb 2022 19:09:02 +0200 Subject: [PATCH] ci: Use script relative paths in crosvm-runner For an increased portability, do not rely on 'CI_PROJECT_DIR' to reference script relative resources and, instead, compute their paths based on the crosvm-runner.sh invocation file path as indicated by $0. Signed-off-by: Cristian Ciocaltea Reviewed-by: Guilherme Gallo Reviewed-by: Tomeu Vizoso Part-of: --- .gitlab-ci/crosvm-runner.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/crosvm-runner.sh b/.gitlab-ci/crosvm-runner.sh index c7c2bf92dbc..636ab928559 100755 --- a/.gitlab-ci/crosvm-runner.sh +++ b/.gitlab-ci/crosvm-runner.sh @@ -58,9 +58,9 @@ trap 'exit ${exit_code}' INT TERM trap 'exit_code=$?; [ -z "${CROSVM_PID}${SOCAT_PIDS}" ] || kill ${CROSVM_PID} ${SOCAT_PIDS} >/dev/null 2>&1 || true; rm -rf ${VSOCK_TEMP_DIR}' EXIT # Securely pass the current variables to the crosvm environment -CI_COMMON="${CI_PROJECT_DIR}"/install/common echo "Variables passed through:" -"${CI_COMMON}"/generate-env.sh | tee ${VSOCK_TEMP_DIR}/crosvm-env.sh +SCRIPT_DIR=$(readlink -en "${0%/*}") +${SCRIPT_DIR}/common/generate-env.sh | tee ${VSOCK_TEMP_DIR}/crosvm-env.sh # Set the crosvm-script as the arguments of the current script echo "$@" > ${VSOCK_TEMP_DIR}/crosvm-script.sh @@ -80,7 +80,7 @@ unset DISPLAY unset XDG_RUNTIME_DIR CROSVM_KERN_ARGS="quiet console=null root=my_root rw rootfstype=virtiofs ip=192.168.30.2::192.168.30.1:255.255.255.0:crosvm:eth0" -CROSVM_KERN_ARGS="${CROSVM_KERN_ARGS} init=${CI_PROJECT_DIR}/install/crosvm-init.sh -- ${VSOCK_STDOUT} ${VSOCK_STDERR} ${VSOCK_TEMP_DIR}" +CROSVM_KERN_ARGS="${CROSVM_KERN_ARGS} init=${SCRIPT_DIR}/crosvm-init.sh -- ${VSOCK_STDOUT} ${VSOCK_STDERR} ${VSOCK_TEMP_DIR}" set +e -x