ci: Fix indentation of install libseccomp script

This PR fixes the indentation of the install libseccomp script.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
Gabriela Cervantes 2024-09-17 16:38:16 +00:00
parent 9d29ce460d
commit 096f32cc52

View File

@ -23,11 +23,11 @@ workdir="$(mktemp -d --tmpdir build-libseccomp.XXXXX)"
# Variables for libseccomp # Variables for libseccomp
libseccomp_version="${LIBSECCOMP_VERSION:-""}" libseccomp_version="${LIBSECCOMP_VERSION:-""}"
if [ -z "${libseccomp_version}" ]; then if [ -z "${libseccomp_version}" ]; then
libseccomp_version=$(get_from_kata_deps ".externals.libseccomp.version") libseccomp_version=$(get_from_kata_deps ".externals.libseccomp.version")
fi fi
libseccomp_url="${LIBSECCOMP_URL:-""}" libseccomp_url="${LIBSECCOMP_URL:-""}"
if [ -z "${libseccomp_url}" ]; then if [ -z "${libseccomp_url}" ]; then
libseccomp_url=$(get_from_kata_deps ".externals.libseccomp.url") libseccomp_url=$(get_from_kata_deps ".externals.libseccomp.url")
fi fi
libseccomp_tarball="libseccomp-${libseccomp_version}.tar.gz" libseccomp_tarball="libseccomp-${libseccomp_version}.tar.gz"
libseccomp_tarball_url="${libseccomp_url}/releases/download/v${libseccomp_version}/${libseccomp_tarball}" libseccomp_tarball_url="${libseccomp_url}/releases/download/v${libseccomp_version}/${libseccomp_tarball}"
@ -36,11 +36,11 @@ cflags="-O2"
# Variables for gperf # Variables for gperf
gperf_version="${GPERF_VERSION:-""}" gperf_version="${GPERF_VERSION:-""}"
if [ -z "${gperf_version}" ]; then if [ -z "${gperf_version}" ]; then
gperf_version=$(get_from_kata_deps ".externals.gperf.version") gperf_version=$(get_from_kata_deps ".externals.gperf.version")
fi fi
gperf_url="${GPERF_URL:-""}" gperf_url="${GPERF_URL:-""}"
if [ -z "${gperf_url}" ]; then if [ -z "${gperf_url}" ]; then
gperf_url=$(get_from_kata_deps ".externals.gperf.url") gperf_url=$(get_from_kata_deps ".externals.gperf.url")
fi fi
gperf_tarball="gperf-${gperf_version}.tar.gz" gperf_tarball="gperf-${gperf_version}.tar.gz"
gperf_tarball_url="${gperf_url}/${gperf_tarball}" gperf_tarball_url="${gperf_url}/${gperf_tarball}"
@ -48,64 +48,64 @@ gperf_tarball_url="${gperf_url}/${gperf_tarball}"
# We need to build the libseccomp library from sources to create a static library for the musl libc. # We need to build the libseccomp library from sources to create a static library for the musl libc.
# However, ppc64le and s390x have no musl targets in Rust. Hence, we do not set cflags for the musl libc. # However, ppc64le and s390x have no musl targets in Rust. Hence, we do not set cflags for the musl libc.
if ([ "${arch}" != "ppc64le" ] && [ "${arch}" != "s390x" ]); then if ([ "${arch}" != "ppc64le" ] && [ "${arch}" != "s390x" ]); then
# Set FORTIFY_SOURCE=1 because the musl-libc does not have some functions about FORTIFY_SOURCE=2 # Set FORTIFY_SOURCE=1 because the musl-libc does not have some functions about FORTIFY_SOURCE=2
cflags="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2" cflags="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2"
fi fi
die() { die() {
msg="$*" msg="$*"
echo "[Error] ${msg}" >&2 echo "[Error] ${msg}" >&2
exit 1 exit 1
} }
finish() { finish() {
rm -rf "${workdir}" rm -rf "${workdir}"
} }
trap finish EXIT trap finish EXIT
build_and_install_gperf() { build_and_install_gperf() {
echo "Build and install gperf version ${gperf_version}" echo "Build and install gperf version ${gperf_version}"
mkdir -p "${gperf_install_dir}" mkdir -p "${gperf_install_dir}"
curl -sLO "${gperf_tarball_url}" curl -sLO "${gperf_tarball_url}"
tar -xf "${gperf_tarball}" tar -xf "${gperf_tarball}"
pushd "gperf-${gperf_version}" pushd "gperf-${gperf_version}"
# Unset $CC for configure, we will always use native for gperf # Unset $CC for configure, we will always use native for gperf
CC= ./configure --prefix="${gperf_install_dir}" CC= ./configure --prefix="${gperf_install_dir}"
make make
make install make install
export PATH=$PATH:"${gperf_install_dir}"/bin export PATH=$PATH:"${gperf_install_dir}"/bin
popd popd
echo "Gperf installed successfully" echo "Gperf installed successfully"
} }
build_and_install_libseccomp() { build_and_install_libseccomp() {
echo "Build and install libseccomp version ${libseccomp_version}" echo "Build and install libseccomp version ${libseccomp_version}"
mkdir -p "${libseccomp_install_dir}" mkdir -p "${libseccomp_install_dir}"
curl -sLO "${libseccomp_tarball_url}" curl -sLO "${libseccomp_tarball_url}"
tar -xf "${libseccomp_tarball}" tar -xf "${libseccomp_tarball}"
pushd "libseccomp-${libseccomp_version}" pushd "libseccomp-${libseccomp_version}"
[ "${arch}" == $(uname -m) ] && cc_name="" || cc_name="${arch}-linux-gnu-gcc" [ "${arch}" == $(uname -m) ] && cc_name="" || cc_name="${arch}-linux-gnu-gcc"
CC=${cc_name} ./configure --prefix="${libseccomp_install_dir}" CFLAGS="${cflags}" --enable-static --host="${arch}" CC=${cc_name} ./configure --prefix="${libseccomp_install_dir}" CFLAGS="${cflags}" --enable-static --host="${arch}"
make make
make install make install
popd popd
echo "Libseccomp installed successfully" echo "Libseccomp installed successfully"
} }
main() { main() {
local libseccomp_install_dir="${1:-}" local libseccomp_install_dir="${1:-}"
local gperf_install_dir="${2:-}" local gperf_install_dir="${2:-}"
if [ -z "${libseccomp_install_dir}" ] || [ -z "${gperf_install_dir}" ]; then if [ -z "${libseccomp_install_dir}" ] || [ -z "${gperf_install_dir}" ]; then
die "Usage: ${0} <libseccomp-install-dir> <gperf-install-dir>" die "Usage: ${0} <libseccomp-install-dir> <gperf-install-dir>"
fi fi
pushd "$workdir" pushd "$workdir"
# gperf is required for building the libseccomp. # gperf is required for building the libseccomp.
build_and_install_gperf build_and_install_gperf
build_and_install_libseccomp build_and_install_libseccomp
popd popd
} }
main "$@" main "$@"