mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 16:06:51 +00:00
Improving syntax for bash scripts
This commit is contained in:
@@ -47,12 +47,12 @@ kube::etcd::validate() {
|
||||
|
||||
# validate installed version is at least equal to minimum
|
||||
version=$(etcd --version | tail -n +1 | head -n 1 | cut -d " " -f 3)
|
||||
if [[ $(kube::etcd::version $ETCD_VERSION) -gt $(kube::etcd::version $version) ]]; then
|
||||
export PATH=$KUBE_ROOT/third_party/etcd:$PATH
|
||||
if [[ $(kube::etcd::version ${ETCD_VERSION}) -gt $(kube::etcd::version ${version}) ]]; then
|
||||
export PATH=${KUBE_ROOT}/third_party/etcd:$PATH
|
||||
hash etcd
|
||||
echo $PATH
|
||||
version=$(etcd --version | head -n 1 | cut -d " " -f 3)
|
||||
if [[ $(kube::etcd::version $ETCD_VERSION) -gt $(kube::etcd::version $version) ]]; then
|
||||
if [[ $(kube::etcd::version ${ETCD_VERSION}) -gt $(kube::etcd::version ${version}) ]]; then
|
||||
kube::log::usage "etcd version ${ETCD_VERSION} or greater required."
|
||||
kube::log::info "You can use 'hack/install-etcd.sh' to install a copy in third_party/."
|
||||
exit 1
|
||||
|
||||
@@ -594,11 +594,11 @@ kube::golang::build_binaries_for_platform() {
|
||||
|
||||
for binary in "${binaries[@]}"; do
|
||||
if [[ "${binary}" =~ ".test"$ ]]; then
|
||||
tests+=($binary)
|
||||
tests+=(${binary})
|
||||
elif kube::golang::is_statically_linked_library "${binary}"; then
|
||||
statics+=($binary)
|
||||
statics+=(${binary})
|
||||
else
|
||||
nonstatics+=($binary)
|
||||
nonstatics+=(${binary})
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ kube::log::install_errexit() {
|
||||
kube::log::stack() {
|
||||
local stack_skip=${1:-0}
|
||||
stack_skip=$((stack_skip + 1))
|
||||
if [[ ${#FUNCNAME[@]} -gt $stack_skip ]]; then
|
||||
if [[ ${#FUNCNAME[@]} -gt ${stack_skip} ]]; then
|
||||
echo "Call stack:" >&2
|
||||
local i
|
||||
for ((i=1 ; i <= ${#FUNCNAME[@]} - $stack_skip ; i++))
|
||||
for ((i=1 ; i <= ${#FUNCNAME[@]} - ${stack_skip} ; i++))
|
||||
do
|
||||
local frame_no=$((i - 1 + stack_skip))
|
||||
local source_file=${BASH_SOURCE[$frame_no]}
|
||||
@@ -90,7 +90,7 @@ kube::log::error_exit() {
|
||||
echo " ${1}" >&2
|
||||
}
|
||||
|
||||
kube::log::stack $stack_skip
|
||||
kube::log::stack ${stack_skip}
|
||||
|
||||
echo "Exiting with status ${code}" >&2
|
||||
fi
|
||||
@@ -130,7 +130,7 @@ kube::log::usage_from_stdin() {
|
||||
# Print out some info that isn't a top level status line
|
||||
kube::log::info() {
|
||||
local V="${V:-0}"
|
||||
if [[ $KUBE_VERBOSE < $V ]]; then
|
||||
if [[ ${KUBE_VERBOSE} < ${V} ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -158,7 +158,7 @@ kube::log::info_from_stdin() {
|
||||
# Print a status line. Formatted to show up in a stream of output.
|
||||
kube::log::status() {
|
||||
local V="${V:-0}"
|
||||
if [[ $KUBE_VERBOSE < $V ]]; then
|
||||
if [[ ${KUBE_VERBOSE} < ${V} ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ function kube::protoc::format() {
|
||||
function kube::protoc::diff() {
|
||||
local ret=0
|
||||
diff -I "gzipped FileDescriptorProto" -I "0x" -Naupr ${1} ${2} || ret=$?
|
||||
if [[ $ret -ne 0 ]]; then
|
||||
if [[ ${ret} -ne 0 ]]; then
|
||||
echo ${3}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user