mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 04:22:06 +08:00
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
This commit is contained in:
parent
2cfd7e63e5
commit
708285a2ef
@ -295,12 +295,11 @@ disable_auto_update() {
|
||||
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 "设置文件权限失败"
|
||||
show_manual_guide
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# 尝试设置不可修改属性
|
||||
if command -v chattr &> /dev/null; then
|
||||
@ -316,7 +315,7 @@ disable_auto_update() {
|
||||
log_error "验证失败:文件权限设置可能未生效"
|
||||
show_manual_guide
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
log_info "成功禁用自动更新"
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user