]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
fix a bug about injection plugin in GPT partition style.
[Ventoy.git] / IMG / cpio / ventoy / hook / debian / udev_disk_hook.sh
index 007d2fa37a574693229a9377dfebe53423ffe540..8cbda0e52eaee1e6bc7bf689ec93204186c68b2b 100644 (file)
@@ -21,6 +21,8 @@
 
 ventoy_os_install_dmsetup() {
 
+    vtlog "ventoy_os_install_dmsetup $1 ..."
+
     vt_usb_disk=$1
 
     # dump iso file location
@@ -48,7 +50,7 @@ ventoy_os_install_dmsetup() {
     if $GREP -q 'device-mapper' /proc/devices; then
         vtlog "device mapper module is loaded"
     else
-        vtlog"device mapper module is NOT loaded, now load it..."
+        vtlog "device mapper module is NOT loaded, now load it..."
         
         VER=$($BUSYBOX_PATH/uname -r)    
         KO=$($FIND /lib/modules/$VER/kernel/drivers/md -name "dm-mod*")
@@ -97,7 +99,18 @@ ventoy_udev_disk_common_hook $*
 # So if ventoy is installed on a non-USB device, we just mount /cdrom here except
 # for these has boot=live or boot=casper parameter in cmdline
 #
-if echo $ID_BUS | $GREP -q -i usb; then
+VT_BUS_USB=""
+if [ -n "$ID_BUS" ]; then
+    if echo $ID_BUS | $GREP -q -i usb; then
+        VT_BUS_USB="YES"
+    fi
+else
+    if $BUSYBOX_PATH/ls -l /sys/class/block/${1:0:-1} | $GREP -q -i usb; then
+        VT_BUS_USB="YES"
+    fi
+fi
+
+if [ -n "$VT_BUS_USB" ]; then
     vtlog "$1 is USB device"
 else
     vtlog "$1 is NOT USB device (bus $ID_BUS)"