X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/a54b6f692ca459d388f89605cc2c3c8fd1225444..74154ad9a3fc72ea9e66142df528e1fed42dfebd:/INSTALL/tool/ventoy_lib.sh diff --git a/INSTALL/tool/ventoy_lib.sh b/INSTALL/tool/ventoy_lib.sh index 69d3e1e..80dea30 100644 --- a/INSTALL/tool/ventoy_lib.sh +++ b/INSTALL/tool/ventoy_lib.sh @@ -186,6 +186,8 @@ get_disk_ventoy_version() { format_ventoy_disk() { DISK=$1 + PARTTOOL=$2 + PART1=$(get_disk_part_name $DISK 1) PART2=$(get_disk_part_name $DISK 2) @@ -205,17 +207,20 @@ format_ventoy_disk() { fi echo "" - echo "Create partitions on $DISK by $2 ..." + echo "Create partitions on $DISK by $PARTTOOL ..." - if [ "$2" = "parted" ]; then + if [ "$PARTTOOL" = "parted" ]; then vtdebug "format disk by parted ..." parted -a none --script $DISK \ mklabel msdos \ unit s \ mkpart primary ntfs $part1_start_sector $part1_end_sector \ mkpart primary fat16 $part2_start_sector $part2_end_sector \ - set 2 boot on \ + set 1 boot on \ quit + + sync + echo -en '\xEF' | dd of=$DISK conv=fsync bs=1 count=1 seek=466 > /dev/null 2>&1 else vtdebug "format disk by fdisk ..." @@ -238,15 +243,15 @@ t 2 ef a -2 +1 w EOF fi - echo "Done" udevadm trigger >/dev/null 2>&1 partprobe >/dev/null 2>&1 sleep 3 + echo "Done" echo 'mkfs on disk partitions ...' for i in 1 2 3 4 5 6 7; do @@ -258,9 +263,6 @@ EOF fi done - if [ "$2" = "parted" ]; then - echo -en '\xEF' | dd of=$DISK conv=fsync bs=1 count=1 seek=466 - fi if ! [ -b $PART2 ]; then MajorMinor=$(sed "s/:/ /" /sys/class/block/${PART2#/dev/}/dev) @@ -274,7 +276,7 @@ EOF fi fi - echo "create efi fat fs ..." + echo "create efi fat fs $PART2 ..." for i in 0 1 2 3 4 5 6 7 8 9; do if mkfs.vfat -F 16 -n EFI $PART2; then echo 'success'