-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathget_hoverfly_for_linux.sh
More file actions
35 lines (27 loc) · 954 Bytes
/
get_hoverfly_for_linux.sh
File metadata and controls
35 lines (27 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
HOVERFLY_VERSION=$(curl -s https://api.github.com/repos/spectolabs/hoverfly/releases/latest | grep tag_name | sed -n 's/.*"tag_name": "\(.*\)",/\1/p')
if [[ $? == 1 ]]; then
error_exit "Failed to get latest release version"
fi
HOVERFLY_DOWNLOAD_URL=https://github.com/SpectoLabs/hoverfly/releases/download/${HOVERFLY_VERSION}
# Download distribution package for Linux
machine_type=$(uname -m)
if [[ ${machine_type} == "x86_64" ]]; then
asset_name=hoverfly_bundle_linux_amd64.zip
else
asset_name=hoverfly_bundle_linux_386.zip
fi
wget -O /tmp/hoverfly.zip ${HOVERFLY_DOWNLOAD_URL}/${asset_name}
if [[ $? == 1 ]]; then
error_exit "Failed to download hoverfly release package"
fi
# Unzip and copy to PATH
unzip -d /tmp/hoverfly /tmp/hoverfly.zip
sudo cp /tmp/hoverfly/hoverfly /usr/local/bin/
sudo cp /tmp/hoverfly/hoverctl /usr/local/bin/
# An error exit function
function error_exit
{
echo "$1" 1>&2
exit 1
}