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

345

上级 495d70a4
#!/bin/bash
install_dir="/home/deploy/wkgameplat"
Install_Dir="/home/deploy/wkgameplat"
GamePlat_ranch=1031_Game_JinSha
GameWeb_ranch=1031_Game_JinSha
GamePlatName=1031_Game_JinSha
GameSvr_Ranch=1031_Game_JinSha
GameWeb_Ranch=1031_Game_JinSha
Svr_Repo_Url="git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_svr.git"
Svr_Base_Dir="./svr"
Svr_Branches=(
$GamePlat_ranch
$GameSvr_Ranch
)
Web_Repo_Url="git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_web.git"
Web_Base_Dir="./web"
Web_Branches=(
$GamePlat_ranch
$GameWeb_Ranch
)
if [ ! -d "$install_dir" ]; then
mkdir -p "$install_dir"
if [ ! -d "$Install_Dir" ]; then
mkdir -p "$Install_Dir"
fi
cd $install_dir
cd $Install_Dir
echo_content() {
local color="$1"
local text="$2"
local opt="$3" # 第三个参数用于传 -n
local ECHO_TYPE="echo -e"
[ "$opt" = "-n" ] && ECHO_TYPE="echo -en"
case "$color" in
"red") $ECHO_TYPE "\033[31m${text}\033[0m" ;;
"green") $ECHO_TYPE "\033[32m${text}\033[0m" ;;
"yellow") $ECHO_TYPE "\033[33m${text}\033[0m" ;;
"blue") $ECHO_TYPE "\033[34m${text}\033[0m" ;;
"purple") $ECHO_TYPE "\033[35m${text}\033[0m" ;;
"skyBlue") $ECHO_TYPE "\033[36m${text}\033[0m" ;;
"white") $ECHO_TYPE "\033[37m${text}\033[0m" ;;
local tmp_color="$1" # 颜色
local tmp_text="$2" # 文本
local tmp_opt="$3" # 第三个参数用于传 -n
local tmp_echo_type="echo -e"
[ "$tmp_opt" = "-n" ] && tmp_echo_type="echo -en"
case "$tmp_color" in
"red") $tmp_echo_type "\033[31m${tmp_text}\033[0m" ;;
"green") $tmp_echo_type "\033[32m${tmp_text}\033[0m" ;;
"yellow") $tmp_echo_type "\033[33m${tmp_text}\033[0m" ;;
"blue") $tmp_echo_type "\033[34m${tmp_text}\033[0m" ;;
"purple") $tmp_echo_type "\033[35m${tmp_text}\033[0m" ;;
"skyBlue") $tmp_echo_type "\033[36m${tmp_text}\033[0m" ;;
"white") $tmp_echo_type "\033[37m${tmp_text}\033[0m" ;;
esac
}
check_install_dependencies() {
bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/deps_gameplat.sh) check_install_dependencies
Fun_Script_Url=http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master
check_install_deps() {
bash <(curl -sSL $Fun_Script_Url/fun_deps.sh) check_install_deps
}
check_gitaccount() {
bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh) check_gitaccount
bash <(curl -sSL $Fun_Script_Url/fun_git.sh) check_gitaccount
}
fetch_git_platsvr() {
bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh) fetch_git_platsvr $Svr_Repo_Url $Svr_Base_Dir $Svr_Branches
bash <(curl -sSL $Fun_Script_Url/fun_git.sh) fetch_git_platsvr $Svr_Repo_Url $Svr_Base_Dir $Svr_Branches
}
fetch_git_platweb() {
bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh) fetch_git_platweb $Web_Repo_Url $Web_Base_Dir $Web_Branches
bash <(curl -sSL $Fun_Script_Url/fun_git.sh) fetch_git_platweb $Web_Repo_Url $Web_Base_Dir $Web_Branches
}
linux_docker() {
bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/docker.sh) linux_docker
bash <(curl -sSL $Fun_Script_Url/fun_docker.sh) linux_docker
}
run_docker() {
cd ./svr/$GamePlat_ranch/docker-base || exit
cd ./svr/$GameSvr_Ranch/docker-base || exit
make up
cd ../../..
cd ./svr/$GamePlat_ranch/docker-game || exit
cd ./svr/$GameSvr_Ranch/docker-game || exit
make up
cd ../../..
cd ./svr/$GamePlat_ranch/docker-proxy || exit
cd ./svr/$GameSvr_Ranch/docker-proxy || exit
make up
cd ../../..
}
run_service() {
cd ./svr/server || exit
cd ./svr/$GameSvr_Ranch/server || exit
make export_env
make start
cd ../..
cd ../../..
}
# ------------------ 数组定义菜单项 ------------------
......@@ -116,7 +119,7 @@ main() {
while true; do
clear
echo_content "skyBlue" "============================"
echo_content "red" " 安装游戏平台($GamePlat_ranch) "
echo_content "red" " 安装游戏平台($GamePlatName) "
echo_content "skyBlue" "============================"
for i in "${!MENU_ITEMS[@]}"; do
# printf " %2d) %s\n" "$((i + 1))" "${MENU_ITEMS[$i]}"
......@@ -125,7 +128,6 @@ main() {
echo_content "green" "${MENU_ITEMS[$i]}"
done
echo_content "skyBlue" "============================"
# read -r -p "请选择操作: " choice
echo_content "skyBlue" "请选择操作: " -n
read -r choice
......@@ -138,9 +140,6 @@ main() {
echo_content "skyBlue" "无效选择。"
fi
# echo
# echo_content "skyBlue" "按任意键继续..." -n
# read -n 1 -s -r -p "按任意键继续..."
echo_content "yellow" "按任意键继续..." -n
read -n 1 -s -r
echo # 输入后换行(可选)
......@@ -148,7 +147,7 @@ main() {
}
# ======= 安装默认工具 =======
check_install_dependencies
check_install_deps
# ======= 启动程序 =======
main
......@@ -8,7 +8,7 @@
# npm
# pm2
check_install_dependencies() {
check_install_deps() {
for cmd in jq curl docker make unzip nodejs npm pm2; do
if ! command -v "$cmd" &>/dev/null; then
echo "❌ 缺少依赖:$cmd"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论