提交 d8346ee2 authored 作者: Andy's avatar Andy

123

上级 8650bba4
...@@ -39,27 +39,25 @@ cd $install_dir ...@@ -39,27 +39,25 @@ cd $install_dir
# esac # esac
# } # }
echo_content() { echo_content() {
local color="$1" local color="$1"
local text="$2" local text="$2"
local opt="$3" # 第三个参数用于传 -n local opt="$3" # 第三个参数用于传 -n
local ECHO_TYPE="echo -e" local ECHO_TYPE="echo -e"
[ "$opt" = "-n" ] && ECHO_TYPE="echo -en" [ "$opt" = "-n" ] && ECHO_TYPE="echo -en"
case "$color" in case "$color" in
"red") $ECHO_TYPE "\033[31m${text}\033[0m" ;; "red") $ECHO_TYPE "\033[31m${text}\033[0m" ;;
"green") $ECHO_TYPE "\033[32m${text}\033[0m" ;; "green") $ECHO_TYPE "\033[32m${text}\033[0m" ;;
"yellow") $ECHO_TYPE "\033[33m${text}\033[0m" ;; "yellow") $ECHO_TYPE "\033[33m${text}\033[0m" ;;
"blue") $ECHO_TYPE "\033[34m${text}\033[0m" ;; "blue") $ECHO_TYPE "\033[34m${text}\033[0m" ;;
"purple") $ECHO_TYPE "\033[35m${text}\033[0m" ;; "purple") $ECHO_TYPE "\033[35m${text}\033[0m" ;;
"skyBlue") $ECHO_TYPE "\033[36m${text}\033[0m" ;; "skyBlue") $ECHO_TYPE "\033[36m${text}\033[0m" ;;
"white") $ECHO_TYPE "\033[37m${text}\033[0m" ;; "white") $ECHO_TYPE "\033[37m${text}\033[0m" ;;
esac esac
} }
# 更新分支函数(带更新前恢复) # 更新分支函数(带更新前恢复)
update_branch() { update_branch() {
local repo_url=$1 local repo_url=$1
...@@ -142,23 +140,47 @@ fetch_git_platsvr() { ...@@ -142,23 +140,47 @@ fetch_git_platsvr() {
done done
} }
# fetch_git_platweb() {
# REPO_URL="git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_web.git"
# BASE_DIR="./web"
# MAX_RETRY=3 # 最大重试次数
# BRANCHES=(
# $GamePlat_ranch
# )
# # 主循环
# for BRANCH in "${BRANCHES[@]}"; do
# TARGET_DIR="$BASE_DIR/$BRANCH"
# if [ -d "$TARGET_DIR/.git" ]; then
# update_branch "$REPO_URL" "$BRANCH" "$TARGET_DIR"
# else
# clone_branch "$REPO_URL" "$BRANCH" "$TARGET_DIR"
# fi
# done
# }
Web_Repo_Url="git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_web.git"
Web_Base_Dir="./web"
Web_Branches=(
$GamePlat_ranch
)
fetch_git_platweb() { fetch_git_platweb() {
REPO_URL="git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_web.git" local tmp_web_repo_url=$1
BASE_DIR="./web" local tmp_base_dir=$2
MAX_RETRY=3 # 最大重试次数 local tmp_branches=$3
BRANCHES=(
$GamePlat_ranch
)
# 主循环 # 主循环
for BRANCH in "${BRANCHES[@]}"; do for branch in "${tmp_branches[@]}"; do
TARGET_DIR="$BASE_DIR/$BRANCH" tmp_target_dir="$tmp_base_dir/$branch"
if [ -d "$TARGET_DIR/.git" ]; then if [ -d "$tmp_target_dir/.git" ]; then
update_branch "$REPO_URL" "$BRANCH" "$TARGET_DIR" update_branch "$tmp_web_repo_url" "$branch" "$tmp_target_dir"
else else
clone_branch "$REPO_URL" "$BRANCH" "$TARGET_DIR" clone_branch "$tmp_web_repo_url" "$branch" "$tmp_target_dir"
fi fi
done done
} }
...@@ -206,7 +228,7 @@ MENU_ITEMS=( ...@@ -206,7 +228,7 @@ MENU_ITEMS=(
MENU_ACTIONS=( MENU_ACTIONS=(
"bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh) check_gitaccount" "bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh) check_gitaccount"
"fetch_git_platsvr" "fetch_git_platsvr"
"fetch_git_platweb" "fetch_git_platweb Web_Repo_Url Web_Base_Dir Web_Branches"
"fetch_git_gameweb" "fetch_git_gameweb"
"run_docker" "run_docker"
"run_service" "run_service"
...@@ -245,9 +267,9 @@ main() { ...@@ -245,9 +267,9 @@ main() {
# echo # echo
# echo_content "skyBlue" "按任意键继续..." -n # echo_content "skyBlue" "按任意键继续..." -n
# read -n 1 -s -r -p "按任意键继续..." # read -n 1 -s -r -p "按任意键继续..."
echo_content "yellow" "按任意键继续..." -n echo_content "yellow" "按任意键继续..." -n
read -n 1 -s -r read -n 1 -s -r
echo # 输入后换行(可选) echo # 输入后换行(可选)
done done
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论