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

This commit is contained in:
Olia Lisa
2026-01-15 12:25:16 +08:00
parent d5833833e0
commit 3715554dc2
11 changed files with 23 additions and 58 deletions
-9
View File
@@ -1,10 +1,5 @@
#!/bin/bash
# 导入依赖脚本文件
for f in $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils/*.sh; do
source "$f"
done
create_config_with_tls_cert() {
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
@@ -106,7 +101,3 @@ create_config(){
esac
}
create_config
-8
View File
@@ -1,11 +1,5 @@
#!/bin/bash
# 导入依赖脚本文件
for f in $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils/*.sh; do
source "$f"
done
# 生成自签名证书
gen_self_tls() {
local domain="${1:-bing.com}"
@@ -27,5 +21,3 @@ gen_self_tls() {
modify_json_file "$config_file" "inbounds[0].tls.server_name" "$domain"
}
# 调用函数,传入第一个参数作为域名
gen_self_tls "${1:-bing.com}"
-1
View File
@@ -56,4 +56,3 @@ print_share_link() {
echo -e "\033[0m"
}
print_share_link # 输出分享链接
-2
View File
@@ -1,6 +1,5 @@
#!/bin/bash
run() {
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
@@ -14,4 +13,3 @@ run() {
docker-compose -f "$script_dir/../docker-compose.yml" up -d
}
run # 启动容器
+1 -2
View File
@@ -3,7 +3,7 @@
update_docker_images(){
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
docker_compose_file="$script_dir/../docker-compose.yml" # docker-compose.yml文件路径
local docker_compose_file="$script_dir/../docker-compose.yml" # docker-compose.yml文件路径
# 检查是否存在 docker-compose.yml 文件
if [ ! -f $docker_compose_file ]; then
@@ -24,4 +24,3 @@ update_docker_images(){
docker-compose -f $docker_compose_file up -d
}
update_docker_images
-6
View File
@@ -1,11 +1,5 @@
#!/bin/bash
# 导入依赖脚本文件
for f in $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils/*.sh; do
source "$f"
done
# 修改域名
update_domain(){
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
-5
View File
@@ -1,10 +1,5 @@
#!/bin/bash
# 导入依赖脚本文件
for f in $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils/*.sh; do
source "$f"
done
# 更新密码的函数
update_password() {
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
-5
View File
@@ -1,10 +1,5 @@
#!/bin/bash
# 导入依赖脚本文件
for f in $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils/*.sh; do
source "$f"
done
# 查找随机空闲端口
# 用途:
# 在指定端口范围内,随机选择一个当前未被监听(TCP/UDP)的端口
-5
View File
@@ -1,10 +1,5 @@
#!/bin/bash
# 导入依赖脚本文件
for f in $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils/*.sh; do
source "$f"
done
update_uuid(){
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
local config_file="$script_dir/../config/config.json"
-2
View File
@@ -1,8 +1,6 @@
#!/bin/bash
# 修改json文件的属性值
# 案例1modify_json_file "/foo/bar.json" "person.name" "张三"
# 案例2modify_json_file "/foo/bar.json" "servers" '["a.com", "b.com"]'