From 8e2042d0556c8a3dce6071b724c01751670c7557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 11 May 2022 19:32:29 +0200 Subject: [PATCH] tools: add script to pull virtiofsd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now this is very much x86_64 specific, but I'd like to count on the maintainers of the other architectures to expand it. Also, the name as it's now may be misleading, as we're actually only pulling the binary that's statically built using `musl` and released as part of virtiofsd official releases. But we'll need to build it for the other architectures, thus I'm following the naming of the scripts used by the other components. Signed-off-by: Fabiano FidĂȘncio --- .../virtiofsd/build-static-virtiofsd.sh | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 tools/packaging/static-build/virtiofsd/build-static-virtiofsd.sh diff --git a/tools/packaging/static-build/virtiofsd/build-static-virtiofsd.sh b/tools/packaging/static-build/virtiofsd/build-static-virtiofsd.sh new file mode 100755 index 0000000000..d792e36f63 --- /dev/null +++ b/tools/packaging/static-build/virtiofsd/build-static-virtiofsd.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2022 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +set -o errexit +set -o nounset +set -o pipefail + +ARCH=$(uname -m) + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${script_dir}/../../scripts/lib.sh" + +virtiofsd_version="${virtiofsd_version:-}" + +[ -n "$virtiofsd_version" ] || virtiofsd_version=$(get_from_kata_deps "externals.virtiofsd.version") +[ -n "$virtiofsd_version" ] || die "failed to get virtiofsd version" + +if [ "${ARCH}" != "x86_64" ]; then + info "Only x86_64 binaries are distributed as part of the virtiofsd releases" && exit 1 +fi + +pull_virtiofsd_released_binary() { + info "Download virtiofsd version: ${virtiofsd_version}" + virtiofsd_zip=$(get_from_kata_deps "externals.virtiofsd.meta.binary") + [ -n "${virtiofsd_zip}" ] || die "failed to get virtiofsd binary URL" + + mkdir -p virtiofsd + + pushd virtiofsd + curl --fail -L ${virtiofsd_zip} -o virtiofsd.zip || return 1 + unzip virtiofsd.zip + mv -f target/x86_64-unknown-linux-musl/release/virtiofsd virtiofsd + chmod +x virtiofsd + rm -rf target + rm virtiofsd.zip + popd +} + +pull_virtiofsd_released_binary