Support manual set ALIYUN_SDK_RUN_ON_MUSL_LIBC

This commit is contained in:
Zhong Lufan 2023-01-30 23:55:42 +08:00
parent 7e24386e51
commit 278d087239
No known key found for this signature in database
GPG Key ID: BE2B3A1E76AD7D04
2 changed files with 9 additions and 1 deletions

View File

@ -8,7 +8,7 @@ for _aliapi_command in openssl curl; do
done
unset _aliapi_command
_ALIYUN_SDK_RUN_ON_MUSL_LIBC=$(ldd "$SHELL" | grep -q /lib/ld-musl && echo 1 || echo 0)
[[ -v ALIYUN_SDK_RUN_ON_MUSL_LIBC ]] || ALIYUN_SDK_RUN_ON_MUSL_LIBC=$(ldd "$SHELL" | grep -q /lib/ld-musl && echo 1 || echo 0)
ALIYUN_SDK_LAST_HTTP_CODE=0

View File

@ -14,6 +14,14 @@
* curl # 网络请求
* openssl # 计算 HAMC-SHA1 签名
### 可选依赖
* ldd # 检查当前 Shell 是否使用 musl libc
* coreutils (`grep`) # 检查当前 Shell 是否使用 musl libc
> 由于 glibc 和 musl libc 之间的差异SDK 内部针对这两个不同的库做了些处理SDK 导入时会使用 ldd 对当前 Shell 进行检查,判断是否使用了 musl libc。
> 如果需要跳过检查,可以在导入 SDK 之前设置 `ALIYUN_SDK_RUN_ON_MUSL_LIBC` 变量,`1` 表示使用了 musl libc`0` 表示没有使用。
## 使用
1. 声明变量 `AliAccessKeyId``AliAccessKeySecret`