From 73c196a823e4cd86812eeddaa76a76997d2aa0fc Mon Sep 17 00:00:00 2001 From: longpanda <59477474+ventoy@users.noreply.github.com> Date: Sun, 24 May 2020 20:24:34 +0800 Subject: [PATCH] Update Ventoy2Disk.sh --- INSTALL/Ventoy2Disk.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/INSTALL/Ventoy2Disk.sh b/INSTALL/Ventoy2Disk.sh index 01a5ab4c..96dd77fb 100644 --- a/INSTALL/Ventoy2Disk.sh +++ b/INSTALL/Ventoy2Disk.sh @@ -110,6 +110,13 @@ if ! check_tool_work_ok; then exit 1 fi +testEF=$(echo -en '\xEF' | ./tool/hexdump -n 1 -e '1/1 "%02X"') +if [ "$testEF" != "EF" ]; then + vtdebug "testEF=##${testEF}##" + vterr "There is something wrong with the interpreter !" + exit 1 +fi + grep "^$DISK" /proc/mounts | while read mtline; do mtpnt=$(echo $mtline | awk '{print $2}') vtdebug "Trying to umount $mtpnt ..." @@ -139,9 +146,13 @@ fi if [ "$MODE" = "install" ]; then vtdebug "install ventoy ..." - - if ! fdisk -v >/dev/null 2>&1; then - vterr "fdisk is needed by ventoy installation, but is not found in the system." + + if parted -v > /dev/null 2>&1; then + PARTTOOL='parted' + elif fdisk -v >/dev/null 2>&1; then + PARTTOOL='fdisk' + else + vterr "Both parted and fdisk are not found in the sysstem, Ventoy can't create new partition." cd $OLDDIR exit 1 fi @@ -205,7 +216,7 @@ if [ "$MODE" = "install" ]; then exit 1 fi - format_ventoy_disk $DISK + format_ventoy_disk $DISK $PARTTOOL # format part1 if ventoy_is_linux64; then