From bda5b7ca7ae747680717a5cfd2e2a5207c256283 Mon Sep 17 00:00:00 2001 From: shenmo Date: Fri, 5 Sep 2025 13:48:52 +0000 Subject: [PATCH] =?UTF-8?q?aptss=E6=94=AF=E6=8C=81=E5=9C=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E8=BD=AF=E4=BB=B6=E7=9A=84=E5=90=8C=E6=97=B6=E4=BD=BF?= =?UTF-8?q?=E7=94=A8download=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/apt-fast/ss-apt-fast | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast index 2832d5b..f1a0746 100755 --- a/tool/apt-fast/ss-apt-fast +++ b/tool/apt-fast/ss-apt-fast @@ -55,36 +55,6 @@ msg_already_running() # exit 1 #fi -# Move download file away so missing permissions won't stop usage. -CLEANUP_STATE=0 -cleanup_dllist() -{ - if [ -f "$DLLIST" ] - then - if ! mv -- "$DLLIST{,.old}" 2>/dev/null - then - if ! rm -fr -- "${LISTTEMP}" 2>/dev/null - then - msg "Could not clean up download list file." "warning" - msg "无法清除下载列表文件." "warning" - CLEANUP_STATE=1 - fi - fi - fi -} - -cleanup_aptfast() -{ - local last_exit_code=$? - [ "$CLEANUP_STATE" -eq 0 ] && CLEANUP_STATE=$last_exit_code - cleanup_dllist - _remove_lock -} - -exit_cleanup_state() -{ - exit $CLEANUP_STATE -} LCK_FD=99 # create the lock file and lock it, die on failure _create_lock() @@ -319,6 +289,36 @@ fi +# Move download file away so missing permissions won't stop usage. +CLEANUP_STATE=0 +cleanup_dllist() +{ + if [ -f "$DLLIST" ] + then + if ! mv -- "$DLLIST{,.old}" 2>/dev/null + then + if ! rm -fr -- "${LISTTEMP}" 2>/dev/null + then + msg "Could not clean up download list file." "warning" + msg "无法清除下载列表文件." "warning" + CLEANUP_STATE=1 + fi + fi + fi +} + +cleanup_aptfast() +{ + local last_exit_code=$? + [ "$CLEANUP_STATE" -eq 0 ] && CLEANUP_STATE=$last_exit_code + cleanup_dllist + _remove_lock +} + +exit_cleanup_state() +{ + exit $CLEANUP_STATE +} # decode url string # translates %xx but must not convert '+' in spaces