X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/b0568922d20d7c19025f371fa9066044777d7b5b..ebae102f41d1e18edd576ebff10537acff71b3cd:/INSTALL/tool/VentoyWorker.sh diff --git a/INSTALL/tool/VentoyWorker.sh b/INSTALL/tool/VentoyWorker.sh index 22c3de0..cdb1dbb 100644 --- a/INSTALL/tool/VentoyWorker.sh +++ b/INSTALL/tool/VentoyWorker.sh @@ -60,6 +60,12 @@ while [ -n "$1" ]; do exit 1 fi DISK=$1 + # Resolve symlinks now, will be needed to look up information about the device in + # the /sys/ filesystem, for example /sys/class/block/${DISK#/dev/}/start + # The main use case is supporting /dev/disk/by-id/ symlinks instead of raw devices + if [ -L "$DISK" ]; then + DISK=$(readlink -e -n "$DISK") + fi fi shift @@ -291,8 +297,23 @@ if [ "$MODE" = "install" -a -z "$NONDESTRUCTIVE" ]; then dd status=none conv=fsync if=/dev/zero of=$DISK bs=512 count=32 seek=$part2_start_sector #format part1 - vtinfo "Format partition 1 ..." - mkexfatfs -n "$VTNEW_LABEL" -s $cluster_sectors ${PART1} + wait_and_create_part ${PART1} ${PART2} + if [ -b ${PART1} ]; then + vtinfo "Format partition 1 ${PART1} ..." + mkexfatfs -n "$VTNEW_LABEL" -s $cluster_sectors ${PART1} + if [ $? -ne 0 ]; then + echo "mkexfatfs failed, now retry..." + mkexfatfs -n "$VTNEW_LABEL" -s $cluster_sectors ${PART1} + if [ $? -ne 0 ]; then + echo "######### mkexfatfs failed, exit ########" + exit 1 + fi + else + echo "mkexfatfs success" + fi + else + vterr "${PART1} NOT exist" + fi vtinfo "writing data to disk ..." dd status=none conv=fsync if=./boot/boot.img of=$DISK bs=1 count=446