]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Update Ventoy2Disk.sh
authorlongpanda <59477474+ventoy@users.noreply.github.com>
Sun, 24 May 2020 12:24:34 +0000 (20:24 +0800)
committerGitHub <noreply@github.com>
Sun, 24 May 2020 12:24:34 +0000 (20:24 +0800)
INSTALL/Ventoy2Disk.sh

index 01a5ab4c96e162eb4e9b5bece2be618e6f33a366..96dd77fb85cc6e348568db7ec2afd33bebdd14d9 100644 (file)
@@ -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