X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/cd4a5fcb0685b8a12915d22efc5c1e0cc8b40d9b..ad9a031092f1d953d10bcf6ec77cb2fa1fc2c103:/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh diff --git a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh index 7609829..f70d557 100644 --- a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh +++ b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh @@ -226,7 +226,7 @@ wait_for_ventoy_dm_disk_label() { if ls -l /dev/disk/by-label/ | $GREP -q "$DM"; then break else - $SLEEP 0.3 + $SLEEP 1 fi done } @@ -395,7 +395,7 @@ ventoy_udev_disk_common_hook() { else vtlog "==== create ventoy device mapper failed ====" - $SLEEP 5 + $SLEEP 3 if $GREP -q "/dev/$VTDISK" /proc/mounts; then $GREP "/dev/$VTDISK" /proc/mounts | while read vtLine; do @@ -421,4 +421,37 @@ ventoy_udev_disk_common_hook() { fi } +is_inotify_ventoy_part() { + if echo $1 | grep -q "2$"; then + if ! [ -e /sys/block/$1 ]; then + if [ -e /sys/class/block/$1 ]; then + if [ -e /dev/${1:0:-1} ]; then + $VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c ${1:0:-1} + return + fi + fi + fi + fi + + [ "1" = "0" ] +} + +ventoy_find_dm_id() { + for vt in $($BUSYBOX_PATH/ls /sys/block/); do + if [ "${vt:0:3}" = "dm-" ]; then + vtMajorMinor=$($CAT /sys/block/$vt/dev) + if [ "$vtMajorMinor" = "$1" ]; then + echo ${vt} + return + fi + fi + done + echo 'xx' +} + +ventoy_swap_device() { + mv $1 $VTOY_PATH/swap_tmp_dev + mv $2 $1 + mv $VTOY_PATH/swap_tmp_dev $2 +}