From f3830520135fff47153252afde856ae18955f312 Mon Sep 17 00:00:00 2001 From: longpanda Date: Sun, 20 Jun 2021 11:28:19 +0800 Subject: [PATCH] add debug info --- IMG/cpio/ventoy/hook/ventoy-hook-lib.sh | 30 ++++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh index dde05a0d..8b50cc61 100644 --- a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh +++ b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh @@ -57,14 +57,14 @@ vterr() { is_ventoy_hook_finished() { - [ -e $VTOY_PATH/hook_finish ] + [ -e $VTOY_PATH/hook_finish ] } set_ventoy_hook_finish() { - echo 'Y' > $VTOY_PATH/hook_finish + echo 'Y' > $VTOY_PATH/hook_finish } -get_ventoy_disk_name() { +get_ventoy_disk_name() { line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param) if [ $? -eq 0 ]; then echo ${line%%#*} @@ -74,7 +74,7 @@ get_ventoy_disk_name() { } get_ventoy_iso_name() { - line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param) + line=$($VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param) if [ $? -eq 0 ]; then echo ${line##*#} else @@ -83,8 +83,9 @@ get_ventoy_iso_name() { } wait_for_usb_disk_ready() { - while [ -n "Y" ]; do - usb_disk=$(get_ventoy_disk_name) + vtloop=0 + while [ -n "Y" ]; do + usb_disk=$(get_ventoy_disk_name) vtlog "wait_for_usb_disk_ready $usb_disk ..." if echo $usb_disk | $EGREP -q "nvme|mmc|nbd"; then @@ -95,13 +96,20 @@ wait_for_usb_disk_ready() { if [ -e "${vtpart2}" ]; then vtlog "wait_for_usb_disk_ready $usb_disk finish" - break - else - $SLEEP 0.3 - fi - done + break + else + let vtloop=vtloop+1 + if [ $vtloop -gt 2 ]; then + if [ "$VTLOG" != "$VTOY_PATH/log" ]; then + $VTOY_PATH/tool/vtoydump -f /ventoy/ventoy_os_param -v > $VTLOG + fi + fi + $SLEEP 0.3 + fi + done } + check_usb_disk_ready() { if echo $1 | $EGREP -q "nvme|mmc|nbd"; then vtpart2=${1}p2