@@ -101,19 +101,20 @@ function kube::protoc::diff() {
101
101
}
102
102
103
103
function kube::protoc::install() {
104
+ local os
105
+ local arch
106
+ local download_folder
107
+ local download_file
108
+ local third_party_dir
109
+
110
+ os=$( kube::util::host_os)
111
+ arch=$( kube::util::host_arch)
112
+ download_folder=" protoc-v${PROTOC_VERSION} -${os} -${arch} "
113
+ download_file=" ${download_folder} .zip"
114
+ third_party_dir=" ${KUBE_ROOT} /third_party"
104
115
# run in a subshell to isolate caller from directory changes
105
116
(
106
- local os
107
- local arch
108
- local download_folder
109
- local download_file
110
-
111
- os=$( kube::util::host_os)
112
- arch=$( kube::util::host_arch)
113
- download_folder=" protoc-v${PROTOC_VERSION} -${os} -${arch} "
114
- download_file=" ${download_folder} .zip"
115
-
116
- cd " ${KUBE_ROOT} /third_party" || return 1
117
+ cd " ${third_party_dir} " || return 1
117
118
if [[ $( readlink protoc) != " ${download_folder} " ]]; then
118
119
local url
119
120
if [[ ${os} == " darwin" ]]; then
@@ -136,8 +137,12 @@ function kube::protoc::install() {
136
137
rm " ${download_file} "
137
138
fi
138
139
kube::log::info " protoc v${PROTOC_VERSION} installed. To use:"
139
- kube::log::info " export PATH=\" $( pwd ) /protoc:\$ {PATH}\" "
140
+ kube::log::info " export PATH=\" ${third_party_dir} /protoc:\$ {PATH}\" "
140
141
)
142
+ # export updated PATH so install-protoc.sh can be sourced
143
+ # CLI callers will need to use the export indicated above
144
+ PATH=" ${third_party_dir} /protoc:${PATH} "
145
+ export PATH
141
146
}
142
147
143
148
# Marker function to indicate protoc.sh has been fully sourced
0 commit comments