太初行更新脚本修改

main
grimm 2024-07-24 17:39:14 +08:00
parent 918d2398ee
commit e5c3964e12
1 changed files with 46 additions and 62 deletions

View File

@ -125,37 +125,31 @@ game_send_package() {
local source_tar="/data/update/package/"
local destination_dir="/data/jieling/server"
# 停服更新
if [[ $reboot -eq 1 ]]; then
if is_valid_ip "$channel"; then
unzip_package $channel $package $source_tar $destination_dir
read -r -p "更新完毕是否需要重启Y/N: " input
case $input in
[yY][eE][sS]|[yY])
restart_server "coreRestart" "$channel"
;;
*)
echo "over..."
exit 0
;;
esac
else
for ip in $(awk '{print $2}' "txt/$channel")
do
unzip_package $ip $package $source_tar $destination_dir
restart_server "super" "$ip"
done
fi
if is_valid_ip "$channel"; then
unzip_package $channel $package $source_tar $destination_dir
case $input in
[yY][eE][sS]|[yY])
restart_server "coreRestart" "$channel"
;;
*)
echo "over..."
exit 0
;;
esac
else
# 热更新
if is_valid_ip "$channel"; then
unzip_package $channel $package $source_tar $destination_dir
else
for ip in $(awk '{print $2}' "txt/$channel")
do
unzip_package $ip $package $source_tar $destination_dir
done
fi
for ip in $(awk '{print $2}' "txt/$channel")
do
unzip_package $ip $package $source_tar $destination_dir
case $input in
[yY][eE][sS]|[yY])
restart_server "super" "$ip"
;;
*)
echo "over..."
;;
esac
done
fi
}
@ -166,10 +160,9 @@ update_code() {
echo -e "${yellow}${server_name}更新${NC}"
read -rp "请输入${server_name}的ip地址: " ip
read -r -p "是否需要重启Y/N: " input
echo -e "开始更新${server_name}ip$ip"
bash "${update_script}" "$ip"
read -r -p "更新完毕是否需要重启Y/N: " input
case $input in
[yY][eE][sS]|[yY])
restart_server "$server_name" "$ip"
@ -224,24 +217,6 @@ update_game(){
done
}
# 通用游戏服更新函数
game_update_option() {
local action=$1
case $action in
"create_update_package") game_code_build "update" "update_game.sh" ;;
"official_reboot") game_code_official "update" "1" ;;
"test_reboot") game_code_test "update" "1" ;;
"create_hotfix_package") game_code_build "hotfix" "hotfix_game.sh" ;;
"official_hotfix") game_code_official "hotfix" "0" ;;
"test_hotfix") game_code_test "hotfix" "0" ;;
*)
echo -e "${red}无效的选项,请重新输入${NC}"
handle_menu
return
;;
esac
}
# 游戏代码打包
game_code_build(){
local type=$1
@ -254,26 +229,35 @@ game_code_build(){
echo -e "包名: $package"
bash "${script}" "${project}" "${package}"
}
# 游戏代码正式更新
game_code_official(){
local type=$1
local reboot=$2
show_file package | grep "${type}"
read -rp "请输入包名(不需要带文件后缀):" package
show_file script/txt
read -rp "请输入文件名称(不需要带文件后缀): " channel
read -rp "请输入ip地址或文件名称(不需要带文件后缀): " channel
read -rp "是否需要重启Y/N" reboot
echo -e "开始发送 包名:$package, 渠道:$channel"
game_send_package "${channel}.txt" "$package" "${reboot}"
game_send_package "$channel.txt" "$package" "$reboot"
}
# 游戏代码测试更新
game_code_test(){
local type=$1
local reboot=$2
show_file package | grep "${type}"
read -rp "请输入包名(不需要带文件后缀):" package
read -rp "请输入游戏服ip: " ip
echo -e "开始发送 包名:$package, ip$ip"
game_send_package "$ip" "$package" "${reboot}"
# 通用游戏服更新函数
game_update_option() {
local action=$1
case $action in
"create_update_package") game_code_build "update" "update_game.sh" ;;
"official_reboot") game_code_official "update" ;;
"test_reboot") game_code_official "update" ;;
"create_hotfix_package") game_code_build "hotfix" "hotfix_game.sh" ;;
"official_hotfix") game_code_official "hotfix" ;;
"test_hotfix") game_code_official "hotfix" ;;
*)
echo -e "${red}无效的选项,请重新输入${NC}"
handle_menu
return
;;
esac
}
# gm更新