Skip to content

Commit 746a308

Browse files
authored
Merge pull request #1196 from cyw3/main
🎨 Adapt to cnb
2 parents 6b8545d + 3a0a6fc commit 746a308

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

scripts/base/install_bin.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ source $TCA_SCRIPT_ROOT/utils.sh
1010
TCA_ROOT=$( cd "$(dirname $TCA_SCRIPT_ROOT)"; pwd )
1111
LIB_GITHUB_URL=${LIB_GITHUB_URL:-"https://github.com/TCATools/tca_lib/releases/download/v20241015.1/tca_lib-v1.8.zip"}
1212
LIB_GONGFENG_URL=${LIB_GONGFENG_URL:-"https://git.code.tencent.com/TCA/tca-tools/tca_lib.git#v20241015.1"}
13+
LIB_CNB_URL=${LIB_CNB_URL:-"https://cnb.cool/tca/tools/tca_lib.git#v20241015.1"}
1314
LIB_DIR_NAME="tca_lib"
1415

1516

@@ -38,10 +39,15 @@ function downloader() {
3839
# 使用工蜂默认密码
3940
user=$2
4041
password=$3
42+
auth=""
43+
if [[ "${user}" != "" ]] ; then
44+
auth=${user}:${password}@
45+
fi
46+
4147
# ${url: -11} 中间要有空格,才能是截取后几位
4248
# 2024/8/2 适配低版本的shell写法
4349
length=${#url}
44-
git clone -b ${url: -11} ${url:0:8}${user}:${password}@${url:8:length-20}
50+
git clone -b ${url: -11} ${url:0:8}${auth}${url:8:length-20}
4551
cmd_ret=$?
4652
if [[ ${cmd_ret} == 0 ]] ; then
4753
# 清理lib中无关文件
@@ -62,12 +68,17 @@ function readIni()
6268

6369
# 根据client中的配置来决定是下载github的还是工蜂的
6470
function download_lib() {
65-
user=$(readIni ${TCA_ROOT}/client/config.ini "TOOL_LOAD_ACCOUNT" "USERNAME")
66-
if [[ "${user}" == "" ]] ; then
71+
config_url=$(readIni ${TCA_ROOT}/client/config.ini "COMMON" "TOOL_CONFIG_URL")
72+
if [[ $config_url == *"github.com"* ]]; then
6773
downloader $LIB_GITHUB_URL
6874
else
69-
# 工蜂
70-
downloader $LIB_GONGFENG_URL $user $(readIni ${TCA_ROOT}/client/config.ini "TOOL_LOAD_ACCOUNT" "PASSWORD")
75+
if [[ $config_url == *"cnb.cool"* ]]; then
76+
downloader $LIB_CNB_URL
77+
else
78+
# 工蜂
79+
user=$(readIni ${TCA_ROOT}/client/config.ini "TOOL_LOAD_ACCOUNT" "USERNAME")
80+
downloader $LIB_GONGFENG_URL $user $(readIni ${TCA_ROOT}/client/config.ini "TOOL_LOAD_ACCOUNT" "PASSWORD")
81+
fi
7182
fi
7283
ret=$?
7384
if [[ $ret == 0 ]]; then

0 commit comments

Comments
 (0)