重构代码,统一项目入口为install.sh

This commit is contained in:
Olia Lisa
2026-01-15 13:38:07 +08:00
parent 737378d7ee
commit 2c4a44f924
11 changed files with 55 additions and 73 deletions
+19 -32
View File
@@ -1,26 +1,13 @@
#!/bin/bash
restart_docker() {
# 如果容器未运行,提示启动
local running_count=$(docker-compose -f ./docker-compose.yml ps -q | wc -l)
if [ "$running_count" -eq 0 ]; then
read -p "容器未启动,是否启动容器?(y/n): " choice
case "$choice" in
Y|y)
docker-compose -f ./docker-compose.yml up -d
return
;;
*)
echo "已取消启动"
return
;;
esac
fi
echo "正在重启容器..."
docker-compose -f ./docker-compose.yml down
docker-compose -f ./docker-compose.yml up -d
}
# 导入依赖脚本文件
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
for f in "$BASE_DIR"/bin/utils/*.sh; do
[ -f "$f" ] && source "$f"
done
for f in "$BASE_DIR"/bin/*.sh; do
[ -f "$f" ] && source "$f"
done
# 安装依赖
@@ -74,27 +61,27 @@ main(){
# 根据用户选择执行相应的操作
case $choice in
1)
1)
# 一键部署
install_dependencies
bash $script_dir/create_config.sh
bash $script_dir/run.sh
bash $script_dir/print_share_link.sh
create_config
run
print_share_link
;;
2)
# 创建配置 / 重置配置
bash $script_dir/create_config.sh
create_config
;;
3)
# 查看分享链接
check_config
bash $script_dir/print_share_link.sh
print_share_link
;;
4)
# 启动容器
check_config
bash $script_dir/run.sh
bash $script_dir/print_share_link.sh
run
print_share_link
;;
5)
# 停止容器
@@ -102,18 +89,18 @@ main(){
;;
6)
# 更新镜像
bash $script_dir/update_docker_images.sh
update_docker_images
;;
7)
# 修改端口
check_config
bash $script_dir/update_port.sh
update_port
restart_docker
;;
8)
# 修改Reality目标域名
check_config
bash $script_dir/update_reality_dest.sh
update_reality_dest
restart_docker
;;
*)