forked from AliyunContainerService/pouch
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathswagger.sh
34 lines (26 loc) · 817 Bytes
/
swagger.sh
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
#!/usr/bin/env bash
set -euo pipefail
readonly SWAGGER_VERSION=v0.17.1
# swagger::check_version checks the command and the version.
swagger::check_version() {
local has_installed version
has_installed="$(command -v swagger || echo false)"
if [[ "${has_installed}" = "false" ]]; then
echo false
return
fi
version="$(swagger version | head -n 1 | cut -d " " -f 2)"
if [[ "${SWAGGER_VERSION}" != "${version}" ]]; then
echo false
return
fi
echo true
}
# swagger::install installs the swagger binary.
swagger::install() {
echo ">>>> install swagger-${SWAGGER_VERSION} <<<<"
local url
url="https://github.com/go-swagger/go-swagger/releases/download/${SWAGGER_VERSION}/swagger_linux_amd64"
wget --quiet -O /usr/local/bin/swagger "${url}"
chmod +x /usr/local/bin/swagger
}