diff --git a/INSTALL/tool/ventoy_lib.sh b/INSTALL/tool/ventoy_lib.sh index 7ae8fe3a..69d3e1ee 100644 --- a/INSTALL/tool/ventoy_lib.sh +++ b/INSTALL/tool/ventoy_lib.sh @@ -22,40 +22,17 @@ ventoy_is_linux64() { ventoy_false } -ventoy_is_dash() { - if [ -L /bin/sh ]; then - vtdst=$(readlink /bin/sh) - if [ "$vtdst" = "dash" ]; then - ventoy_true - return - fi - fi - ventoy_false -} - vtinfo() { - if ventoy_is_dash; then - echo "\033[32m$*\033[0m" - else - echo -e "\033[32m$*\033[0m" - fi + echo -e "\033[32m$*\033[0m" } vtwarn() { - if ventoy_is_dash; then - echo "\033[33m$*\033[0m" - else - echo -e "\033[33m$*\033[0m" - fi + echo -e "\033[33m$*\033[0m" } vterr() { - if ventoy_is_dash; then - echo "\033[31m$*\033[0m" - else - echo -e "\033[31m$*\033[0m" - fi + echo -e "\033[31m$*\033[0m" } vtdebug() { @@ -207,7 +184,6 @@ get_disk_ventoy_version() { ventoy_false } - format_ventoy_disk() { DISK=$1 PART1=$(get_disk_part_name $DISK 1) @@ -220,15 +196,30 @@ format_ventoy_disk() { export part2_start_sector=$(expr $part1_end_sector + 1) part2_end_sector=$(expr $sector_num - 1) + vtdebug "part1_start_sector=$part1_start_sector part1_end_sector=$part1_end_sector" + vtdebug "part2_start_sector=$part2_start_sector part2_end_sector=$part2_end_sector" + if [ -e $PART2 ]; then echo "delete $PART2" rm -f $PART2 fi echo "" - echo "Create partitions on $DISK ..." + echo "Create partitions on $DISK by $2 ..." -fdisk $DISK >/dev/null 2>&1 <>./log.txt 2>&1 </dev/null 2>&1 partprobe >/dev/null 2>&1 @@ -265,7 +257,11 @@ EOF sleep 1 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) echo "mknod -m 0660 $PART2 b $MajorMinor ..."