pkglib: Fix the detection of the versions.txt

When we try to run the kata-deploy-binaries.sh script, we have a failure on
the pkglib.sh script that we can not source the versions.txt. In order to
avoid these kind of failures, we introduce to detect if this file exists and
in case that it does not, we fail the script.

Fixes #712

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
Gabriela Cervantes
2019-09-11 06:12:02 -05:00
parent b9053f2e74
commit ee0a5563b1

View File

@@ -6,7 +6,14 @@
source_dir_pkg_lib=$(dirname "${BASH_SOURCE[0]}")
source_dir_pkg_lib=$(realpath "${source_dir_pkg_lib}")
source "${source_dir_pkg_lib}/../../scripts/lib.sh"
source "${source_dir_pkg_lib}/../versions.txt"
# Verify that versions.txt exists
version_file="${source_dir_pkg_lib}/../versions.txt"
if [ -f "${version_file}" ]; then
source "${version_file}"
else
die "${version_file} does not exist, you need to run first the gen_versions_txt.sh"
fi
PACKAGING_DIR=/var/packaging
LOG_DIR=${PACKAGING_DIR}/build_logs