From e7cf29fd9d0afb0562ce467dc3a7f95c6cf42e5b Mon Sep 17 00:00:00 2001 From: longpanda Date: Sun, 1 Feb 2026 13:54:16 +0800 Subject: [PATCH] Add create_ventoy_iso_part_dm.sh (#3497) --- INSTALL/tool/create_ventoy_iso_part_dm.sh | 38 +++++++++++++++++++++++ INSTALL/ventoy_pack.sh | 1 + 2 files changed, 39 insertions(+) create mode 100644 INSTALL/tool/create_ventoy_iso_part_dm.sh diff --git a/INSTALL/tool/create_ventoy_iso_part_dm.sh b/INSTALL/tool/create_ventoy_iso_part_dm.sh new file mode 100644 index 00000000..a7ad6ed0 --- /dev/null +++ b/INSTALL/tool/create_ventoy_iso_part_dm.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +if [ "$(id -u)" -ne 0 ]; then + echo "Please run with sudo ..." + exit 1 +fi + +oldpwd=$(pwd) +VPART="" + +if dmsetup -h > /dev/null 2>&1; then + VPART_MAJOR_MINOR=$(dmsetup table ventoy | head -n 1 | awk '{print $4}') + cd /sys/class/block/ + for t in *; do + if grep -q "^${VPART_MAJOR_MINOR}$" $t/dev; then + VPART=$t + echo 0 $(cat /sys/class/block/$VPART/size) linear /dev/$VPART 0 | dmsetup create $VPART + dmsetup mknodes "$VPART" > /dev/null 2>&1 + break + fi + done + cd $oldpwd + + if [ -z "$VPART" ]; then + echo "$VPART_MAJOR_MINOR not found" + dmsetup ls; dmsetup info ventoy; dmsetup table ventoy + exit 1 + else + if [ ! -b "/dev/mapper/$VPART" ]; then + udevadm trigger --type=devices --action=add > /dev/null 2>&1 + udevadm settle > /dev/null 2>&1 + fi + echo "Create /dev/mapper/$VPART success" + fi +else + echo "dmsetup program not avaliable" + exit 1 +fi diff --git a/INSTALL/ventoy_pack.sh b/INSTALL/ventoy_pack.sh index e03e8b02..3ab99b86 100644 --- a/INSTALL/ventoy_pack.sh +++ b/INSTALL/ventoy_pack.sh @@ -126,6 +126,7 @@ mkdir -p $tmpmnt/tool dd status=none bs=1024 count=16 if=./tool/i386/vtoycli of=$tmpmnt/tool/mount.exfat-fuse_i386 dd status=none bs=1024 count=16 if=./tool/x86_64/vtoycli of=$tmpmnt/tool/mount.exfat-fuse_x86_64 dd status=none bs=1024 count=16 if=./tool/aarch64/vtoycli of=$tmpmnt/tool/mount.exfat-fuse_aarch64 +cp -a ./tool/create_ventoy_iso_part_dm.sh $tmpmnt/tool/ rm -f $tmpmnt/grub/i386-pc/*.img