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

345

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