mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 07:48:55 +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))
|
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"
|
[ -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)"
|
[ "$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 GO_AGENT_PKG="${GO_AGENT_PKG}" \
|
||||||
--env AGENT_BIN="${AGENT_BIN}" \
|
--env AGENT_BIN="${AGENT_BIN}" \
|
||||||
--env AGENT_INIT="${AGENT_INIT}" \
|
--env AGENT_INIT="${AGENT_INIT}" \
|
||||||
--env GOPATH="${GOPATH}" \
|
--env GOPATH="${GOPATH_LOCAL}" \
|
||||||
--env KERNEL_MODULES_DIR="${KERNEL_MODULES_DIR}" \
|
--env KERNEL_MODULES_DIR="${KERNEL_MODULES_DIR}" \
|
||||||
--env EXTRA_PKGS="${EXTRA_PKGS}" \
|
--env EXTRA_PKGS="${EXTRA_PKGS}" \
|
||||||
--env OSBUILDER_VERSION="${OSBUILDER_VERSION}" \
|
--env OSBUILDER_VERSION="${OSBUILDER_VERSION}" \
|
||||||
@ -225,7 +228,7 @@ if [ -n "${USE_DOCKER}" ] ; then
|
|||||||
-v "${ROOTFS_DIR}":"/rootfs" \
|
-v "${ROOTFS_DIR}":"/rootfs" \
|
||||||
-v "${script_dir}/../scripts":"/scripts" \
|
-v "${script_dir}/../scripts":"/scripts" \
|
||||||
-v "${kernel_mod_dir}":"${kernel_mod_dir}" \
|
-v "${kernel_mod_dir}":"${kernel_mod_dir}" \
|
||||||
-v "${GOPATH}":"${GOPATH}" \
|
-v "${GOPATH_LOCAL}":"${GOPATH_LOCAL}" \
|
||||||
${image_name} \
|
${image_name} \
|
||||||
bash /osbuilder/rootfs.sh "${distro}"
|
bash /osbuilder/rootfs.sh "${distro}"
|
||||||
|
|
||||||
@ -242,7 +245,7 @@ go get -d "${GO_AGENT_PKG}" || true
|
|||||||
OK "Pull Agent source code"
|
OK "Pull Agent source code"
|
||||||
|
|
||||||
info "Build agent"
|
info "Build agent"
|
||||||
pushd "${GOPATH}/src/${GO_AGENT_PKG}"
|
pushd "${GOPATH_LOCAL}/src/${GO_AGENT_PKG}"
|
||||||
make clean
|
make clean
|
||||||
make INIT=${AGENT_INIT}
|
make INIT=${AGENT_INIT}
|
||||||
make install DESTDIR="${ROOTFS_DIR}" INIT=${AGENT_INIT}
|
make install DESTDIR="${ROOTFS_DIR}" INIT=${AGENT_INIT}
|
||||||
|
Loading…
Reference in New Issue
Block a user