diff --git a/tools/packaging/guest-image/build_image.sh b/tools/packaging/guest-image/build_image.sh index 3913df51d1..914b72a795 100755 --- a/tools/packaging/guest-image/build_image.sh +++ b/tools/packaging/guest-image/build_image.sh @@ -14,11 +14,12 @@ set -o pipefail readonly script_name="$(basename "${BASH_SOURCE[0]}")" readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly packaging_root_dir="$(cd "${script_dir}/../" && pwd)" -readonly repo_root_dir="$(cd "${script_dir}/../../../" && pwd)" + +source "${packaging_root_dir}/scripts/lib.sh" + readonly osbuilder_dir="$(cd "${repo_root_dir}/tools/osbuilder" && pwd)" export GOPATH=${GOPATH:-${HOME}/go} -source "${packaging_root_dir}/scripts/lib.sh" arch_target="$(uname -m)" diff --git a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh index a7143096c4..ded375cb6d 100755 --- a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh +++ b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh @@ -15,8 +15,9 @@ readonly project="kata-containers" readonly script_name="$(basename "${BASH_SOURCE[0]}")" readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${script_dir}/../../scripts/lib.sh" + readonly prefix="/opt/kata" -readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" readonly static_build_dir="${repo_root_dir}/tools/packaging/static-build" readonly version_file="${repo_root_dir}/VERSION" readonly versions_yaml="${repo_root_dir}/versions.yaml" diff --git a/tools/packaging/scripts/lib.sh b/tools/packaging/scripts/lib.sh index 5ac31d0e33..d83976b35d 100644 --- a/tools/packaging/scripts/lib.sh +++ b/tools/packaging/scripts/lib.sh @@ -13,6 +13,8 @@ export PUSH_TO_REGISTRY="${PUSH_TO_REGISTRY:-"no"}" this_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +export repo_root_dir="$(cd "${this_script_dir}/../../../" && pwd)" + short_commit_length=10 hub_bin="hub-bin" diff --git a/tools/packaging/static-build/kernel/build.sh b/tools/packaging/static-build/kernel/build.sh index 8235ba22f4..fef38b98a9 100755 --- a/tools/packaging/static-build/kernel/build.sh +++ b/tools/packaging/static-build/kernel/build.sh @@ -9,11 +9,11 @@ set -o nounset set -o pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" -readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh" source "${script_dir}/../../scripts/lib.sh" +readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh" + DESTDIR=${DESTDIR:-${PWD}} PREFIX=${PREFIX:-/opt/kata} container_image="${KERNEL_CONTAINER_BUILDER:-${BUILDER_REGISTRY}:kernel-$(get_last_modification ${repo_root_dir} ${script_dir})-$(uname -m)}" diff --git a/tools/packaging/static-build/ovmf/build.sh b/tools/packaging/static-build/ovmf/build.sh index 256a892491..e181628614 100755 --- a/tools/packaging/static-build/ovmf/build.sh +++ b/tools/packaging/static-build/ovmf/build.sh @@ -9,7 +9,6 @@ set -o nounset set -o pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" readonly ovmf_builder="${script_dir}/build-ovmf.sh" source "${script_dir}/../../scripts/lib.sh" diff --git a/tools/packaging/static-build/qemu/build-base-qemu.sh b/tools/packaging/static-build/qemu/build-base-qemu.sh index d5ac3e2592..c27ded323d 100755 --- a/tools/packaging/static-build/qemu/build-base-qemu.sh +++ b/tools/packaging/static-build/qemu/build-base-qemu.sh @@ -9,7 +9,6 @@ set -o nounset set -o pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" readonly qemu_builder="${script_dir}/build-qemu.sh" source "${script_dir}/../../scripts/lib.sh" diff --git a/tools/packaging/static-build/shim-v2/build.sh b/tools/packaging/static-build/shim-v2/build.sh index 2164cf9d17..2aac612741 100755 --- a/tools/packaging/static-build/shim-v2/build.sh +++ b/tools/packaging/static-build/shim-v2/build.sh @@ -9,7 +9,6 @@ set -o nounset set -o pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" source "${script_dir}/../../scripts/lib.sh" diff --git a/tools/packaging/static-build/td-shim/build.sh b/tools/packaging/static-build/td-shim/build.sh index f822fd8271..50642fd300 100755 --- a/tools/packaging/static-build/td-shim/build.sh +++ b/tools/packaging/static-build/td-shim/build.sh @@ -9,7 +9,6 @@ set -o nounset set -o pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" readonly tdshim_builder="${script_dir}/build-td-shim.sh" source "${script_dir}/../../scripts/lib.sh" diff --git a/tools/packaging/static-build/virtiofsd/build.sh b/tools/packaging/static-build/virtiofsd/build.sh index 3a41c12119..313786eb0d 100755 --- a/tools/packaging/static-build/virtiofsd/build.sh +++ b/tools/packaging/static-build/virtiofsd/build.sh @@ -9,7 +9,6 @@ set -o nounset set -o pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" readonly virtiofsd_builder="${script_dir}/build-static-virtiofsd.sh" source "${script_dir}/../../scripts/lib.sh"