Files
Ventoy/INSTALL/tool/create_ventoy_iso_part_dm.sh
T
longpanda 490ed6ce0f
Ventoy CI / build (push) Canceled after 0s
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Canceled after 0s
1. Improve the Linux remount feature to make the ISO partition mountable out of the box on mainstream desktop distros.
2. Change the ISO partition dm name to stable /dev/mapper/VentoyPart
2026-10-08 11:10:13 +08:00

39 lines
1.0 KiB
Bash

#!/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 VentoyPart
dmsetup mknodes "VentoyPart" > /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/VentoyPart success"
fi
else
echo "dmsetup program not avaliable"
exit 1
fi