#!/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. # A library of helper functions and constant for GCI distro # Creates the GCI specific metadata files if they do not exit. # Assumed var # KUBE_TEMP proc ensure-gci-metadata-files { if [[ ! -f "${KUBE_TEMP}/gci-update.txt" ]] { echo -n "update_disabled" > "$(KUBE_TEMP)/gci-update.txt" } if [[ ! -f "${KUBE_TEMP}/gci-ensure-gke-docker.txt" ]] { echo -n "true" > "$(KUBE_TEMP)/gci-ensure-gke-docker.txt" } if [[ ! -f "${KUBE_TEMP}/gci-docker-version.txt" ]] { echo -n $(GCI_DOCKER_VERSION:-) > "$(KUBE_TEMP)/gci-docker-version.txt" } } (CommandList children: [ (FuncDef name: ensure-gci-metadata-files body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_f child: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-update.txt))} ) ) ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(-n)} {(DQ (update_disabled))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-update.txt))} spids: [93] ) ] ) ] spids: [-1 82] ) ] spids: [-1 103] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_f child: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-ensure-gke-docker.txt))} ) ) ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(-n)} {(DQ (true))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-ensure-gke-docker.txt))} spids: [135] ) ] ) ] spids: [-1 124] ) ] spids: [-1 145] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_f child: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-docker-version.txt))} ) ) ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {(-n)} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [174 177] ) ) } ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name KUBE_TEMP) (/gci-docker-version.txt))} spids: [180] ) ] ) ] spids: [-1 166] ) ] spids: [-1 190] ) ] spids: [61] ) spids: [57 60] ) ] )