From d0e36819a4a089a702f2a51eb84c1c8fc68c81bd Mon Sep 17 00:00:00 2001 From: Lorrin Nelson Date: Thu, 7 Jul 2016 10:52:00 -0700 Subject: [PATCH 1/2] Fix build on OS X when GNU sed is present. See #20147, which fixed it when system default BSD sed was present but did not account for possibiliyt of GNU sed on OS X. --- build/common.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build/common.sh b/build/common.sh index 4bd6331b7b6..6de4cc37a5d 100755 --- a/build/common.sh +++ b/build/common.sh @@ -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" } From 85589b406bf8d0ca73e3ae61497b00739a909922 Mon Sep 17 00:00:00 2001 From: Lorrin Nelson Date: Thu, 7 Jul 2016 10:52:38 -0700 Subject: [PATCH 2/2] Fix unintentional grammatical double-negative in error message when Docker not found on OS X. --- build/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.sh b/build/common.sh index 6de4cc37a5d..f97f38a1b90 100755 --- a/build/common.sh +++ b/build/common.sh @@ -173,7 +173,7 @@ function kube::build::docker_available_on_osx() { kube::log::status "No docker host is set. Checking options for setting one..." if [[ -z "$(which docker-machine)" && -z "$(which boot2docker)" ]]; then - kube::log::status "It looks like you're running Mac OS X, and neither Docker for Mac, docker-machine or boot2docker are nowhere to be found." + kube::log::status "It looks like you're running Mac OS X, yet none of Docker for Mac, docker-machine or boot2docker are on the path." kube::log::status "See: https://docs.docker.com/machine/ for installation instructions." return 1 elif [[ -n "$(which docker-machine)" ]]; then