diff --git a/shell/core/sync.sh b/shell/core/sync.sh index 55313e2e..6d9958fd 100755 --- a/shell/core/sync.sh +++ b/shell/core/sync.sh @@ -75,11 +75,10 @@ function gen_repoconf_array() { # echo -e "$WARN 未检测到第$(($arr_index + 1))个仓库配置的链接地址,跳过..." continue fi - # 判断仓库地址格式 + # 判断仓库地址格式,没有 .git 后缀则自动补上 echo "${tmp_url}" | grep -Eq "\.git$" # 链接必须以.git结尾 if [ $? -ne 0 ]; then - echo -e "$WARN 检测到第$(($conf_index + 1))个仓库配置的链接地址无效,跳过..." - continue + tmp_url="${tmp_url}.git" fi echo "${tmp_url}" | grep -Eq "https?:" if [ $? -ne 0 ]; then @@ -100,10 +99,10 @@ function gen_repoconf_array() { ## 代码仓库名称(如若未定义则采用链接地址中的仓库名称) Array_Repo_name[$conf_index]="$(get_config_wrapper "name")" if [[ -z "${Array_Repo_name[conf_index]}" ]]; then - Array_Repo_name[$conf_index]="$(echo ${Array_Repo_url[conf_index]} | sed "s|\.git||g" | awk -F "/|:" '{print$NF}')" + Array_Repo_name[$conf_index]="$(echo ${Array_Repo_url[conf_index]} | awk -F "/|:" '{print$NF}')" fi ## 代码仓库路径 - Array_Repo_dir[$conf_index]="$(echo "${Array_Repo_url[conf_index]}" | sed "s|\.git||g" | awk -F "/|:" '{print $((NF - 1)) "_" $NF}')" + Array_Repo_dir[$conf_index]="$(echo "${Array_Repo_url[conf_index]}" | awk -F "/|:" '{print $((NF - 1)) "_" $NF}')" Array_Repo_path[$conf_index]="$RepoDir/${Array_Repo_dir[conf_index]}" ## 代码仓库启用状态(默认启用) if [[ "$(get_config_wrapper_bool "enable" "true")" == "false" ]]; then diff --git a/shell/update/git.sh b/shell/update/git.sh index 6e2776fb..80f80848 100755 --- a/shell/update/git.sh +++ b/shell/update/git.sh @@ -45,7 +45,7 @@ function git_clone_with_http_auth() { if [[ "${url}" == http*://* ]] && [[ "${url}" != http*://*:*@* ]]; then local protocol=$(echo $url | awk -F/ '{print $1}') local baseurl=$(echo $url | awk -F/ '{print $3}') - url="${protocol}//${username}:${password}@${url#"$protocol"//"$baseurl"}" + url="${protocol}//${username}:${password}@${baseurl}${url#"$protocol"//"$baseurl"}" fi git_clone "${url}" "${dir}" "${branch}" "${text}" @@ -109,7 +109,7 @@ function reset_romote_url_with_http_auth() { if [[ "${url}" == http*://* ]] && [[ "${url}" != http*://*:*@* ]]; then local protocol=$(echo $url | awk -F/ '{print $1}') local baseurl=$(echo $url | awk -F/ '{print $3}') - url="${protocol}//${username}:${password}@${url#"$protocol"//"$baseurl"}" + url="${protocol}//${username}:${password}@${baseurl}${url#"$protocol"//"$baseurl"}" fi reset_romote_url "${work_dir}" "${url}" diff --git a/shell/utils/dep.sh b/shell/utils/dep.sh index 9baf2680..173e8c2d 100755 --- a/shell/utils/dep.sh +++ b/shell/utils/dep.sh @@ -379,7 +379,7 @@ function pip_dep_install() { echo "[dep.sh] ERROR: pip3 is not installed" >&2 return 1 } - pip3 install --no-cache-dir --break-system-packages "${pkg}" + pip3 install --no-cache-dir --break-system-packages --ignore-installed "${pkg}" } function pip_dep_uninstall() {