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/debian/changelog b/debian/changelog index d01ac56..ca3a18d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +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 + spark-store (4.5.2) UNRELEASED; urgency=medium * 支持安装到 ACE Bookworm diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast index 5db0ea0..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= @@ -367,15 +376,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) @@ -430,44 +439,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 - uri="$(get_auth "${uri//"'"/}")" + [ -z "$uri" ] && return + uri="${uri//"'"/}" + [ "$APT_FAST_APT_AUTH" -ne 0 ] && uri="$(get_auth "$uri")" IFS=':' read -r hash_algo checksum _ <<<"$checksum_string" - filename_decoded="$(urldecode "$filename")" + if [[ "$filename" == *%* ]]; then + # decode url string + filename_decoded="$(printf '%b' "${filename//%/\\x}")" + else + filename_decoded="$filename" + fi IFS='_' read -r pkg_name_decoded pkg_version_decoded _ <<<"$filename_decoded" - - - display_line="${display_line}$pkg_name_decoded $pkg_version_decoded" - display_line="${display_line} $(echo "$filesize" | numfmt --to=iec-i --suffix=B)\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. - + display_line+="$pkg_name_decoded $pkg_version_decoded $filesize\n" if [ -n "$HASH_SUPPORTED" ]; then case "$hash_algo" in SHA512) [ -z "$SHA512_SUPPORTED" ] && hash_algo= || hash_algo=sha-512 ;; @@ -522,30 +527,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)) @@ -554,7 +556,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 @@ -562,6 +564,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")" @@ -574,12 +585,10 @@ get_uris(){ # 清理临时目录 rm -rf "$tmpdir" - - #cat "$DLLIST" - #exit } + display_downloadfile(){ if [ -n "$VERBOSE_OUTPUT" ]; then cat "$DLLIST" @@ -590,7 +599,7 @@ 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 --to=iec-i --suffix=B --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" @@ -827,3 +836,4 @@ else fi # After error or all done remove our lockfile (done with EXIT trap) + 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="" ;; diff --git a/tool/ssaudit b/tool/ssaudit index 06897c9..7e5122d 100755 --- a/tool/ssaudit +++ b/tool/ssaudit @@ -166,75 +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 command -v bookworm-run ;then - 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="$?" +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 + + # 按顺序尝试每个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 - + if ! $success; then echo "OMG-IT-GOES-WRONG" echo -e "${try_run_output}" + echo -e "所有ACE环境尝试失败,推荐安装以下任一兼容环境:\n${recommendation_msg}" exit "$try_run_ret" fi - else - - dpkg -i "$DEBPATH" || aptss install "$DEBPATH" -yf + 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 2efbc87..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,77 +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 兼容环境后重试安装" + 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/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