Browse Source

refactor: Improve codesign process with timeout and fallback mechanisms

- Added timeout for signature removal to prevent hanging
- Implemented fallback strategies for signature removal
- Enhanced error handling for Helper process signature removal
- Added logging for signature removal attempts and failures
pull/231/head v0.0.97
煎饼果子卷鲨鱼辣椒 4 months ago
parent
commit
79fed06fd9
  1. 10
      scripts/run/cursor_mac_id_modifier.sh

10
scripts/run/cursor_mac_id_modifier.sh

@ -319,12 +319,18 @@ modify_cursor_app_files() {
log_info "移除应用签名..." log_info "移除应用签名..."
find "$temp_app" -type f -exec chmod 644 {} \; find "$temp_app" -type f -exec chmod 644 {} \;
find "$temp_app" -type d -exec chmod 755 {} \; find "$temp_app" -type d -exec chmod 755 {} \;
codesign --remove-signature "$temp_app" >/dev/null 2>&1 || log_warn "签名移除失败(可能已无签名)"
timeout 120 codesign --remove-signature --all-architectures "$temp_app" > >(while read line; do echo -n .; done) 2>&1 || {
log_warn "签名移除超时,尝试快速模式..."
codesign --remove-signature --preserve-metadata=entitlements "$temp_app" >/dev/null 2>&1 || true
}
# 处理所有Helper进程 # 处理所有Helper进程
find "${temp_app}/Contents/Frameworks" -name "*Helper*.app" | while read helper; do find "${temp_app}/Contents/Frameworks" -name "*Helper*.app" | while read helper; do
log_debug "处理Helper进程: $helper" log_debug "处理Helper进程: $helper"
codesign --remove-signature "$helper" >/dev/null 2>&1
timeout 30 codesign --remove-signature "$helper" >/dev/null 2>&1 || {
log_warn "无法移除 $helper 签名,尝试强制模式..."
codesign --remove-signature --force "$helper" >/dev/null 2>&1 || true
}
done done
# 修改目标文件 # 修改目标文件

Loading…
Cancel
Save