Browse Source

Refactor disable_auto_update() function in Linux script

- Improved error handling logic with more concise conditional checks
- Replaced complex multi-line command with an if statement for better readability
- Simplified file permission and ownership setting validation
- Maintained existing error logging and manual guide display functionality
pull/174/head v0.0.54
煎饼果子卷鲨鱼辣椒 4 months ago
parent
commit
708285a2ef
  1. 7
      scripts/run/cursor_linux_id_modifier.sh

7
scripts/run/cursor_linux_id_modifier.sh

@ -295,12 +295,11 @@ disable_auto_update() {
return 1 return 1
} }
chmod 444 "$updater_path" 2>/dev/null && \
chown "$CURRENT_USER:$CURRENT_USER" "$updater_path" 2>/dev/null || {
if ! chmod 444 "$updater_path" 2>/dev/null || ! chown "$CURRENT_USER:$CURRENT_USER" "$updater_path" 2>/dev/null; then
log_error "设置文件权限失败" log_error "设置文件权限失败"
show_manual_guide show_manual_guide
return 1 return 1
}
fi
# 尝试设置不可修改属性 # 尝试设置不可修改属性
if command -v chattr &> /dev/null; then if command -v chattr &> /dev/null; then
@ -316,7 +315,7 @@ disable_auto_update() {
log_error "验证失败:文件权限设置可能未生效" log_error "验证失败:文件权限设置可能未生效"
show_manual_guide show_manual_guide
return 1 return 1
}
fi
log_info "成功禁用自动更新" log_info "成功禁用自动更新"
else else

Loading…
Cancel
Save