From e2a0079c6e034aa1ad36290dbe18eea6c8649707 Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Sat, 15 Mar 2025 15:38:20 +0000 Subject: [PATCH 01/12] update tool/ssinstall. Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/ssinstall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/ssinstall b/tool/ssinstall index 2efbc87..14c55d4 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -214,7 +214,7 @@ if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then echo "----------------------------------------" exit "$try_run_ret" fi - bookworm-run dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf + bookworm-run 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf ' fi else # 如果在主机安装失败且未安装ACE,报错退出并推荐安装 ACE From 6f3980e6cb7b4fe551806a98352d8d88910a893d Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Sat, 15 Mar 2025 15:40:33 +0000 Subject: [PATCH 02/12] update tool/ssaudit. Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/ssaudit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/ssaudit b/tool/ssaudit index 06897c9..8fa51f3 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -200,7 +200,7 @@ if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then echo "----------------------------------------" exit "$try_run_ret" fi - bookworm-run dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf + bookworm-run 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf ' fi else From 7ae592776df64a102b73fc2dd4767fb05427bba9 Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Sun, 16 Mar 2025 05:03:00 +0000 Subject: [PATCH 03/12] =?UTF-8?q?=E7=BB=99=E5=87=BA=E6=95=99=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/ssaudit | 14 ++++++++------ tool/ssinstall | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tool/ssaudit b/tool/ssaudit index 8fa51f3..dc1bfe2 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -170,17 +170,18 @@ if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then echo "Package name is $package_name" try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") try_run_ret="$?" -# 安装失败后进行 aptss update 刷新,随后尝试安装 +# 安装失败后进行 aptss update 刷新,随后尝试在主机安装 if [ "$try_run_ret" -ne 0 ]; then aptss update try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") try_run_ret="$?" fi - if [ "$try_run_ret" -ne 0 ]; then + if [ "$try_run_ret" -ne 0 ]; then ## 若安装检测仍然失败 if [[ "$IS_ACE_ENV" == "" ]];then ## 如果已经在ACE里面则不进入分支 - if command -v bookworm-run ;then + + if command -v bookworm-run ;then ## 如果 bookworm-run 可用则进行安装 echo "----------------------------------------" echo "Attention: USING ACE BOOKWORM TO INSTALL" echo "----------------------------------------" @@ -203,13 +204,14 @@ if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then bookworm-run 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf ' fi - else + else # 如果在主机安装失败且未安装ACE,报错退出并推荐安装 ACE echo "OMG-IT-GOES-WRONG" echo -e "${try_run_output}" + echo "您可在商店安装 ACE Bookworm 兼容环境后重试安装 https://bbs.deepin.org.cn/post/285056 " exit "$try_run_ret" - fi - else + fi + else ## 如果主机安装检测成功了,进入主机安装分支 dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf fi diff --git a/tool/ssinstall b/tool/ssinstall index 14c55d4..24861e0 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -221,7 +221,7 @@ if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then echo "OMG-IT-GOES-WRONG" echo -e "${try_run_output}" - echo "您可在商店安装 ACE Bookworm 兼容环境后重试安装" + echo "您可在商店安装 ACE Bookworm 兼容环境后重试安装 https://bbs.deepin.org.cn/post/285056 " exit "$try_run_ret" fi else ## 如果主机安装检测成功了,进入主机安装分支 From 668e5dc28d0c593c46b8590e11511458c61f7fb9 Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Mon, 17 Mar 2025 14:17:14 +0000 Subject: [PATCH 04/12] * Perf: merge patches from Rongronggg9 https://github.com/ilikenwf/apt-fast/pull/253 Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/apt-fast/ss-apt-fast | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast index 5db0ea0..a794ac8 100755 --- a/tool/apt-fast/ss-apt-fast +++ b/tool/apt-fast/ss-apt-fast @@ -367,15 +367,15 @@ prepare_auth(){ AUTH_INFO_PARSED+=("$machine $login $password") done <<< "$auth_info" done + if [ "${#AUTH_INFO_PARSED[@]}" -eq 0 ]; then + # acts like auth disabled when no auth info is provided to improve performance + APT_FAST_APT_AUTH=0 + fi } # Gets URI as parameter and tries to add basic http credentials. Will fail on # credentials that contain characters that need URL-encoding. get_auth(){ - if [ "$APT_FAST_APT_AUTH" -eq 0 ]; then - echo "$1" - return - fi for auth_info in "${AUTH_INFO_PARSED[@]}"; do # convert to array, don't escape variable here auth_info_arr=($auth_info) @@ -453,7 +453,15 @@ get_uris(){ uri="$(get_auth "${uri//"'"/}")" IFS=':' read -r hash_algo checksum _ <<<"$checksum_string" - filename_decoded="$(urldecode "$filename")" + if [[ "$filename" == *%* ]]; then + # decode url string + # translates %xx but must not convert '+' in spaces + filename_decoded="$(printf '%b' "${filename//%/\\x}")" + else + # most filenames do not contain %, so skip decoding them to improve the performance. + # the overhead of decoding is >1ms due to the use of subshell and printf, while the one of assignment is ~1us. + filename_decoded="$filename" + fi IFS='_' read -r pkg_name_decoded pkg_version_decoded _ <<<"$filename_decoded" @@ -590,10 +598,10 @@ display_downloadfile(){ while IFS=' ' read -r pkg ver size _; do [ -z "$pkg" ] && continue printf '%s%-40s %-20s %10s\n' "$aptfast_prefix" "$pkg" "$ver" "$size" - done <<<"$(echo -e "$DOWNLOAD_DISPLAY" | sort "${DISPLAY_SORT_OPTIONS[@]}")" + done <<<"$(echo -e "$DOWNLOAD_DISPLAY" | sort "${DISPLAY_SORT_OPTIONS[@]}" | numfmt "${DISPLAY_NUMFMT_OPTIONS[@]}" --field=3)" fi - msg "Download size: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal" - msg "下载大小: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal" + msg "Download size: $(echo "$DOWNLOAD_SIZE" | numfmt "${DISPLAY_NUMFMT_OPTIONS[@]}")" "normal" + msg "下载大小: $(echo "$DOWNLOAD_SIZE" | numfmt "${DISPLAY_NUMFMT_OPTIONS[@]}")" "normal" } From 564966daefc089f922c76fc20849c89497d923be Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Mon, 17 Mar 2025 15:59:29 +0000 Subject: [PATCH 05/12] update tool/apt-fast/ss-apt-fast. Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/apt-fast/ss-apt-fast | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast index a794ac8..d7b7b0e 100755 --- a/tool/apt-fast/ss-apt-fast +++ b/tool/apt-fast/ss-apt-fast @@ -450,7 +450,8 @@ get_uris(){ IFS=' ' read -r uri filename filesize checksum_string _ <<<"$pkg_uri_info" [ -z "$uri" ] && continue - uri="$(get_auth "${uri//"'"/}")" + uri="${uri//"'"/}" + [ "$APT_FAST_APT_AUTH" -ne 0 ] && uri="$(get_auth "$uri")" IFS=':' read -r hash_algo checksum _ <<<"$checksum_string" if [[ "$filename" == *%* ]]; then @@ -466,8 +467,7 @@ get_uris(){ - display_line="${display_line}$pkg_name_decoded $pkg_version_decoded" - display_line="${display_line} $(echo "$filesize" | numfmt --to=iec-i --suffix=B)\n" + display_line+="$pkg_name_decoded $pkg_version_decoded $filesize\n" ## whole uri comes encoded (urlencoded). Filename must NOT be decoded because # plain aptitude do not decode it when download and install it. Therefore, we From f2cafe056720b7e83220ee1bb9a2f427a2411d24 Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Fri, 28 Mar 2025 17:29:29 +0000 Subject: [PATCH 06/12] Sync:https://gitee.com/GXDE-OS/aptss/commit/674f871cec7aaf76e948b004f3334e414150fb3f Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/apt-fast/ss-apt-fast | 75 ++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast index d7b7b0e..17abb7b 100755 --- a/tool/apt-fast/ss-apt-fast +++ b/tool/apt-fast/ss-apt-fast @@ -430,52 +430,40 @@ get_uris(){ CLEANUP_STATE="$?" if [ "$CLEANUP_STATE" -ne 0 ] then - msg "Package manager quit with exit code.Here is the log" "warning" + msg "Package manager quit with exit code. Here is the log" "warning" msg "包管理器以错误代码退出.日志如下" "warning" msg "${uris_full}" exit "$CLEANUP_STATE" fi prepare_auth - local tmpdir=$(mktemp -d) || { + local tmpdir + tmpdir=$(mktemp -d) || { msg "Failed to create tmp dir" "warning" msg "无法创建临时目录" "warning" exit 1 } ## --print-uris format is: # 'fileurl' filename filesize checksum_hint:filechecksum + # 修改:process_package函数增加第二个参数表示当前线程的临时输出文件 process_package() { - local pkg_uri_info="$@" - - local display_line="" # 添加局部变量并初始化为空 - + local pkg_uri_info="$1" + local thread_file="$2" + local display_line="" # 初始化显示信息为空 IFS=' ' read -r uri filename filesize checksum_string _ <<<"$pkg_uri_info" - [ -z "$uri" ] && continue + [ -z "$uri" ] && return uri="${uri//"'"/}" [ "$APT_FAST_APT_AUTH" -ne 0 ] && uri="$(get_auth "$uri")" IFS=':' read -r hash_algo checksum _ <<<"$checksum_string" if [[ "$filename" == *%* ]]; then # decode url string - # translates %xx but must not convert '+' in spaces filename_decoded="$(printf '%b' "${filename//%/\\x}")" else - # most filenames do not contain %, so skip decoding them to improve the performance. - # the overhead of decoding is >1ms due to the use of subshell and printf, while the one of assignment is ~1us. filename_decoded="$filename" fi IFS='_' read -r pkg_name_decoded pkg_version_decoded _ <<<"$filename_decoded" - - display_line+="$pkg_name_decoded $pkg_version_decoded $filesize\n" - - ## whole uri comes encoded (urlencoded). Filename must NOT be decoded because - # plain aptitude do not decode it when download and install it. Therefore, we - # will have ugly named packages at /var/cache/apt/archives but is the standard - # behavior. - # But package version must be decoded, otherways package=version calls will - # not work. - if [ -n "$HASH_SUPPORTED" ]; then case "$hash_algo" in SHA512) [ -z "$SHA512_SUPPORTED" ] && hash_algo= || hash_algo=sha-512 ;; @@ -530,30 +518,27 @@ get_uris(){ hash_algo= fi + # 原来利用文件锁写入,现在改为写入当前线程的临时文件 + { + get_mirrors "$uri" + [ -n "$hash_algo" ] && echo " checksum=$hash_algo=$checksum" + echo " out=$filename" + } >> "$thread_file" - # 使用文件锁安全写入下载列表 - ( - flock -x 200 # 获取排他锁 - { - get_mirrors "$uri" - [ -n "$hash_algo" ] && echo " checksum=$hash_algo=$checksum" - echo " out=$filename" - } >> "$DLLIST" - ) 200>>"$DLLIST" # 使用文件描述符200关联锁文件 - - # 将显示信息和文件大小存入临时文件 - echo "$display_line" >> "$tmpdir/display" + echo -e "$display_line" >> "$tmpdir/display" echo "$filesize" >> "$tmpdir/sizes" } - # 主并行处理逻辑(新增线程控制) + # 主并行处理逻辑 mapfile -t pkg_uri_list < <(echo "$uris_full" | grep -E "^'(http(s|)|(s|)ftp)://") total_pkgs=${#pkg_uri_list[@]} threads=${THREADS:-4} # 默认4线程 per_thread=$(( (total_pkgs + threads - 1) / threads )) # 向上取整 - # 分割任务到不同线程 + # 分配任务到不同线程,每个线程使用自己的临时文件 for ((i=0; i<threads; i++)); do + thread_file="${DLLIST}.thread.${i}" + > "$thread_file" # 清空或创建临时文件 start=$((i * per_thread)) end=$((start + per_thread -1)) [ $end -ge $total_pkgs ] && end=$((total_pkgs -1)) @@ -562,7 +547,7 @@ get_uris(){ ( for ((j=start; j<=end; j++)); do [ -z "${pkg_uri_list[j]}" ] && continue - process_package "${pkg_uri_list[j]}" + process_package "${pkg_uri_list[j]}" "$thread_file" done ) & done @@ -570,6 +555,15 @@ get_uris(){ # 等待所有后台任务完成 wait + # 合并所有线程的临时文件到最终的 $DLLIST 中(保留之前添加的 header) + for ((i=0; i<threads; i++)); do + thread_file="${DLLIST}.thread.${i}" + if [ -f "$thread_file" ]; then + cat "$thread_file" >> "$DLLIST" + rm -f "$thread_file" + fi + done + # 合并显示信息 if [ -f "$tmpdir/display" ]; then DOWNLOAD_DISPLAY+="\n$(cat "$tmpdir/display")" @@ -582,12 +576,10 @@ get_uris(){ # 清理临时目录 rm -rf "$tmpdir" - - #cat "$DLLIST" - #exit } + display_downloadfile(){ if [ -n "$VERBOSE_OUTPUT" ]; then cat "$DLLIST" @@ -598,10 +590,10 @@ display_downloadfile(){ while IFS=' ' read -r pkg ver size _; do [ -z "$pkg" ] && continue printf '%s%-40s %-20s %10s\n' "$aptfast_prefix" "$pkg" "$ver" "$size" - done <<<"$(echo -e "$DOWNLOAD_DISPLAY" | sort "${DISPLAY_SORT_OPTIONS[@]}" | numfmt "${DISPLAY_NUMFMT_OPTIONS[@]}" --field=3)" + done <<<"$(echo -e "$DOWNLOAD_DISPLAY" | sort "${DISPLAY_SORT_OPTIONS[@]}" | numfmt --to=iec-i --suffix=B --field=3)" fi - msg "Download size: $(echo "$DOWNLOAD_SIZE" | numfmt "${DISPLAY_NUMFMT_OPTIONS[@]}")" "normal" - msg "下载大小: $(echo "$DOWNLOAD_SIZE" | numfmt "${DISPLAY_NUMFMT_OPTIONS[@]}")" "normal" + msg "Download size: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal" + msg "下载大小: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal" } @@ -835,3 +827,4 @@ else fi # After error or all done remove our lockfile (done with EXIT trap) + From 2b929f8a061f5df7115c386b4f23d0482dddc74b Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Fri, 28 Mar 2025 17:32:41 +0000 Subject: [PATCH 07/12] update debian/changelog. Signed-off-by: shenmo <jifengshenmo@outlook.com> --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index d01ac56..7938cd5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +spark-store (4.6.3) UNRELEASED; urgency=medium + + * aptss 第二、三阶段加速 + + -- shenmo <shenmo@spark-app.store> Tue, 24 Sep 2024 11:27:08 +0800 + spark-store (4.5.2) UNRELEASED; urgency=medium * 支持安装到 ACE Bookworm From 460d965ac17310b707ae9ac73b2f9fb7c520d0de Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Thu, 10 Apr 2025 07:27:45 +0000 Subject: [PATCH 08/12] fix: Some apps can't launch Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/store-helper/ss-launcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/store-helper/ss-launcher b/tool/store-helper/ss-launcher index 563744b..a635ff8 100755 --- a/tool/store-helper/ss-launcher +++ b/tool/store-helper/ss-launcher @@ -101,7 +101,7 @@ function launch_app(){ log.info "Command is $exec_command" # 在默认终端执行命令 - bash -c $exec_command + bash -c "$exec_command" } if [ "$#" -lt 2 ];then From 2a6e9046e7676e19f9421275f5aa8aed3bbf5a3c Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Thu, 10 Apr 2025 07:29:44 +0000 Subject: [PATCH 09/12] update debian/changelog. Signed-off-by: shenmo <jifengshenmo@outlook.com> --- debian/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7938cd5..c816ebd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ -spark-store (4.6.3) UNRELEASED; urgency=medium +spark-store (4.6.5) UNRELEASED; urgency=medium * aptss 第二、三阶段加速 + * 修复部分应用无法启动的问题 -- shenmo <shenmo@spark-app.store> Tue, 24 Sep 2024 11:27:08 +0800 From 6697bd04f195c56680cb63278005f2f8229e645e Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Sat, 12 Apr 2025 18:12:26 +0000 Subject: [PATCH 10/12] unlock before rm Signed-off-by: shenmo <jifengshenmo@outlook.com> --- tool/ssinstall | 1 + 1 file changed, 1 insertion(+) diff --git a/tool/ssinstall b/tool/ssinstall index 24861e0..8e5d87b 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -234,6 +234,7 @@ if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then if dpkg -s "$package_name" >/dev/null 2>&1; then echo "软件包已安装:$package_name" create_desktop_file + unlock_file $DEBPATH rm "$DEBPATH" echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" else From 819e680222b61091bc23865ff585db637c2801d5 Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Sun, 13 Apr 2025 19:13:08 +0800 Subject: [PATCH 11/12] aptss 4.7.0 --- README.md | 2 +- README.zh.md | 6 ++++-- tool/apt-fast/ss-apt-fast | 21 +++++++++++++++------ tool/aptss | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0e4fb47..655ed3c 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ You will see an output, and that's your system architecture. Please refer to the [Spark App Store FAQ and Support Guide](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.md). -You can also check the [Chinese version](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.zh.md) here. +To customly configure aptss, refer to [aptss](https://gitee.com/GXDE-OS/aptss) --- diff --git a/README.zh.md b/README.zh.md index 6072799..0b4a84c 100644 --- a/README.zh.md +++ b/README.zh.md @@ -171,9 +171,11 @@ https://github.com/spark-store-project/spark-store ## 常见问题(FAQ) -请参见[星火应用商店FAQ与支持指南](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.md)。 +请参见[星火应用商店FAQ与支持指南](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.zh.md)。 + +自定义配置 aptss config 请参阅 [aptss](https://gitee.com/GXDE-OS/aptss) + -在这里可以查阅[中文版本](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.zh.md)。 --- diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast index 17abb7b..dea3648 100755 --- a/tool/apt-fast/ss-apt-fast +++ b/tool/apt-fast/ss-apt-fast @@ -186,12 +186,21 @@ VERBOSE_OUTPUT= # Download command. _DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} -i ${DLLIST} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --connect-timeout=60 --timeout=600 -m0' -# Load config file. -CONFFILE="/tmp/aptss-conf/apt-fast.conf" -#### Spark Store apt-fast conf is in /tmp -if [ -e "$CONFFILE" ]; then - source "$CONFFILE" -fi +# 定义默认的配置文件列表(按加载顺序排列) +CONFIG_FILES=( + "/tmp/aptss-conf/apt-fast.conf" # 原始配置文件位置 + "/etc/aptss/apt-fast.conf" # 系统级配置 +) + + +# 按顺序加载所有配置文件 +for conf_file in "${CONFIG_FILES[@]}"; do + if [ -e "$conf_file" ]; then + source "$conf_file" + fi +done + + # no proxy as default ftp_proxy= diff --git a/tool/aptss b/tool/aptss index bdb8beb..228f0fc 100755 --- a/tool/aptss +++ b/tool/aptss @@ -7,7 +7,7 @@ source /opt/durapps/spark-store/bin/bashimport/log.amber load_transhell case `arch` in - x86_64) + x86_64 | i686 | i386) STORE_URL="store" STORE_LIST_URL="" ;; From 90ad08a6f94f07e91b0516a48b30b948859e3b02 Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Sun, 13 Apr 2025 19:55:27 +0800 Subject: [PATCH 12/12] 4.7.0 --- debian/changelog | 3 +- tool/ssaudit | 138 ++++++++++++++++++++++++++----------------- tool/ssinstall | 148 ++++++++++++++++++++++++++++------------------- 3 files changed, 175 insertions(+), 114 deletions(-) diff --git a/debian/changelog b/debian/changelog index c816ebd..ca3a18d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,8 @@ -spark-store (4.6.5) UNRELEASED; urgency=medium +spark-store (4.7.0) UNRELEASED; urgency=medium * aptss 第二、三阶段加速 * 修复部分应用无法启动的问题 + * 支持使用 ACE deepin23 trixie -- shenmo <shenmo@spark-app.store> Tue, 24 Sep 2024 11:27:08 +0800 diff --git a/tool/ssaudit b/tool/ssaudit index dc1bfe2..7e5122d 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -166,77 +166,107 @@ IS_SHA512SUM_CHECKED=skipped if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then echo "校验跳过,开始安装" echo "----------------------------------------------------------------------------------" - package_name=$(dpkg-deb -f "$DEBPATH" Package) - echo "Package name is $package_name" - try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") - try_run_ret="$?" -# 安装失败后进行 aptss update 刷新,随后尝试在主机安装 - if [ "$try_run_ret" -ne 0 ]; then +package_name=$(dpkg-deb -f "$DEBPATH" Package) +echo "Package name is $package_name" +try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") +try_run_ret="$?" +# 安装失败后进行 aptss 刷新,随后尝试在主机安装 +if [ "$try_run_ret" -ne 0 ]; then aptss update try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") try_run_ret="$?" - fi - - if [ "$try_run_ret" -ne 0 ]; then ## 若安装检测仍然失败 +fi - if [[ "$IS_ACE_ENV" == "" ]];then ## 如果已经在ACE里面则不进入分支 +if [ "$try_run_ret" -ne 0 ]; then ## 若安装检测仍然失败 + if [[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中 + # 定义按顺序尝试的ACE环境(命令:推荐安装包) + declare -a ace_commands_order=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + ) + + success=false + recommendation_msg="" + # 收集所有推荐信息 + for ace_entry in "${ace_commands_order[@]}"; do + recommendation_msg+="您可安装 ${ace_entry%%:*} 兼容环境后重试: ${ace_entry#*:}\n" + done - if command -v bookworm-run ;then ## 如果 bookworm-run 可用则进行安装 - echo "----------------------------------------" - echo "Attention: USING ACE BOOKWORM TO INSTALL" - echo "----------------------------------------" - bookworm-run ensure_aptss_exist - try_run_output=$(bookworm-run aptss install --dry-run "$DEBPATH") - try_run_ret="$?" + # 按顺序尝试每个ACE环境 + for ace_entry in "${ace_commands_order[@]}"; do + ace_cmd=${ace_entry%%:*} + if command -v "$ace_cmd" >/dev/null 2>&1; then + echo "----------------------------------------" + echo "正在尝试使用 $ace_cmd 环境安装..." + echo "----------------------------------------" + + # 在ACE环境中执行安装检测 + $ace_cmd ensure_aptss_exist + try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) + try_run_ret="$?" + + # 如果首次检测失败则更新后重试 if [ "$try_run_ret" -ne 0 ]; then - bookworm-run aptss update - try_run_output=$(bookworm-run aptss install --dry-run "$DEBPATH") + $ace_cmd aptss update + try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) try_run_ret="$?" fi - if [ "$try_run_ret" -ne 0 ]; then - echo "OMG-IT-GOES-WRONG" + + # 最终检测结果处理 + if [ "$try_run_ret" -eq 0 ]; then + echo "----------------------------------------" + echo "在 $ace_cmd 环境中预检成功,开始安装..." + echo "----------------------------------------" + $ace_cmd 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf' + success=true + break # 跳出循环 + else + echo "----------------------------------------" + echo "在 $ace_cmd 环境中安装预检失败,错误信息:" echo -e "${try_run_output}" echo "----------------------------------------" - echo "Attention: USING ACE BOOKWORM TO INSTALL" - echo "----------------------------------------" - exit "$try_run_ret" + fi fi - bookworm-run 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf ' - fi + done - else # 如果在主机安装失败且未安装ACE,报错退出并推荐安装 ACE - + if ! $success; then echo "OMG-IT-GOES-WRONG" echo -e "${try_run_output}" - echo "您可在商店安装 ACE Bookworm 兼容环境后重试安装 https://bbs.deepin.org.cn/post/285056 " + echo -e "所有ACE环境尝试失败,推荐安装以下任一兼容环境:\n${recommendation_msg}" exit "$try_run_ret" - fi - else ## 如果主机安装检测成功了,进入主机安装分支 - - dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf + fi + else # 已经在ACE环境中仍失败直接退出 + echo "OMG-IT-GOES-WRONG" + echo -e "${try_run_output}" + exit "$try_run_ret" fi -### 退出阶段 +else ## 如果主机安装检测成功 + dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf +fi - if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - rm "$DEBPATH" - echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" - echo "OMG-IT-GOES-WRONG" - fi +### 退出阶段保持不变 ### +if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已安装:$package_name" + create_desktop_file + unlock_file $DEBPATH + rm "$DEBPATH" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" else - echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" - echo "OMG-IT-GOES-WRONG" - fi + echo "软件包未安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + fi +else + echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已安装:$package_name" + create_desktop_file + else + echo "软件包未安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" fi fi +fi diff --git a/tool/ssinstall b/tool/ssinstall index 8e5d87b..c1c5547 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -1,5 +1,6 @@ #!/bin/bash - +SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/" +SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store" source /opt/durapps/spark-store/bin/bashimport/transhell.amber load_transhell_debug @@ -61,15 +62,15 @@ function zenity() { } function hash_check() { - if [ ! -e "/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" ] && \ + if [ ! -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ] && \ [ ! -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && \ [ ! -e "/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store_${STORE_URL}_Packages" ]; then echo "接收星火仓库软件信息中..." aptss ssupdate fi - if [ -e "/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" ]; then - PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" + if [ -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" echo "星火仓库的Packages位置为 $PACKAGES_DATA_PATH,是星火域名仓库配置" elif [ -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" @@ -179,78 +180,107 @@ fi if [ ! -z "$IS_SHA512SUM_CHECKED" ]; then echo "校验成功,开始安装" echo "----------------------------------------------------------------------------------" - package_name=$(dpkg-deb -f "$DEBPATH" Package) - echo "Package name is $package_name" - try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") - try_run_ret="$?" -# 安装失败后进行 aptss update 刷新,随后尝试在主机安装 - if [ "$try_run_ret" -ne 0 ]; then +package_name=$(dpkg-deb -f "$DEBPATH" Package) +echo "Package name is $package_name" +try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") +try_run_ret="$?" +# 安装失败后进行 aptss 刷新,随后尝试在主机安装 +if [ "$try_run_ret" -ne 0 ]; then aptss update try_run_output=$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh test-install-app "$DEBPATH") try_run_ret="$?" - fi - - if [ "$try_run_ret" -ne 0 ]; then ## 若安装检测仍然失败 +fi - if [[ "$IS_ACE_ENV" == "" ]];then ## 如果已经在ACE里面则不进入分支 +if [ "$try_run_ret" -ne 0 ]; then ## 若安装检测仍然失败 + if [[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中 + # 定义按顺序尝试的ACE环境(命令:推荐安装包) + declare -a ace_commands_order=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + ) + + success=false + recommendation_msg="" + # 收集所有推荐信息 + for ace_entry in "${ace_commands_order[@]}"; do + recommendation_msg+="您可安装 ${ace_entry%%:*} 兼容环境后重试: ${ace_entry#*:}\n" + done - if command -v bookworm-run ;then ## 如果 bookworm-run 可用则进行安装 - echo "----------------------------------------" - echo "Attention: USING ACE BOOKWORM TO INSTALL" - echo "----------------------------------------" - bookworm-run ensure_aptss_exist - try_run_output=$(bookworm-run aptss install --dry-run "$DEBPATH") - try_run_ret="$?" + # 按顺序尝试每个ACE环境 + for ace_entry in "${ace_commands_order[@]}"; do + ace_cmd=${ace_entry%%:*} + if command -v "$ace_cmd" >/dev/null 2>&1; then + echo "----------------------------------------" + echo "正在尝试使用 $ace_cmd 环境安装..." + echo "----------------------------------------" + + # 在ACE环境中执行安装检测 + $ace_cmd ensure_aptss_exist + try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) + try_run_ret="$?" + + # 如果首次检测失败则更新后重试 if [ "$try_run_ret" -ne 0 ]; then - bookworm-run aptss update - try_run_output=$(bookworm-run aptss install --dry-run "$DEBPATH") + $ace_cmd aptss update + try_run_output=$($ace_cmd aptss install --dry-run "$DEBPATH" 2>&1) try_run_ret="$?" fi - if [ "$try_run_ret" -ne 0 ]; then - echo "OMG-IT-GOES-WRONG" + + # 最终检测结果处理 + if [ "$try_run_ret" -eq 0 ]; then + echo "----------------------------------------" + echo "在 $ace_cmd 环境中预检成功,开始安装..." + echo "----------------------------------------" + $ace_cmd 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf' + success=true + break # 跳出循环 + else + echo "----------------------------------------" + echo "在 $ace_cmd 环境中安装预检失败,错误信息:" echo -e "${try_run_output}" echo "----------------------------------------" - echo "Attention: USING ACE BOOKWORM TO INSTALL" - echo "----------------------------------------" - exit "$try_run_ret" + fi fi - bookworm-run 'dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf ' - fi + done - else # 如果在主机安装失败且未安装ACE,报错退出并推荐安装 ACE - + if ! $success; then echo "OMG-IT-GOES-WRONG" echo -e "${try_run_output}" - echo "您可在商店安装 ACE Bookworm 兼容环境后重试安装 https://bbs.deepin.org.cn/post/285056 " + echo -e "所有ACE环境尝试失败,推荐安装以下任一兼容环境:\n${recommendation_msg}" exit "$try_run_ret" - fi - else ## 如果主机安装检测成功了,进入主机安装分支 - - dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf + fi + else # 已经在ACE环境中仍失败直接退出 + echo "OMG-IT-GOES-WRONG" + echo -e "${try_run_output}" + exit "$try_run_ret" fi -### 退出阶段 +else ## 如果主机安装检测成功 + dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf +fi - if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - unlock_file $DEBPATH - rm "$DEBPATH" - echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" - echo "OMG-IT-GOES-WRONG" - fi +### 退出阶段保持不变 ### +if [ "$?" = "0" ] && [ "$2" = "--delete-after-install" ]; then + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已安装:$package_name" + create_desktop_file + unlock_file $DEBPATH + rm "$DEBPATH" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" else - echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" - if dpkg -s "$package_name" >/dev/null 2>&1; then - echo "软件包已安装:$package_name" - create_desktop_file - else - echo "软件包未安装:$package_name" - echo "安装异常!抛出错误" - echo "OMG-IT-GOES-WRONG" - fi + echo "软件包未安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + fi +else + echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已安装:$package_name" + create_desktop_file + else + echo "软件包未安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" fi fi +fi