太初行更新脚本修改

main
grimm 2024-07-25 14:25:11 +08:00
parent e5c3964e12
commit 2fb38c03e2
1 changed files with 43 additions and 53 deletions

View File

@ -138,7 +138,7 @@ game_send_package() {
;;
esac
else
for ip in $(awk '{print $2}' "txt/$channel")
for ip in $(awk '{print $2}' "txt/$channel.txt")
do
unzip_package $ip $package $source_tar $destination_dir
case $input in
@ -239,7 +239,7 @@ game_code_official(){
read -rp "请输入ip地址或文件名称(不需要带文件后缀): " channel
read -rp "是否需要重启Y/N" reboot
echo -e "开始发送 包名:$package, 渠道:$channel"
game_send_package "$channel.txt" "$package" "$reboot"
game_send_package "$channel" "$package" "$reboot"
}
# 通用游戏服更新函数
@ -260,28 +260,25 @@ game_update_option() {
esac
}
# gm更新
update_gm(){
while true; do
echo -e "${blue}************************************${NC}"
echo -e "${purple}开始更新GM后台...${NC}"
echo -e "1.打包"
echo -e "2.单机器更新"
echo -e "3.批量更新"
echo -e "0.返回主菜单"
echo -e "*.${red}其他任意键退出程序${NC}"
echo -e "${blue}************************************${NC}"
read -rp "请输入选项编号: " choice
case $choice in
1) gm_option "package" ;; # GM更新打包
2) gm_option "single_update" ;; # GM更新单机器更新
3) gm_option "batch_update" ;; # GM更新批量更新
0) return ;;
*) exit_script ;;
esac
done
}
# 更新gm
gm_send_package() {
local channel=${1}
local package=${2}
local source_tar="/data/update/package"
local destination_dir="/data/jieling/gm"
if is_valid_ip "$channel"; then
unzip_package "$channel" $package $source_tar $destination_dir
restart_server "admin" "$channel"
else
# shellcheck disable=SC2013
for ip in $(awk '{print $2}' "txt/$channel.txt")
do
unzip_package "$ip" $package $source_tar $destination_dir
restart_server "admin" "$ip"
done
fi
}
# 通用GM更新函数
gm_option() {
local action=$1
@ -295,20 +292,13 @@ gm_option() {
bash "update_gm.sh" "$project" "$package"
echo -e "gm打包完成 $package"
;;
"single_update")
read -rp "请输入游戏服ip: " ip
show_file package | grep "gm"
read -rp "请输入包名(不需要带文件后缀):" package
echo -e "开始更新gm $ip $package"
gm_send_package "$ip" "$package"
;;
"batch_update")
"update")
show_file script/txt
read -rp "请输入文件名称(不需要带文件后缀): " channel
read -rp "请输入ip地址或文件名称(不需要带文件后缀): " channel
show_file package | grep "gm"
read -rp "请输入包名(不需要带文件后缀):" package
echo -e "开始更新gm $channel.txt $package"
gm_send_package "$channel.txt" "$package"
echo -e "开始更新gm $channel $package"
gm_send_package "$channel" "$package"
;;
*)
echo -e "${red}无效的选项,请重新输入${NC}"
@ -317,27 +307,27 @@ gm_option() {
;;
esac
}
# 更新gm
gm_send_package() {
local channel=${1}
local package=${2}
local source_tar="/data/update/package"
local destination_dir="/data/jieling/gm"
if is_valid_ip "$channel"; then
unzip_package "$channel" $package $source_tar $destination_dir
restart_server "admin" "$channel"
else
# shellcheck disable=SC2013
for ip in $(awk '{print $2}' "txt/$channel")
do
unzip_package "$ip" $package $source_tar $destination_dir
restart_server "admin" "$ip"
done
fi
# gm更新
update_gm(){
while true; do
echo -e "${blue}************************************${NC}"
echo -e "${purple}开始更新GM后台...${NC}"
echo -e "1.打包"
echo -e "2.更新"
echo -e "0.返回主菜单"
echo -e "*.${red}其他任意键退出程序${NC}"
echo -e "${blue}************************************${NC}"
read -rp "请输入选项编号: " choice
case $choice in
1) gm_option "package" ;; # GM更新打包
2) gm_option "update" ;; # GM更新更新
0) return ;;
*) exit_script ;;
esac
done
}
# 登陆服更新
update_login(){
while true; do