mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #28624 from lorrin/gnu_sed_osx
Automatic merge from submit-queue 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 possibility of GNU sed on OS X. See also http://unix.stackexchange.com/questions/92895/how-to-achieve-portability-with-sed-i-in-place-editing []()
This commit is contained in:
commit
836c60ccff
@ -173,7 +173,7 @@ function kube::build::docker_available_on_osx() {
|
|||||||
|
|
||||||
kube::log::status "No docker host is set. Checking options for setting one..."
|
kube::log::status "No docker host is set. Checking options for setting one..."
|
||||||
if [[ -z "$(which docker-machine)" && -z "$(which boot2docker)" ]]; then
|
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."
|
kube::log::status "See: https://docs.docker.com/machine/ for installation instructions."
|
||||||
return 1
|
return 1
|
||||||
elif [[ -n "$(which docker-machine)" ]]; then
|
elif [[ -n "$(which docker-machine)" ]]; then
|
||||||
@ -242,11 +242,15 @@ function kube::build::is_osx() {
|
|||||||
[[ "$(uname)" == "Darwin" ]]
|
[[ "$(uname)" == "Darwin" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function kube::build::is_gnu_sed() {
|
||||||
|
[[ $(sed --version 2>&1) == *GNU* ]]
|
||||||
|
}
|
||||||
|
|
||||||
function kube::build::update_dockerfile() {
|
function kube::build::update_dockerfile() {
|
||||||
if kube::build::is_osx; then
|
if kube::build::is_gnu_sed; then
|
||||||
sed_opts=(-i '')
|
|
||||||
else
|
|
||||||
sed_opts=(-i)
|
sed_opts=(-i)
|
||||||
|
else
|
||||||
|
sed_opts=(-i '')
|
||||||
fi
|
fi
|
||||||
sed "${sed_opts[@]}" "s/KUBE_BUILD_IMAGE_CROSS_TAG/${KUBE_BUILD_IMAGE_CROSS_TAG}/" "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
|
sed "${sed_opts[@]}" "s/KUBE_BUILD_IMAGE_CROSS_TAG/${KUBE_BUILD_IMAGE_CROSS_TAG}/" "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user