diff --git a/bin/create_config.sh b/bin/create_config.sh index 2610134..5eb71c8 100644 --- a/bin/create_config.sh +++ b/bin/create_config.sh @@ -1,4 +1,6 @@ #!/bin/bash +source "$(dirname "$0")/utils/base.sh" + create_config_with_tls_cert() { local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" diff --git a/bin/gen_self_tls.sh b/bin/gen_self_tls.sh index a089fa9..bd29d92 100644 --- a/bin/gen_self_tls.sh +++ b/bin/gen_self_tls.sh @@ -1,13 +1,12 @@ #!/bin/bash +source "$(dirname "$0")/utils/jq_util.sh" + # 生成自签名证书 gen_self_tls() { local domain="${1:-bing.com}" local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" local key_dir="$script_dir/../tls/self-tls" - - # 导入utils文件夹中的jq_util.sh脚本 - source "$script_dir/utils/jq_util.sh" # 生成自签名证书 mkdir -p "$key_dir" diff --git a/bin/print_share_link.sh b/bin/print_share_link.sh index 39b7a3c..35cf9b3 100644 --- a/bin/print_share_link.sh +++ b/bin/print_share_link.sh @@ -1,10 +1,11 @@ #!/bin/bash +source "$(dirname "$0")/utils/base.sh" + print_share_link() { local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" local config_dir=$(readlink -f "$script_dir/../config") local config_file="$config_dir/config.json" - source "${script_dir}/utils/base.sh" # 检查jq是否安装 check_jq diff --git a/bin/update_domain.sh b/bin/update_domain.sh index 758f94a..36da317 100644 --- a/bin/update_domain.sh +++ b/bin/update_domain.sh @@ -1,10 +1,11 @@ #!/bin/bash +source "$(dirname "$0")/utils/base.sh" +source "$(dirname "$0")/utils/jq_util.sh" + # 修改域名 update_domain(){ local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径 - source "$script_dir/utils/jq_util.sh" - source "$script_dir/utils/base.sh" local config_file="$script_dir/../config/config.json" # 检查jq是否安装 @@ -32,5 +33,4 @@ update_domain(){ } - update_domain diff --git a/bin/update_obfs_password.sh b/bin/update_obfs_password.sh index 2e1de78..d6d2619 100644 --- a/bin/update_obfs_password.sh +++ b/bin/update_obfs_password.sh @@ -1,14 +1,12 @@ #!/bin/bash +source "$(dirname "$0")/utils/base.sh" +source "$(dirname "$0")/utils/jq_util.sh" # 更新密码的函数 update_obfs_password() { local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" local config_file="$script_dir/../config/config.json" - # 加载工具脚本 - source "$script_dir/utils/jq_util.sh" - source "$script_dir/utils/base.sh" - # 检查jq是否安装 check_jq diff --git a/bin/update_password.sh b/bin/update_password.sh index 9c93615..b1f0430 100644 --- a/bin/update_password.sh +++ b/bin/update_password.sh @@ -1,14 +1,12 @@ #!/bin/bash +source "$(dirname "$0")/utils/base.sh" +source "$(dirname "$0")/utils/jq_util.sh" # 更新密码的函数 update_password() { local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" local config_file="$script_dir/../config/config.json" - # 加载工具脚本 - source "$script_dir/utils/jq_util.sh" - source "$script_dir/utils/base.sh" - # 检查jq是否安装 check_jq