mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Allow init.sh and protoc.sh to be sourced idempotently
This commit is contained in:
parent
3548e7febe
commit
d49d988467
@ -18,6 +18,9 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# Short-circuit if init.sh has already been sourced
|
||||||
|
[[ $(type -t kube::init::loaded) == function ]] && return 0
|
||||||
|
|
||||||
# Unset CDPATH so that path interpolation can work correctly
|
# Unset CDPATH so that path interpolation can work correctly
|
||||||
# https://github.com/kubernetes/kubernetes/issues/52255
|
# https://github.com/kubernetes/kubernetes/issues/52255
|
||||||
unset CDPATH
|
unset CDPATH
|
||||||
@ -211,3 +214,8 @@ kube::realpath() {
|
|||||||
fi
|
fi
|
||||||
kube::readlinkdashf "${1}"
|
kube::readlinkdashf "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Marker function to indicate init.sh has been fully sourced
|
||||||
|
kube::init::loaded() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
@ -18,6 +18,9 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# Short-circuit if protoc.sh has already been sourced
|
||||||
|
[[ $(type -t kube::protoc::loaded) == function ]] && return 0
|
||||||
|
|
||||||
# The root of the build/dist directory
|
# The root of the build/dist directory
|
||||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
@ -134,3 +137,8 @@ function kube::protoc::install() {
|
|||||||
kube::log::info "export PATH=\"$(pwd)/protoc:\${PATH}\""
|
kube::log::info "export PATH=\"$(pwd)/protoc:\${PATH}\""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Marker function to indicate protoc.sh has been fully sourced
|
||||||
|
kube::protoc::loaded() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user