From c71679a23dcbbee59bf3b20ccd2d9432e323ff9f Mon Sep 17 00:00:00 2001 From: shenmo Date: Sun, 15 Mar 2026 12:13:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=97=B6=20=E5=8D=A1=E4=BD=8Fdpkg=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/usr/bin/apm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/usr/bin/apm b/src/usr/bin/apm index fa3e299..ce21752 100755 --- a/src/usr/bin/apm +++ b/src/usr/bin/apm @@ -330,13 +330,24 @@ for dir in "$APM_BASE"/*/; do fi done } + # 主命令处理 case "$1" in install|full-upgrade|upgrade|reinstall) command=$1 shift amber-pm-debug aptss "$command" "$@" + exit_code=$? + + # 如果第一次执行失败,尝试修复并重试 + if [ $exit_code -ne 0 ]; then + log.warn "Command failed, attempting to fix with dpkg --configure -a..." + amber-pm-debug dpkg --configure -a + log.info "Retrying $command..." + amber-pm-debug aptss "$command" "$@" exit_code=$? + fi + if [ $exit_code -eq 0 ]; then log.info "Operation successful" else @@ -455,6 +466,7 @@ case "$1" in debug_info $@ ;; ssaudit) + amber-pm-debug dpkg --configure -a amber-pm-debug ssaudit $@ --native exit_code=$? if [ $exit_code -eq 0 ]; then