mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 07:22:20 +00:00
rootfs: Add support for multiple GOPATH directories
Current rootfs.sh fails when GOPATH is a set of directories.We simply choose the first one as the working directory, as go get only works against the first item in the GOPATH. Fixes: #87 Signed-off-by: Penny Zheng <penny.zheng@arm.com>
This commit is contained in:
parent
35269d2db4
commit
c3ac7180f8
@ -159,7 +159,10 @@ done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
# Fetch the first element from GOPATH as working directory
|
||||
# as go get only works against the first item in the GOPATH
|
||||
[ -z "$GOPATH" ] && die "GOPATH not set"
|
||||
GOPATH_LOCAL="${GOPATH%%:*}"
|
||||
|
||||
[ "$AGENT_INIT" == "yes" -o "$AGENT_INIT" == "no" ] || die "AGENT_INIT($AGENT_INIT) is invalid (must be yes or no)"
|
||||
|
||||
@ -217,7 +220,7 @@ if [ -n "${USE_DOCKER}" ] ; then
|
||||
--env GO_AGENT_PKG="${GO_AGENT_PKG}" \
|
||||
--env AGENT_BIN="${AGENT_BIN}" \
|
||||
--env AGENT_INIT="${AGENT_INIT}" \
|
||||
--env GOPATH="${GOPATH}" \
|
||||
--env GOPATH="${GOPATH_LOCAL}" \
|
||||
--env KERNEL_MODULES_DIR="${KERNEL_MODULES_DIR}" \
|
||||
--env EXTRA_PKGS="${EXTRA_PKGS}" \
|
||||
--env OSBUILDER_VERSION="${OSBUILDER_VERSION}" \
|
||||
@ -225,7 +228,7 @@ if [ -n "${USE_DOCKER}" ] ; then
|
||||
-v "${ROOTFS_DIR}":"/rootfs" \
|
||||
-v "${script_dir}/../scripts":"/scripts" \
|
||||
-v "${kernel_mod_dir}":"${kernel_mod_dir}" \
|
||||
-v "${GOPATH}":"${GOPATH}" \
|
||||
-v "${GOPATH_LOCAL}":"${GOPATH_LOCAL}" \
|
||||
${image_name} \
|
||||
bash /osbuilder/rootfs.sh "${distro}"
|
||||
|
||||
@ -242,7 +245,7 @@ go get -d "${GO_AGENT_PKG}" || true
|
||||
OK "Pull Agent source code"
|
||||
|
||||
info "Build agent"
|
||||
pushd "${GOPATH}/src/${GO_AGENT_PKG}"
|
||||
pushd "${GOPATH_LOCAL}/src/${GO_AGENT_PKG}"
|
||||
make clean
|
||||
make INIT=${AGENT_INIT}
|
||||
make install DESTDIR="${ROOTFS_DIR}" INIT=${AGENT_INIT}
|
||||
|
Loading…
Reference in New Issue
Block a user