提交 4302d707 authored 作者: Andy's avatar Andy

12

上级 b7c1e6ea
#!/bin/bash
###################################################
# 安装路径
Install_Dir="/home/deploy/exch"
# 平台名
GamePlatName=1018_Exch_Bitget
# 分支
PlatSvr_Ranch=1018_Exch_Bitget
PlatWeb_Ranch=1018_Exch_Bitget
PlatAdmin_Ranch=admin
# git 地址
Git_PlatAddr=git.wkwork.xyz:LaunchDeploy
# git 路径
Git_ScriptAddr=git.wkwork.xyz/LaunchDeploy
###################################################
# 脚本地址前缀
Fun_Script_Url_Path=http://oauth2:QFF_7BNyjHsq_Zvfsfut@$Git_ScriptAddr/install/raw/master
PlatSvr_Repo_Url=git@$Git_PlatAddr/java_exch_svr.git
PlatSvr_Base_Dir=./$GamePlatName/platsvr
PlatSvr_Branches=(
$PlatSvr_Ranch
)
PlatWeb_Repo_Url=git@$Git_PlatAddr/java_exch_web.git
PlatWeb_Base_Dir=./$GamePlatName/platweb
PlatWeb_Branches=(
$PlatWeb_Ranch
)
PlatAdmin_Repo_Url=git@$Git_PlatAddr/java_exch_web.git
PlatAdmin_Base_Dir=./$GamePlatName/platadmin
PlatAdmin_Branches=(
$PlatAdmin_Ranch
)
if [ ! -d "$Install_Dir" ]; then
mkdir -p "$Install_Dir"
fi
cd $Install_Dir
echo_content() {
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_deps() {
bash <(curl -sSL $Fun_Script_Url_Path/fun_deps.sh) check_install_deps
bash <(curl -sSL $Fun_Script_Url_Path/fun_deps.sh) check_install_docker
}
check_gitaccount() {
bash <(curl -sSL $Fun_Script_Url_Path/fun_git.sh) check_gitaccount
}
fetch_git_platsvr() {
bash <(curl -sSL $Fun_Script_Url_Path/fun_git.sh) fetch_git $PlatSvr_Repo_Url $PlatSvr_Base_Dir $PlatSvr_Branches
}
fetch_git_platweb() {
bash <(curl -sSL $Fun_Script_Url_Path/fun_git.sh) fetch_git $PlatWeb_Repo_Url $PlatWeb_Base_Dir $PlatWeb_Branches
}
fetch_git_platadmin() {
bash <(curl -sSL $Fun_Script_Url_Path/fun_git.sh) fetch_git $PlatAdmin_Repo_Url $PlatAdmin_Base_Dir $PlatAdmin_Branches
}
linux_docker() {
bash <(curl -sSL $Fun_Script_Url_Path/fun_docker.sh) linux_docker
}
run_platsvr_docker() {
local current_dir=$(pwd)
cd $PlatSvr_Base_Dir/docker-base || exit
make up
cd $current_dir
cd $PlatSvr_Base_Dir/docker-proxy || exit
make up
cd $current_dir
}
run_service() {
local current_dir=$(pwd)
cd $PlatSvr_Base_Dir/docker-svr || exit
make up
cd $current_dir
}
# ------------------ 数组定义菜单项 ------------------
Memu_Items=(
"测试 Git 账户"
"获取 Plat Svr"
"获取 Plat Web"
"获取 Plat Admin"
"运行 PlatSvr Docker"
"运行 Server"
"Docker管理"
"结束"
)
# 每个编号对应一个函数(index 对齐 MENU_ITEMS)
Mennu_Actions=(
"check_gitaccount"
"fetch_git_platsvr"
"fetch_git_platweb"
"fetch_git_platadmin"
"run_platsvr_docker"
"run_service"
"linux_docker"
"exit 0"
)
main() {
# ------------------ 主循环 ------------------
while true; do
clear
echo_content "skyBlue" "============================"
echo_content "red" " 安装游戏平台($GamePlatName) "
echo_content "skyBlue" "============================"
for i in "${!Memu_Items[@]}"; do
# printf " %2d) %s\n" "$((i + 1))" "${Memu_Items[$i]}"
# echo_content "skyBlue" " $((i + 1))) ${Memu_Items[$i]}"
echo_content "white" " $((i + 1))) " -n
echo_content "green" "${Memu_Items[$i]}"
done
echo_content "skyBlue" "============================"
echo_content "skyBlue" "请选择操作: " -n
read -r choice
# 转为下标(减 1)
if [[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 1 ] && [ "$choice" -le "${#Memu_Items[@]}" ]; then
index=$((choice - 1))
echo_content "skyBlue" ">> 执行: ${Memu_Items[$index]}"
eval "${Mennu_Actions[$index]}"
else
echo_content "skyBlue" "无效选择。"
fi
echo_content "yellow" "按任意键继续..." -n
read -n 1 -s -r
echo # 输入后换行(可选)
done
}
# ======= 安装默认工具 =======
check_install_deps
# ======= 启动程序 =======
main
......@@ -11,6 +11,10 @@ bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/
0100_IndiaPlat_Dev
# java交易所
1018_Exch_Bitget
# ShopEc_Setup(Ec 商城)
ShopEc_Setup
#
......@@ -25,3 +29,5 @@ bash <(curl -sSL https://git.wkwork.xyz/LaunchDemo/install/raw/master/0000_php_s
# 商城安装
bash <(curl -sSL https://git.wkwork.xyz/root/install_sh/raw/master/%E5%95%86%E5%9F%8E_run.sh?1)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论