From 0cc3fc77d6c6279909f83d848fd4cfbe42ce3f46 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Thu, 8 Jan 2026 22:33:44 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E9=81=BF=E5=85=8D=E6=9C=89=E6=97=B6=20?= =?UTF-8?q?modloop=20=E4=B8=8B=E8=BD=BD=E4=B8=8D=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #308 #370 #376 --- trans.sh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/trans.sh b/trans.sh index 7c9fbbf..fb8ff2c 100644 --- a/trans.sh +++ b/trans.sh @@ -414,22 +414,30 @@ extract_env_from_cmdline() { } ensure_service_started() { - service=$1 + local service=$1 - if ! rc-service -q $service status; then - if ! retry 5 rc-service -q $service start; then - error_and_exit "Failed to start $service." - fi + if ! rc-service -q "$service" start; then + for i in $(seq 10); do + if [ "$service" = modloop ]; then + # 避免有时 modloop 下载不完整导致报错 + # * Failed to verify signature of ! + # mount: mounting /dev/loop0 on /.modloop failed: Invalid argument + rm -f /lib/modloop-lts /lib/modloop-virt + fi + if rc-service -q "$service" start; then + return + fi + sleep 5 + done + error_and_exit "Failed to start $service." fi } ensure_service_stopped() { - service=$1 + local service=$1 - if rc-service -q $service status; then - if ! retry 5 rc-service -q $service stop; then - error_and_exit "Failed to stop $service." - fi + if ! retry 10 5 rc-service -q "$service" stop; then + error_and_exit "Failed to stop $service." fi }