Skip to content

Commit

Permalink
Fix build on OS X when GNU sed is present.
Browse files Browse the repository at this point in the history
See kubernetes#20147, which fixed it when system default BSD sed was present but did not account for possibiliyt of GNU sed on OS X.
  • Loading branch information
lorrin committed Jul 7, 2016
1 parent 939b984 commit d0e3681
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,15 @@ function kube::build::is_osx() {
[[ "$(uname)" == "Darwin" ]]
}

function kube::build::is_gnu_sed() {
[[ $(sed --version 2>&1) == *GNU* ]]
}

function kube::build::update_dockerfile() {
if kube::build::is_osx; then
sed_opts=(-i '')
else
if kube::build::is_gnu_sed; then
sed_opts=(-i)
else
sed_opts=(-i '')
fi
sed "${sed_opts[@]}" "s/KUBE_BUILD_IMAGE_CROSS_TAG/${KUBE_BUILD_IMAGE_CROSS_TAG}/" "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
}
Expand Down

0 comments on commit d0e3681

Please sign in to comment.