fix: Improve error messages for Linux and Mac ID modifier scripts

- Updated error messages in Linux script to include specific package installation commands
- Enhanced Mac script's UUID modification prompt with better formatting and color
- Added spacing to improve readability of user prompts
This commit is contained in:
煎饼果子卷鲨鱼辣椒 2025-02-05 11:53:19 +08:00
parent e0639f7419
commit 3d61fa9753
2 changed files with 5 additions and 4 deletions

View File

@ -180,12 +180,12 @@ generate_uuid() {
generate_new_config() { generate_new_config() {
# 错误处理 # 错误处理
if ! command -v xxd &> /dev/null; then if ! command -v xxd &> /dev/null; then
log_error "未找到 xxd 命令,请安装 xxd" log_error "未找到 xxd 命令,请安装 xxd,使用 apt-get install xxd"
exit 1 exit 1
fi fi
if ! command -v uuidgen &> /dev/null; then if ! command -v uuidgen &> /dev/null; then
log_error "未找到 uuidgen 命令,请安装 uuidgen" log_error "未找到 uuidgen 命令,请安装 uuidgen,使用 apt-get install uuid-runtime"
exit 1 exit 1
fi fi

View File

@ -176,8 +176,9 @@ generate_new_config() {
local new_system_uuid=$(uuidgen) local new_system_uuid=$(uuidgen)
# 尝试修改系统 UUID (需要用户确认) # 尝试修改系统 UUID (需要用户确认)
log_warn "注意:修改系统 UUID 需要重启系统才能生效" echo # 添加空行使提示更清晰
log_warn "是否要修改系统 UUID(y/N)" printf "${YELLOW}注意:修改系统 UUID 需要重启系统才能生效${NC}\n"
printf "${YELLOW}是否要修改系统 UUID(y/N)${NC} " # 使用 printf 并在末尾加空格
read -r choice read -r choice
if [[ "$choice" =~ ^[Yy]$ ]]; then if [[ "$choice" =~ ^[Yy]$ ]]; then
sudo nvram SystemUUID="$new_system_uuid" sudo nvram SystemUUID="$new_system_uuid"