fix: install package on MinGW64

This commit is contained in:
debugtalk
2022-06-05 20:48:26 +08:00
parent df212161a2
commit baaf2b8335
2 changed files with 23 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
- fix #1331: use `str_eq` to assert string and digit equality - fix #1331: use `str_eq` to assert string and digit equality
- fix #1336: extract package with tar in Windows - fix #1336: extract package with tar in Windows
- fix: install package on MinGW64
## v4.1.1 (2022-05-31) ## v4.1.1 (2022-05-31)

View File

@@ -44,24 +44,37 @@ function main() {
echo "$version" echo "$version"
exit 1 exit 1
fi fi
echo "Latest version: $version"
os=$(get_os) os=$(get_os)
echo "Current OS: $os" echo "Current OS: $os"
if [[ $os == mingw* ]]; then
echoWarn "Current OS is MinGW, try to use windows package"
os="windows"
fi
arch=$(get_arch) arch=$(get_arch)
echo "Current ARCH: $arch" echo "Current ARCH: $arch"
pkg_suffix=".tar.gz" pkg_suffix=".tar.gz"
pkg="hrp-$version-$os-$arch$pkg_suffix" pkg="hrp-$version-$os-$arch$pkg_suffix"
echo "Download package: $pkg"
# download from aliyun OSS # download from aliyun OSS or github packages
url="https://httprunner.oss-cn-beijing.aliyuncs.com/$pkg" aliyun_oss_url="https://httprunner.oss-cn-beijing.aliyuncs.com/$pkg"
if ! curl --output /dev/null --silent --head --fail "$url"; then github_url="https://github.com/httprunner/httprunner/releases/download/$version/$pkg"
# aliyun OSS url is invalid, try to download from github valid_flag=false
version=$(get_latest_version) for url in "$aliyun_oss_url" "$github_url"; do
pkg="hrp-$version-$os-$arch$pkg_suffix" if curl --output /dev/null --silent --head --fail "$url"; then
url="https://github.com/httprunner/httprunner/releases/download/$version/$pkg" valid_flag=true
break
fi
echoWarn "Invalid download url: $url"
done
if [[ "$valid_flag" == false ]]; then
echoError "No available download url found, exit!"
exit 1
fi fi
echo "Latest version: $version"
echo "Download url: $url" echo "Download url: $url"
echo echo