This repository was archived by the owner on Jan 25, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -166,8 +166,48 @@ function fetch_binary {
166
166
local -r version=" $1 "
167
167
local download_url=" $2 "
168
168
169
- if [[ -z " $download_url " && -n " $version " ]]; then
170
- download_url=" https://releases.hashicorp.com/consul/${version} /consul_${version} _linux_amd64.zip"
169
+ local cpu_arch
170
+ cpu_arch=" $( uname -m) "
171
+ local binary_arch=" "
172
+ case " $cpu_arch " in
173
+ x86_64)
174
+ binary_arch=" amd64"
175
+ ;;
176
+ x86)
177
+ binary_arch=" 386"
178
+ ;;
179
+ arm64|aarch64)
180
+ binary_arch=" arm64"
181
+ ;;
182
+ arm* )
183
+ # The following info is taken from https://www.consul.io/downloads
184
+ #
185
+ # Note for ARM users:
186
+ #
187
+ # Use Armelv5 for all 32-bit armel systems
188
+ # Use Armhfv6 for all armhf systems with v6+ architecture
189
+ # Use Arm64 for all v8 64-bit architectures
190
+ # The following commands can help determine the right version for your system:
191
+ #
192
+ # $ uname -m
193
+ # $ readelf -a /proc/self/exe | grep -q -c Tag_ABI_VFP_args && echo "armhf" || echo "armel"
194
+ #
195
+ local vfp_tag
196
+ vfp_tag=" $( readelf -a /proc/self/exe | grep -q -c Tag_ABI_VFP_args) "
197
+ if [[ -z $vfp_tag ]]; then
198
+ binary_arch=" armelv5"
199
+ else
200
+ binary_arch=" armhfv6"
201
+ fi
202
+ ;;
203
+ * )
204
+ log_error " CPU architecture $cpu_arch is not a supported by Consul."
205
+ exit 1
206
+ ;;
207
+ esac
208
+
209
+ if [[ -z " $download_url " && -n " $version " ]]; then
210
+ download_url=" https://releases.hashicorp.com/consul/${version} /consul_${version} _linux_${binary_arch} .zip"
171
211
fi
172
212
173
213
retry \
You can’t perform that action at this time.
0 commit comments