mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
rust-agent: Separate the build up of rust-agent and go-agent
Separate the build up of rust-agent and go-agent, hence you only select one as kata-agent. I've added the generation of rust-agent systemd service files into rust-agent Makefile. Therefore, we could use same `make` commands to build go-agent and rust-agent. Fixes: #411 Signed-off-by: Penny Zheng <penny.zheng@arm.com>
This commit is contained in:
parent
a390a360db
commit
67343a178c
@ -544,34 +544,31 @@ EOT
|
|||||||
AGENT_DEST="${AGENT_DIR}/${AGENT_BIN}"
|
AGENT_DEST="${AGENT_DIR}/${AGENT_BIN}"
|
||||||
|
|
||||||
if [ -z "${AGENT_SOURCE_BIN}" ] ; then
|
if [ -z "${AGENT_SOURCE_BIN}" ] ; then
|
||||||
|
if [ "$RUST_AGENT" != "yes" ]; then
|
||||||
|
agent_pkg="${GO_AGENT_PKG}"
|
||||||
|
agent_dir="${GOPATH_LOCAL}/src/${GO_AGENT_PKG}"
|
||||||
|
else
|
||||||
|
# The PATH /.cargo/bin is apparently wrong
|
||||||
|
# looks like $HOME is resolved to empty when
|
||||||
|
# container is started
|
||||||
|
source "${HOME}/.cargo/env"
|
||||||
|
agent_pkg="${RUST_AGENT_PKG}"
|
||||||
|
agent_dir="${GOPATH_LOCAL}/src/${RUST_AGENT_PKG}/src/agent"
|
||||||
|
# For now, rust-agent doesn't support seccomp yet.
|
||||||
|
SECCOMP="no"
|
||||||
|
fi
|
||||||
|
|
||||||
info "Pull Agent source code"
|
info "Pull Agent source code"
|
||||||
go get -d "${GO_AGENT_PKG}" || true
|
go get -d "${agent_pkg}" || true
|
||||||
OK "Pull Agent source code"
|
OK "Pull Agent source code"
|
||||||
|
|
||||||
info "Build agent"
|
info "Build agent"
|
||||||
pushd "${GOPATH_LOCAL}/src/${GO_AGENT_PKG}"
|
pushd "${agent_dir}"
|
||||||
[ -n "${AGENT_VERSION}" ] && git checkout "${AGENT_VERSION}" && OK "git checkout successful" || info "checkout failed!"
|
[ -n "${AGENT_VERSION}" ] && git checkout "${AGENT_VERSION}" && OK "git checkout successful" || info "checkout failed!"
|
||||||
make clean
|
make clean
|
||||||
make INIT=${AGENT_INIT}
|
make INIT=${AGENT_INIT}
|
||||||
make install DESTDIR="${ROOTFS_DIR}" INIT=${AGENT_INIT} SECCOMP=${SECCOMP}
|
make install DESTDIR="${ROOTFS_DIR}" INIT=${AGENT_INIT} SECCOMP=${SECCOMP}
|
||||||
popd
|
popd
|
||||||
if [ "$RUST_AGENT" == "yes" ]; then
|
|
||||||
# build rust agent
|
|
||||||
info "Build rust agent"
|
|
||||||
# The PATH /.cargo/bin is apparently wrong
|
|
||||||
# looks like $HOME is resolved to empty when
|
|
||||||
# container is started
|
|
||||||
source "${HOME}/.cargo/env"
|
|
||||||
git clone https://${RUST_AGENT_PKG}.git
|
|
||||||
local -r agent_dir="${GOPATH_LOCAL}/src/${RUST_AGENT_PKG}/src/agent"
|
|
||||||
pushd "${agent_dir}"
|
|
||||||
# checkout correct version
|
|
||||||
[ -n "${AGENT_VERSION}" ] && git checkout "${AGENT_VERSION}" && OK "git checkout successful"
|
|
||||||
make clean
|
|
||||||
make
|
|
||||||
make install DESTDIR="${ROOTFS_DIR}"
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
cp ${AGENT_SOURCE_BIN} ${AGENT_DEST}
|
cp ${AGENT_SOURCE_BIN} ${AGENT_DEST}
|
||||||
OK "cp ${AGENT_SOURCE_BIN} ${AGENT_DEST}"
|
OK "cp ${AGENT_SOURCE_BIN} ${AGENT_DEST}"
|
||||||
|
Loading…
Reference in New Issue
Block a user