]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Fix a bug when booting Porteus 4.0 i586 20170701.iso
authorlongpanda <admin@ventoy.net>
Thu, 21 Oct 2021 12:23:32 +0000 (20:23 +0800)
committerlongpanda <admin@ventoy.net>
Thu, 21 Oct 2021 12:23:32 +0000 (20:23 +0800)
IMG/cpio/ventoy/hook/debian/porteus-hook.sh
VtoyTool/vtoydump.c
VtoyTool/vtoytool/00/vtoytool_32
VtoyTool/vtoytool/00/vtoytool_64
VtoyTool/vtoytool/00/vtoytool_aa64
VtoyTool/vtoytool/00/vtoytool_m64e

index f63b106327db636247da328115b23b32a59be056..287e6309fd491a777bf6c4b7b9cae009b9073e45 100644 (file)
@@ -22,9 +22,16 @@ porteus_hook() {
     $SED "/searching *for *\$CFG *file/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-disk.sh"  -i $1
 }
 
-if $GREP -q exfat /proc/filesystems; then
-    vtPath=$($VTOY_PATH/tool/vtoydump -p $VTOY_PATH/ventoy_os_param)
-    
+vtPath=$($VTOY_PATH/tool/vtoydump -p $VTOY_PATH/ventoy_os_param)
+echo $vtPath | $GREP -q " "
+_vtRet1=$?
+
+$GREP -q exfat /proc/filesystems
+_vtRet2=$?
+
+echo "_vtRet1=$_vtRet1  _vtRet2=$_vtRet2 ..." >> $VTLOG
+
+if [ $_vtRet1 -ne 0 -a $_vtRet2 -eq 0 ]; then
     vtFindFlag=0
     $GREP '`value from`' /usr/* -r | $AWK -F: '{print $1}' | while read vtline; do
         echo "hooking $vtline ..." >> $VTLOG
@@ -34,11 +41,19 @@ if $GREP -q exfat /proc/filesystems; then
 
     if [ $vtFindFlag -eq 0 ]; then
         if $GREP -q '`value from`' /linuxrc; then
-            echo "hooking linuxrc ..." >> $VTLOG
-            $SED "/searching *for *\$CFG *file/i$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-path.sh"  -i /linuxrc
-            $SED "/searching *for *\$CFG *file/iFROM=\$(cat /porteus-from)"  -i /linuxrc
-            $SED "/searching *for *\$CFG *file/iISO=\$(cat /porteus-from)"  -i /linuxrc
-            vtFindFlag=1
+            if $GREP -q "searching *for *\$CFG *file" /linuxrc; then
+                echo "hooking linuxrc CFG..." >> $VTLOG
+                $SED "/searching *for *\$CFG *file/i$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-path.sh"  -i /linuxrc
+                $SED "/searching *for *\$CFG *file/iFROM=\$(cat /porteus-from)"  -i /linuxrc
+                $SED "/searching *for *\$CFG *file/iISO=\$(cat /porteus-from)"  -i /linuxrc
+                vtFindFlag=1
+            else
+                echo "hooking linuxrc SGN..." >> $VTLOG
+                $SED "/searching *for *\$SGN *file/i$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-path.sh"  -i /linuxrc
+                $SED "/searching *for *\$SGN *file/iFROM=\$(cat /porteus-from)"  -i /linuxrc
+                $SED "/searching *for *\$SGN *file/iISO=\$(cat /porteus-from)"  -i /linuxrc
+                vtFindFlag=1
+            fi
         fi
     fi
 
@@ -46,7 +61,7 @@ else
     for vtfile in '/linuxrc' '/init'; do
         if [ -e $vtfile ]; then
             if ! $GREP -q ventoy $vtfile; then
-                echo "hooking $vtfile ..."  >> $VTLOG
+                echo "hooking disk $vtfile ..."  >> $VTLOG
                 porteus_hook $vtfile
             fi
         fi
index 72b78151262fe3ab6b21fea17371f380edc84a22..e58cc868eb27ca9c4d1984ea1b8fd402ce567a7c 100644 (file)
@@ -435,6 +435,24 @@ static int vtoy_printf_iso_path(ventoy_os_param *param)
     return 0;
 }
 
+static int vtoy_printf_fs(ventoy_os_param *param)
+{
+    const char *fs[] = 
+    {
+        "exfat", "ntfs", "ext", "xfs", "udf", "fat"
+    };
+
+    if (param->vtoy_disk_part_type < 6)
+    {
+        printf("%s\n", fs[param->vtoy_disk_part_type]);
+    }
+    else
+    {
+        printf("unknown\n");
+    }
+    return 0;
+}
+
 static int vtoy_check_device(ventoy_os_param *param, const char *device)
 {
     unsigned long long size; 
@@ -551,12 +569,13 @@ int vtoydump_main(int argc, char **argv)
     int rc;
     int ch;
     int print_path = 0;
+    int print_fs = 0;
     char filename[256] = {0};
     char diskname[256] = {0};
     char device[64] = {0};
     ventoy_os_param *param = NULL;
 
-    while ((ch = getopt(argc, argv, "c:f:p:v::")) != -1)
+    while ((ch = getopt(argc, argv, "c:f:p:s:v::")) != -1)
     {
         if (ch == 'f')
         {
@@ -575,6 +594,11 @@ int vtoydump_main(int argc, char **argv)
             print_path = 1;
             strncpy(filename, optarg, sizeof(filename) - 1);
         }
+        else if (ch == 's')
+        {
+            print_fs = 1;
+            strncpy(filename, optarg, sizeof(filename) - 1);
+        }
         else
         {
             fprintf(stderr, "Usage: %s -f datafile [ -v ] \n", argv[0]);
@@ -627,6 +651,10 @@ int vtoydump_main(int argc, char **argv)
     {
         rc = vtoy_printf_iso_path(param);
     }
+    else if (print_fs)
+    {
+        rc = vtoy_printf_fs(param);
+    }
     else if (device[0])
     {
         rc = vtoy_check_device(param, device);
index 97f553f4eae818f708f339b79ee919227a800089..b4f1dd77363acecbf92f0b8b3e8d41355020cc89 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_32 and b/VtoyTool/vtoytool/00/vtoytool_32 differ
index 53a951e60fcac7ac6e8c1d4fca265c746cfeff26..4c52cb549acf5e6305fd32708747d87998c0d071 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_64 and b/VtoyTool/vtoytool/00/vtoytool_64 differ
index 11833dce190e2f2dcea9a284f5a2d492aafe364b..c0284031e4eb953ab66a3db5e187d8158ac13b7e 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_aa64 and b/VtoyTool/vtoytool/00/vtoytool_aa64 differ
index 249e1a0c33b90b0e71760feca61ff2ebbe6ca5e0..5deb5e77ca9745ce3754caa8f9a28205241169cc 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_m64e and b/VtoyTool/vtoytool/00/vtoytool_m64e differ