tools: oci-oras/shellcheck: fix, test if binary already in place before considering copying it, but only after BIN is actually defined

This commit is contained in:
Ricardo Pardini
2023-03-28 14:34:52 +02:00
committed by Igor Pečovnik
parent b59447c96e
commit b820a4d68f
2 changed files with 12 additions and 12 deletions

View File

@@ -53,18 +53,18 @@ function run_tool_oras() {
;;
esac
# Check if we have a cached version in a Docker image, and copy it over before possibly updating it.
if [[ "${deploy_to_non_cache_dir:-"no"}" != "yes" && -d "${non_cache_dir}" && ! -f "${ORAS_BIN}" ]]; then
display_alert "Using cached ORAS from Docker image" "ORAS" "debug"
run_host_command_logged cp "${non_cache_dir}/"* "${DIR_ORAS}/"
fi
declare ORAS_FN="oras_${ORAS_VERSION}_${ORAS_OS}_${ORAS_ARCH}"
declare ORAS_FN_TARXZ="${ORAS_FN}.tar.gz"
declare DOWN_URL="https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/${ORAS_FN_TARXZ}"
declare ORAS_BIN="${DIR_ORAS}/${ORAS_FN}"
declare ACTUAL_VERSION
# Check if we have a cached version in a Docker image, and copy it over before possibly updating it.
if [[ "${deploy_to_non_cache_dir:-"no"}" != "yes" && -d "${non_cache_dir}" && ! -f "${ORAS_BIN}" ]]; then
display_alert "Using cached ORAS from Docker image" "ORAS" "debug"
run_host_command_logged cp -r "${non_cache_dir}/"* "${DIR_ORAS}/"
fi
if [[ ! -f "${ORAS_BIN}" ]]; then
do_with_retries 5 try_download_oras_tooling
fi

View File

@@ -92,18 +92,18 @@ function run_tool_shellcheck() {
;;
esac
# Check if we have a cached version in a Docker image, and copy it over before possibly updating it.
if [[ "${deploy_to_non_cache_dir:-"no"}" != "yes" && -d "${non_cache_dir}" ]]; then
display_alert "Using cached SHELLCHECK from Docker image" "SHELLCHECK" "debug"
run_host_command_logged cp -v "${non_cache_dir}/"* "${DIR_SHELLCHECK}/"
fi
declare SHELLCHECK_FN="shellcheck-v${SHELLCHECK_VERSION}.${SHELLCHECK_OS}.${SHELLCHECK_ARCH}"
declare SHELLCHECK_FN_TARXZ="${SHELLCHECK_FN}.tar.xz"
declare DOWN_URL="https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/${SHELLCHECK_FN_TARXZ}"
declare SHELLCHECK_BIN="${DIR_SHELLCHECK}/${SHELLCHECK_FN}"
declare ACTUAL_VERSION
# Check if we have a cached version in a Docker image, and copy it over before possibly updating it.
if [[ "${deploy_to_non_cache_dir:-"no"}" != "yes" && -d "${non_cache_dir}" && ! -f "${SHELLCHECK_BIN}" ]]; then
display_alert "Using cached SHELLCHECK from Docker image" "SHELLCHECK" "debug"
run_host_command_logged cp -v "${non_cache_dir}/"* "${DIR_SHELLCHECK}/"
fi
if [[ ! -f "${SHELLCHECK_BIN}" ]]; then
do_with_retries 5 try_download_shellcheck_tooling
fi