diff --git a/hack/build-cross.sh b/hack/build-cross.sh index 5694dee946c6..d7ed2bcd8f94 100755 --- a/hack/build-cross.sh +++ b/hack/build-cross.sh @@ -93,10 +93,10 @@ if [[ "${OS_BUILD_RELEASE_ARCHIVES-}" != "n" ]]; then os::build::release_sha else # Place binaries only - OS_BUILD_PLATFORMS=("${platforms[@]+"${platforms[@]}"}") \ - os::build::place_bins "${OS_CROSS_COMPILE_BINARIES[@]}" - OS_BUILD_PLATFORMS=("${image_platforms[@]+"${image_platforms[@]}"}") \ - os::build::place_bins "${OS_IMAGE_COMPILE_BINARIES[@]}" + OS_BUILD_PLATFORMS=("${platforms[@]+"${platforms[@]}"}") + os::build::place_bins "${OS_CROSS_COMPILE_BINARIES[@]}" + OS_BUILD_PLATFORMS=("${image_platforms[@]+"${image_platforms[@]}"}") + os::build::place_bins "${OS_IMAGE_COMPILE_BINARIES[@]}" fi if [[ "${OS_GIT_TREE_STATE:-dirty}" == "clean" ]]; then diff --git a/hack/lib/build/binaries.sh b/hack/lib/build/binaries.sh index f93cafcaa642..7a5cbb5eb3f3 100644 --- a/hack/lib/build/binaries.sh +++ b/hack/lib/build/binaries.sh @@ -330,6 +330,18 @@ function os::build::place_bins() { fi done + # Link binaries that we want to link (eg. oc->kubectl) + local suffix="" + if [[ $platform == "windows/amd64" ]]; then + suffix=".exe" + fi + for linkname in "${OC_BINARY_COPY[@]}"; do + local src="${OS_OUTPUT_BINPATH}/${platform}/oc${suffix}" + if [[ -f "${src}" ]]; then + ln -f "$src" "${OS_OUTPUT_BINPATH}/${platform}/${linkname}${suffix}" + fi + done + # If no release archive was requested, we're done. if [[ "${OS_RELEASE_ARCHIVE-}" == "" ]]; then continue @@ -342,14 +354,10 @@ function os::build::place_bins() { done # Create binary copies where specified. - local suffix="" - if [[ $platform == "windows/amd64" ]]; then - suffix=".exe" - fi for linkname in "${OC_BINARY_COPY[@]}"; do local src="${release_binpath}/oc${suffix}" if [[ -f "${src}" ]]; then - ln "${release_binpath}/oc${suffix}" "${release_binpath}/${linkname}${suffix}" + cp -f "${release_binpath}/oc${suffix}" "${release_binpath}/${linkname}${suffix}" fi done