From b4fd75079c153b8437c1c678453abd8144b2aff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=85=8E=E9=A5=BC=E6=9E=9C=E5=AD=90=E5=8D=B7=E9=B2=A8?= =?UTF-8?q?=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Fri, 7 Feb 2025 18:22:16 +0800 Subject: [PATCH] feat: Add macOS system check and configuration restore feature to Cursor MAC ID modifier - Implemented system check to ensure script runs only on macOS - Added new restore functionality to recover previous configuration from backups - Enhanced script with user-friendly backup file selection - Improved error handling and system compatibility --- scripts/run/cursor_mac_id_modifier.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/run/cursor_mac_id_modifier.sh b/scripts/run/cursor_mac_id_modifier.sh index 972a773..9ef4ab5 100644 --- a/scripts/run/cursor_mac_id_modifier.sh +++ b/scripts/run/cursor_mac_id_modifier.sh @@ -536,8 +536,29 @@ modify_mac_address() { fi } +# 新增恢复功能选项 +add_restore_feature() { + local backup_files=("$BACKUP_DIR"/*.backup_*) + echo "可用的备份文件:" + select backup in "${backup_files[@]}"; do + if [ -n "$backup" ]; then + cp "$backup" "$STORAGE_FILE" + log_info "已从备份恢复配置" + break + fi + done +} + # 主函数 main() { + + # 新增环境检查 + if [[ $(uname) != "Darwin" ]]; then + log_error "本脚本仅支持 macOS 系统" + exit 1 + fi + + clear # 显示 Logo echo -e " @@ -586,6 +607,9 @@ main() { log_info "请重启 Cursor 以应用新的配置" # 显示最后的提示信息 show_follow_info + + # 新增恢复功能选项 + restore_feature } # 执行主函数