Skip to content

Commit e7cf29f

Browse files
committed
Add create_ventoy_iso_part_dm.sh (#3497)
1 parent b5d87d3 commit e7cf29f

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
3+
if [ "$(id -u)" -ne 0 ]; then
4+
echo "Please run with sudo ..."
5+
exit 1
6+
fi
7+
8+
oldpwd=$(pwd)
9+
VPART=""
10+
11+
if dmsetup -h > /dev/null 2>&1; then
12+
VPART_MAJOR_MINOR=$(dmsetup table ventoy | head -n 1 | awk '{print $4}')
13+
cd /sys/class/block/
14+
for t in *; do
15+
if grep -q "^${VPART_MAJOR_MINOR}$" $t/dev; then
16+
VPART=$t
17+
echo 0 $(cat /sys/class/block/$VPART/size) linear /dev/$VPART 0 | dmsetup create $VPART
18+
dmsetup mknodes "$VPART" > /dev/null 2>&1
19+
break
20+
fi
21+
done
22+
cd $oldpwd
23+
24+
if [ -z "$VPART" ]; then
25+
echo "$VPART_MAJOR_MINOR not found"
26+
dmsetup ls; dmsetup info ventoy; dmsetup table ventoy
27+
exit 1
28+
else
29+
if [ ! -b "/dev/mapper/$VPART" ]; then
30+
udevadm trigger --type=devices --action=add > /dev/null 2>&1
31+
udevadm settle > /dev/null 2>&1
32+
fi
33+
echo "Create /dev/mapper/$VPART success"
34+
fi
35+
else
36+
echo "dmsetup program not avaliable"
37+
exit 1
38+
fi

INSTALL/ventoy_pack.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ mkdir -p $tmpmnt/tool
126126
dd status=none bs=1024 count=16 if=./tool/i386/vtoycli of=$tmpmnt/tool/mount.exfat-fuse_i386
127127
dd status=none bs=1024 count=16 if=./tool/x86_64/vtoycli of=$tmpmnt/tool/mount.exfat-fuse_x86_64
128128
dd status=none bs=1024 count=16 if=./tool/aarch64/vtoycli of=$tmpmnt/tool/mount.exfat-fuse_aarch64
129+
cp -a ./tool/create_ventoy_iso_part_dm.sh $tmpmnt/tool/
129130

130131

131132
rm -f $tmpmnt/grub/i386-pc/*.img

0 commit comments

Comments
 (0)