From 6640dc9bbaa07be6dac4502dd6ffdaff6a9c1c63 Mon Sep 17 00:00:00 2001 From: shenmo Date: Thu, 5 Jun 2025 17:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E4=B8=BB=E6=9C=BA=E6=88=96=E8=80=85?= =?UTF-8?q?=20ACE=20=E5=AE=89=E8=A3=85=E4=B9=8B=E5=89=8D=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20aptss=20install=20--dry-run=20=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=83=BD=E5=90=A6=E5=AE=89=E8=A3=85=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E6=9D=A5=E6=9B=BF=E4=BB=A3=E7=9B=B4=E6=8E=A5=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E5=AE=89=E8=A3=85=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=A4=B1=E8=B4=A5=E4=BA=86=EF=BC=8C=E5=88=99aptss=20u?= =?UTF-8?q?pdate=20=E5=90=8E=E5=86=8D=E6=AC=A1=E5=B0=9D=E8=AF=95=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=A4=B1=E8=B4=A5=E4=BA=86=E5=B0=B1=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E9=80=80=E5=87=BA=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/ssaudit | 42 ++++++++++++++++++++++++------------------ tool/ssinstall | 42 ++++++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/tool/ssaudit b/tool/ssaudit index 5a25c57..e6cced1 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -266,36 +266,43 @@ function install_in_ace_env() { echo "正在尝试使用 $ace_cmd 环境安装..." echo "----------------------------------------" - # 在ACE环境中执行安装 - if $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then - return 0 - else - # 如果第一次安装失败,执行aptss update后再试一次 - echo "第一次安装失败,正在更新仓库信息后重试..." + # 首先尝试dry-run测试 + if ! $ace_cmd "ensure_aptss_exist && aptss install --dry-run '$deb_path'"; then + echo "初始dry-run测试失败,尝试更新后重试..." $ace_cmd "aptss update" - if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then - return 0 - else + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "dry-run测试仍然失败,放弃安装" return 1 fi fi + + # dry-run成功后执行实际安装 + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi } # 在主机安装 function install_in_host() { local deb_path="$1" + # 首先尝试dry-run测试 + if ! aptss install --dry-run "$deb_path"; then + echo "初始dry-run测试失败,尝试更新后重试..." + aptss update + if ! aptss install --dry-run "$deb_path"; then + echo "dry-run测试仍然失败,放弃安装" + return 1 + fi + fi + + # dry-run成功后执行实际安装 if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then return 0 else - # 如果第一次安装失败,执行aptss update后再试一次 - echo "第一次安装失败,正在更新仓库信息后重试..." - aptss update - if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then - return 0 - else - return 1 - fi + return 1 fi } @@ -327,7 +334,6 @@ function auto_try_install() { return 1 } - # 清理安装后的文件 function post_install_cleanup() { local success=$1 diff --git a/tool/ssinstall b/tool/ssinstall index e9b53fa..3ec57c1 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -266,36 +266,43 @@ function install_in_ace_env() { echo "正在尝试使用 $ace_cmd 环境安装..." echo "----------------------------------------" - # 在ACE环境中执行安装 - if $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then - return 0 - else - # 如果第一次安装失败,执行aptss update后再试一次 - echo "第一次安装失败,正在更新仓库信息后重试..." + # 首先尝试dry-run测试 + if ! $ace_cmd "ensure_aptss_exist && aptss install --dry-run '$deb_path'"; then + echo "初始dry-run测试失败,尝试更新后重试..." $ace_cmd "aptss update" - if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then - return 0 - else + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "dry-run测试仍然失败,放弃安装" return 1 fi fi + + # dry-run成功后执行实际安装 + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi } # 在主机安装 function install_in_host() { local deb_path="$1" + # 首先尝试dry-run测试 + if ! aptss install --dry-run "$deb_path"; then + echo "初始dry-run测试失败,尝试更新后重试..." + aptss update + if ! aptss install --dry-run "$deb_path"; then + echo "dry-run测试仍然失败,放弃安装" + return 1 + fi + fi + + # dry-run成功后执行实际安装 if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then return 0 else - # 如果第一次安装失败,执行aptss update后再试一次 - echo "第一次安装失败,正在更新仓库信息后重试..." - aptss update - if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then - return 0 - else - return 1 - fi + return 1 fi } @@ -327,7 +334,6 @@ function auto_try_install() { return 1 } - # 清理安装后的文件 function post_install_cleanup() { local success=$1