Skip to content

Commit

Permalink
virtctl.sh: Call appropriate binary by architecture
Browse files Browse the repository at this point in the history
In particular, call the Darwin executable if run in MacOS.

Signed-off-by: Ben Warren <bawarren@cisco.com>
  • Loading branch information
benwatcisco committed Jul 19, 2018
1 parent 6338f16 commit dabf2e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cluster/virtctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,17 @@ source $(dirname "$0")/../hack/common.sh
source ${KUBEVIRT_DIR}/cluster/$KUBEVIRT_PROVIDER/provider.sh
source ${KUBEVIRT_DIR}/hack/config.sh

${KUBEVIRT_DIR}/_out/cmd/virtctl/virtctl --kubeconfig=${kubeconfig} "$@"
CONFIG_ARGS=

if [ -n "$kubeconfig" ]; then
CONFIG_ARGS="--kubeconfig=${kubeconfig}"
elif [ -n "$KUBECONFIG" ]; then
CONFIG_ARGS="--kubeconfig=${KUBECONFIG}"
fi

VIRTCTL=virtctl
if [ "$(uname -s)" = "Darwin" ]; then
VIRTCTL='virtctl-darwin'
fi

${KUBEVIRT_DIR}/_out/cmd/virtctl/${VIRTCTL} $CONFIG_ARGS "$@"
3 changes: 3 additions & 0 deletions hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ for arg in $args; do
if [ "${BIN_NAME}" = "virtctl" ]; then
GOOS=darwin GOARCH=amd64 go build -i -o ${CMD_OUT_DIR}/${BIN_NAME}/${ARCH_BASENAME}-darwin-amd64 -ldflags "$(kubevirt::version::ldflags)" $(pkg_dir darwin amd64)
GOOS=windows GOARCH=amd64 go build -i -o ${CMD_OUT_DIR}/${BIN_NAME}/${ARCH_BASENAME}-windows-amd64.exe -ldflags "$(kubevirt::version::ldflags)" $(pkg_dir windows amd64)
# Create symlinks to the latest binary of each architecture
(cd ${CMD_OUT_DIR}/${BIN_NAME} && ln -sf ${ARCH_BASENAME}-darwin-amd64 ${BIN_NAME}-darwin)
(cd ${CMD_OUT_DIR}/${BIN_NAME} && ln -sf ${ARCH_BASENAME}-windows-amd64.exe ${BIN_NAME}-windows.exe)
fi
)
else
Expand Down

0 comments on commit dabf2e0

Please sign in to comment.