mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +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
|
||||
|
||||
pull_virtiofsd_released_binary() {
|
||||
if [ "${ARCH}" != "x86_64" ]; then
|
||||
info "Only x86_64 binaries are distributed as part of the virtiofsd releases" && return 1
|
||||
fi
|
||||
info "Download virtiofsd version: ${virtiofsd_version}"
|
||||
if [ "${ARCH}" != "x86_64" ]; then
|
||||
info "Only x86_64 binaries are distributed as part of the virtiofsd releases" && return 1
|
||||
fi
|
||||
info "Download virtiofsd version: ${virtiofsd_version}"
|
||||
|
||||
mkdir -p virtiofsd
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
init_env() {
|
||||
source "$HOME/.cargo/env"
|
||||
source "$HOME/.cargo/env"
|
||||
|
||||
extra_rust_flags=" -C link-self-contained=yes"
|
||||
case ${ARCH} in
|
||||
"aarch64")
|
||||
LIBC="musl"
|
||||
ARCH_LIBC=""
|
||||
;;
|
||||
"ppc64le")
|
||||
LIBC="gnu"
|
||||
ARCH="powerpc64le"
|
||||
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
||||
;;
|
||||
"s390x")
|
||||
LIBC="gnu"
|
||||
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
||||
extra_rust_flags=""
|
||||
;;
|
||||
"x86_64")
|
||||
LIBC="musl"
|
||||
ARCH_LIBC=""
|
||||
;;
|
||||
esac
|
||||
extra_rust_flags=" -C link-self-contained=yes"
|
||||
case ${ARCH} in
|
||||
"aarch64")
|
||||
LIBC="musl"
|
||||
ARCH_LIBC=""
|
||||
;;
|
||||
"ppc64le")
|
||||
LIBC="gnu"
|
||||
ARCH="powerpc64le"
|
||||
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
||||
;;
|
||||
"s390x")
|
||||
LIBC="gnu"
|
||||
ARCH_LIBC=${ARCH}-linux-${LIBC}
|
||||
extra_rust_flags=""
|
||||
;;
|
||||
"x86_64")
|
||||
LIBC="musl"
|
||||
ARCH_LIBC=""
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
|
||||
build_virtiofsd_from_source() {
|
||||
echo "build viriofsd from source"
|
||||
init_env
|
||||
echo "build viriofsd from source"
|
||||
init_env
|
||||
|
||||
git clone --depth 1 --branch ${virtiofsd_version} ${virtiofsd_repo} virtiofsd
|
||||
pushd virtiofsd
|
||||
git clone --depth 1 --branch ${virtiofsd_version} ${virtiofsd_repo} virtiofsd
|
||||
pushd virtiofsd
|
||||
|
||||
export RUSTFLAGS='-C target-feature=+crt-static'${extra_rust_flags}
|
||||
export LIBSECCOMP_LINK_TYPE=static
|
||||
export LIBSECCOMP_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
||||
export LIBCAPNG_LINK_TYPE=static
|
||||
export LIBCAPNG_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
||||
|
||||
cargo build --release --target ${ARCH}-unknown-linux-${LIBC}
|
||||
export RUSTFLAGS='-C target-feature=+crt-static'${extra_rust_flags}
|
||||
export LIBSECCOMP_LINK_TYPE=static
|
||||
export LIBSECCOMP_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
||||
export LIBCAPNG_LINK_TYPE=static
|
||||
export LIBCAPNG_LIB_PATH=/usr/lib/${ARCH_LIBC}
|
||||
|
||||
binary=$(find ./ -name virtiofsd)
|
||||
mv -f ${binary} .
|
||||
chmod +x virtiofsd
|
||||
cargo build --release --target ${ARCH}-unknown-linux-${LIBC}
|
||||
|
||||
popd
|
||||
binary=$(find ./ -name virtiofsd)
|
||||
mv -f ${binary} .
|
||||
chmod +x virtiofsd
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
pull_virtiofsd_released_binary || build_virtiofsd_from_source
|
||||
|
Loading…
Reference in New Issue
Block a user