优化 update_uuid.sh 中的路径获取逻辑,确保正确引用配置文件
This commit is contained in:
parent
5e1d79f23c
commit
9a075eae8d
@ -1,15 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
update_uuid(){
|
||||
|
||||
local script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件夹绝对路径
|
||||
local config_dir="$script_dir/../config"
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
|
||||
local config_file="$script_dir/../config/config.json"
|
||||
|
||||
# 生成 UUID
|
||||
local uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
|
||||
#修改 UUID
|
||||
sed -i 's/你的UUID/'"$uuid"'/g' "$config_dir/config.json"
|
||||
# 修改 UUID
|
||||
sed -i 's/你的UUID/'"$uuid"'/g' "$config_file"
|
||||
|
||||
echo "设置UUID成功."
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user