#!/bin/bash # Copyright 2016 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := $(KUBE_ROOT:-$(dirname "${BASH_SOURCE}")/..) source "$(KUBE_ROOT)/cluster/kube-util.sh" source "$(KUBE_ROOT)/cluster/clientbin.sh" # If KUBEADM_PATH isn't set, gather up the list of likely places and use ls # to find the latest one. if [[ -z "${KUBEADM_PATH:-}" ]] { global kubeadm := $[ get_bin "kubeadm" "cmd/kubeadm] if [[ ! -x "$kubeadm" ]] { print_error "kubeadm" exit 1 } } elif [[ ! -x "${KUBEADM_PATH}" ]] { do { echo "KUBEADM_PATH environment variable set to '$(KUBEADM_PATH)', but " echo "this doesn't seem to be a valid executable." } >&2 exit 1 } global kubeadm := $(KUBEADM_PATH:-${kubeadm}) $(kubeadm) $(@+$@) (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [67 75] ) (Lit_Slash /) (..) } ) spids: [64 78] ) } spids: [63] ) ] spids: [63] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kube-util.sh))}) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/clientbin.sh))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [112 115] ) ) } ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubeadm) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_bin)} {(DQ (kubeadm))} {(DQ (cmd/kubeadm))})] ) left_token: spids: [125 137] ) } spids: [124] ) ] spids: [124] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id:BoolUnary_x child:{(DQ ($ VSub_Name "$kubeadm"))}) ) ) terminator: ) ] action: [(C {(print_error)} {(DQ (kubeadm))}) (C {(exit)} {(1)})] spids: [-1 156] ) ] spids: [-1 171] ) ] spids: [-1 121] ) (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id:BoolUnary_x child:{(DQ (${ VSub_Name KUBEADM_PATH))}) ) ) terminator: ) ] action: [ (BraceGroup children: [ (C {(echo)} { (DQ ("KUBEADM_PATH environment variable set to '") (${ VSub_Name KUBEADM_PATH) ("', but ") ) } ) (C {(echo)} {(DQ ("this doesn't seem to be a valid executable."))}) ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[216])] spids: [193] ) (C {(exit)} {(1)}) ] spids: [173 190] ) ] spids: [-1 224] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubeadm) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(${ VSub_Name kubeadm)}) spids: [228 234] ) ) } spids: [226] ) ] spids: [226] ) (C {(DQ (${ VSub_Name kubeadm))} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Plus arg_word:{($ VSub_At "$@")}) spids: [245 249] ) ) } ) ] )