diff --git a/bin/update_docker_images.sh b/bin/update_docker_images.sh index 7f126b7..d629a71 100644 --- a/bin/update_docker_images.sh +++ b/bin/update_docker_images.sh @@ -1,19 +1,19 @@ #!/bin/bash -script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径 -docker_compose_file="$script_dir/../docker-compose.yml" # docker-compose.yml文件路径 +SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径 +DOCKER_COMPOSE_FILE="$SCRIPT_DIR/../docker-compose.yml" # docker-compose.yml文件路径 # 检查是否存在 docker-compose.yml 文件 -if [ ! -f $docker_compose_file ]; then +if [ ! -f $DOCKER_COMPOSE_FILE ]; then echo "Error: docker-compose.yml 文件不存在." exit 1 fi echo "正在关闭容器.." -docker-compose -f $docker_compose_file down +docker-compose -f $DOCKER_COMPOSE_FILE down echo "正在更新镜像.." -docker-compose -f $docker_compose_file pull +docker-compose -f $DOCKER_COMPOSE_FILE pull echo "正在启动容器.." -docker-compose -f $docker_compose_file up -d \ No newline at end of file +docker-compose -f $DOCKER_COMPOSE_FILE up -d \ No newline at end of file diff --git a/bin/update_key.sh b/bin/update_key.sh index 132d304..6fea243 100644 --- a/bin/update_key.sh +++ b/bin/update_key.sh @@ -1,16 +1,16 @@ #!/bin/bash -script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径 -config_dir="$script_dir/../conf" +SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径 +CONFIG_DIR="$SCRIPT_DIR/../conf" # Save keys to key.txt -xray x25519 > $config_dir/key.txt +xray x25519 > $CONFIG_DIR/key.txt -private_key=$(grep "Private key" $config_dir/key.txt | awk -F ': ' '{print $2}') +PRIVATE_KEY=$(grep "Private key" $CONFIG_DIR/key.txt | awk -F ': ' '{print $2}') # 修改config.json密钥属性 -jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$private_key\"" $config_dir/config.json > $config_dir/config_temp.json -mv $config_dir/config_temp.json $config_dir/config.json +jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$PRIVATE_KEY\"" $CONFIG_DIR/config.json > $CONFIG_DIR/config_temp.json +mv $CONFIG_DIR/config_temp.json $CONFIG_DIR/config.json echo "生成和设置密钥成功."