From 0e235e37feca99627b1d70ab8a9606e6025768eb Mon Sep 17 00:00:00 2001 From: shenmo Date: Thu, 5 Jun 2025 14:20:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=AF=8F=E6=AC=A1=E9=83=BD?= =?UTF-8?q?=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/ssaudit | 33 ++++++++++++++++++++++++--------- tool/ssinstall | 33 ++++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/tool/ssaudit b/tool/ssaudit index d034227..9c37e84 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -151,9 +151,7 @@ function hash_check() { # 确保aptss存在 function ensure_aptss_exist() { - if command -v aptss &>/dev/null; then - aptss update - else + if ! command -v aptss &>/dev/null; then local deb_file="/tmp/spark-store-console-in-container_latest_all.deb" if ! wget -O "$deb_file" "https://amber-ce-resource.spark-app.store/store/depends/spark-store-console-in-container_latest_all.deb"; then @@ -264,19 +262,36 @@ function install_in_ace_env() { echo "----------------------------------------" # 在ACE环境中执行安装 - if ! $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then - return 1 + if $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then + return 0 + else + # 如果第一次安装失败,执行aptss update后再试一次 + echo "第一次安装失败,正在更新仓库信息后重试..." + $ace_cmd "aptss update" + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi fi - - return 0 } # 在主机安装 function install_in_host() { local deb_path="$1" - dpkg -i "$deb_path" || aptss install "$deb_path" -yfq - return $? + 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 + fi } # 自动尝试在各种环境中安装 diff --git a/tool/ssinstall b/tool/ssinstall index 8de3203..e50843f 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -151,9 +151,7 @@ function hash_check() { # 确保aptss存在 function ensure_aptss_exist() { - if command -v aptss &>/dev/null; then - aptss update - else + if ! command -v aptss &>/dev/null; then local deb_file="/tmp/spark-store-console-in-container_latest_all.deb" if ! wget -O "$deb_file" "https://amber-ce-resource.spark-app.store/store/depends/spark-store-console-in-container_latest_all.deb"; then @@ -264,19 +262,36 @@ function install_in_ace_env() { echo "----------------------------------------" # 在ACE环境中执行安装 - if ! $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then - return 1 + if $ace_cmd "ensure_aptss_exist && { dpkg -i '$deb_path' || aptss install '$deb_path' -yfq; }"; then + return 0 + else + # 如果第一次安装失败,执行aptss update后再试一次 + echo "第一次安装失败,正在更新仓库信息后重试..." + $ace_cmd "aptss update" + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi fi - - return 0 } # 在主机安装 function install_in_host() { local deb_path="$1" - dpkg -i "$deb_path" || aptss install "$deb_path" -yfq - return $? + 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 + fi } # 自动尝试在各种环境中安装