mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 00:37:24 +00:00
Merge pull request #5631 from GabyCT/topic/fixvirtiofsdscript
tools: Fix indentation of build static virtiofsd script
This commit is contained in:
commit
b8dbb35bb7
@ -27,70 +27,70 @@ virtiofsd_zip="${virtiofsd_zip:-}"
|
|||||||
[ -d "virtiofsd" ] && rm -r virtiofsd
|
[ -d "virtiofsd" ] && rm -r virtiofsd
|
||||||
|
|
||||||
pull_virtiofsd_released_binary() {
|
pull_virtiofsd_released_binary() {
|
||||||
if [ "${ARCH}" != "x86_64" ]; then
|
if [ "${ARCH}" != "x86_64" ]; then
|
||||||
info "Only x86_64 binaries are distributed as part of the virtiofsd releases" && return 1
|
info "Only x86_64 binaries are distributed as part of the virtiofsd releases" && return 1
|
||||||
fi
|
fi
|
||||||
info "Download virtiofsd version: ${virtiofsd_version}"
|
info "Download virtiofsd version: ${virtiofsd_version}"
|
||||||
|
|
||||||
mkdir -p virtiofsd
|
mkdir -p virtiofsd
|
||||||
|
|
||||||
pushd virtiofsd
|
pushd virtiofsd
|
||||||
curl --fail -L ${virtiofsd_zip} -o virtiofsd.zip || return 1
|
curl --fail -L ${virtiofsd_zip} -o virtiofsd.zip || return 1
|
||||||
unzip virtiofsd.zip
|
unzip virtiofsd.zip
|
||||||
mv -f target/x86_64-unknown-linux-musl/release/virtiofsd virtiofsd
|
mv -f target/x86_64-unknown-linux-musl/release/virtiofsd virtiofsd
|
||||||
chmod +x virtiofsd
|
chmod +x virtiofsd
|
||||||
rm -rf target
|
rm -rf target
|
||||||
rm virtiofsd.zip
|
rm virtiofsd.zip
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
init_env() {
|
init_env() {
|
||||||
source "$HOME/.cargo/env"
|
source "$HOME/.cargo/env"
|
||||||
|
|
||||||
extra_rust_flags=" -C link-self-contained=yes"
|
extra_rust_flags=" -C link-self-contained=yes"
|
||||||
case ${ARCH} in
|
case ${ARCH} in
|
||||||
"aarch64")
|
"aarch64")
|
||||||
LIBC="musl"
|
LIBC="musl"
|
||||||
ARCH_LIBC=""
|
ARCH_LIBC=""
|
||||||
;;
|
;;
|
||||||
"ppc64le")
|
"ppc64le")
|
||||||
LIBC="gnu"
|
LIBC="gnu"
|
||||||
ARCH="powerpc64le"
|
ARCH="powerpc64le"
|
||||||
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
||||||
;;
|
;;
|
||||||
"s390x")
|
"s390x")
|
||||||
LIBC="gnu"
|
LIBC="gnu"
|
||||||
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
||||||
extra_rust_flags=""
|
extra_rust_flags=""
|
||||||
;;
|
;;
|
||||||
"x86_64")
|
"x86_64")
|
||||||
LIBC="musl"
|
LIBC="musl"
|
||||||
ARCH_LIBC=""
|
ARCH_LIBC=""
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_virtiofsd_from_source() {
|
build_virtiofsd_from_source() {
|
||||||
echo "build viriofsd from source"
|
echo "build viriofsd from source"
|
||||||
init_env
|
init_env
|
||||||
|
|
||||||
git clone --depth 1 --branch ${virtiofsd_version} ${virtiofsd_repo} virtiofsd
|
git clone --depth 1 --branch ${virtiofsd_version} ${virtiofsd_repo} virtiofsd
|
||||||
pushd virtiofsd
|
pushd virtiofsd
|
||||||
|
|
||||||
export RUSTFLAGS='-C target-feature=+crt-static'${extra_rust_flags}
|
export RUSTFLAGS='-C target-feature=+crt-static'${extra_rust_flags}
|
||||||
export LIBSECCOMP_LINK_TYPE=static
|
export LIBSECCOMP_LINK_TYPE=static
|
||||||
export LIBSECCOMP_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
export LIBSECCOMP_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
||||||
export LIBCAPNG_LINK_TYPE=static
|
export LIBCAPNG_LINK_TYPE=static
|
||||||
export LIBCAPNG_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
export LIBCAPNG_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
||||||
|
|
||||||
cargo build --release --target ${ARCH}-unknown-linux-${LIBC}
|
|
||||||
|
|
||||||
binary=$(find ./ -name virtiofsd)
|
cargo build --release --target ${ARCH}-unknown-linux-${LIBC}
|
||||||
mv -f ${binary} .
|
|
||||||
chmod +x virtiofsd
|
|
||||||
|
|
||||||
popd
|
binary=$(find ./ -name virtiofsd)
|
||||||
|
mv -f ${binary} .
|
||||||
|
chmod +x virtiofsd
|
||||||
|
|
||||||
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
pull_virtiofsd_released_binary || build_virtiofsd_from_source
|
pull_virtiofsd_released_binary || build_virtiofsd_from_source
|
||||||
|
Loading…
Reference in New Issue
Block a user