2020-10-07 13:49:40 +05:00
|
|
|
#!/bin/bash -e
|
2020-04-13 17:38:35 +03:00
|
|
|
################################################################################
|
2023-11-22 21:49:23 +01:00
|
|
|
## File: install-aliyun-cli.sh
|
|
|
|
|
## Desc: Install Alibaba Cloud CLI
|
2023-10-22 15:47:36 +02:00
|
|
|
## Supply chain security: Alibaba Cloud CLI - checksum validation
|
2020-04-13 17:38:35 +03:00
|
|
|
################################################################################
|
|
|
|
|
|
2021-04-02 18:47:50 +03:00
|
|
|
# Source the helpers for use with the script
|
2023-08-17 19:06:48 +02:00
|
|
|
source $HELPER_SCRIPTS/os.sh
|
2021-04-02 18:47:50 +03:00
|
|
|
source $HELPER_SCRIPTS/install.sh
|
|
|
|
|
|
2020-04-13 17:38:35 +03:00
|
|
|
# Install Alibaba Cloud CLI
|
2023-08-17 19:06:48 +02:00
|
|
|
# Pin tool version on ubuntu20 due to issues with GLIBC_2.32 not available
|
2023-12-26 12:50:52 +01:00
|
|
|
if is_ubuntu20; then
|
2023-10-22 15:47:36 +02:00
|
|
|
toolset_version=$(get_toolset_value '.aliyunCli.version')
|
|
|
|
|
download_url="https://github.com/aliyun/aliyun-cli/releases/download/v$toolset_version/aliyun-cli-linux-$toolset_version-amd64.tgz"
|
2023-08-17 19:06:48 +02:00
|
|
|
else
|
2023-12-06 14:01:37 +01:00
|
|
|
download_url=$(resolve_github_release_asset_url "aliyun/aliyun-cli" "contains(\"aliyun-cli-linux\") and endswith(\"amd64.tgz\")" "latest")
|
2023-10-22 15:47:36 +02:00
|
|
|
hash_url="https://github.com/aliyun/aliyun-cli/releases/latest/download/SHASUMS256.txt"
|
2023-08-17 19:06:48 +02:00
|
|
|
fi
|
|
|
|
|
|
2023-11-29 20:25:29 +01:00
|
|
|
archive_path=$(download_with_retry "$download_url")
|
2023-10-22 15:47:36 +02:00
|
|
|
|
|
|
|
|
# Supply chain security - Alibaba Cloud CLI
|
2023-12-26 12:50:52 +01:00
|
|
|
if is_ubuntu20; then
|
2023-11-17 16:31:49 +01:00
|
|
|
external_hash=$(get_toolset_value '.aliyunCli.sha256')
|
|
|
|
|
else
|
2023-12-25 19:47:58 +01:00
|
|
|
external_hash=$(get_checksum_from_url "$hash_url" "aliyun-cli-linux.*amd64.tgz" "SHA256")
|
2023-11-17 16:31:49 +01:00
|
|
|
fi
|
|
|
|
|
|
2023-11-29 20:25:29 +01:00
|
|
|
use_checksum_comparison "$archive_path" "$external_hash"
|
2023-10-22 15:47:36 +02:00
|
|
|
|
2023-11-29 20:25:29 +01:00
|
|
|
tar xzf "$archive_path"
|
2020-04-13 17:38:35 +03:00
|
|
|
mv aliyun /usr/local/bin
|
|
|
|
|
|
2020-12-21 23:35:22 +03:00
|
|
|
invoke_tests "CLI.Tools" "Aliyun CLI"
|