]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - IMG/cpio/ventoy/ventoy_chain.sh
Fix the boot issue for Parted Magic (#3304)
[Ventoy.git] / IMG / cpio / ventoy / ventoy_chain.sh
index 938f2e22cb06a06fc101b8833600938ae08025c3..d63a132239ee76e53975d4151b264abc5f974f31 100644 (file)
@@ -37,7 +37,6 @@ for i in $vtcmdline; do
     fi
 done
 
-
 ####################################################################
 #                                                                  #
 # Step 2 : Do OS specific hook                                     #
@@ -53,12 +52,39 @@ ventoy_get_os_type() {
         fi
     fi
 
+    # Parted Magic
+    if [ -d /pmagic ]; then
+        echo 'pmagic'; return
+    fi
+
+    # PrimeOS :
+    if $GREP -q 'PrimeOS' /proc/version; then
+        echo 'primeos'; return
+
+    # Debian :
+    elif $GREP -q '[Dd]ebian' /proc/version; then
+        echo 'debian'; return
+
+    # Ubuntu : do the same process with debian
+    elif $GREP -q '[Uu]buntu' /proc/version; then
+        echo 'debian'; return
+        
+    # Deepin :
+    elif $GREP -q '[Dd]eepin' /proc/version; then
+        echo 'deepin'; return
+
     # rhel5/CentOS5 and all other distributions based on them
-    if $GREP -q 'el5' /proc/version; then
+    elif $GREP -q 'el5' /proc/version; then
         echo 'rhel5'; return
 
     # rhel6/CentOS6 and all other distributions based on them
     elif $GREP -q 'el6' /proc/version; then
+        if [ -f /sbin/detectcd ]; then
+            if $GREP -q -i 'LENOVO-EasyStartup' /sbin/detectcd; then
+                echo 'easystartup'; return
+            fi
+        fi
+
         echo 'rhel6'; return
 
     # rhel7/CentOS7/rhel8/CentOS8 and all other distributions based on them
@@ -72,19 +98,10 @@ ventoy_get_os_type() {
     # Fedora : do the same process with rhel7
     elif $GREP -q '\.fc[0-9][0-9]\.' /proc/version; then
         echo 'rhel7'; return
-        
-    # Debian :
-    elif $GREP -q '[Dd]ebian' /proc/version; then
-        echo 'debian'; return
-        
-    # Ubuntu : do the same process with debian
-    elif $GREP -q '[Uu]buntu' /proc/version; then
-        echo 'debian'; return
-        
-    # Deepin : do the same process with debian
-    elif $GREP -q '[Dd]eepin' /proc/version; then
-        echo 'debian'; return
-        
+
+    elif $GREP -q 'euleros' /proc/version; then
+        echo 'rhel7'; return
+
     # SUSE
     elif $GREP -q 'SUSE' /proc/version; then
         echo 'suse'; return
@@ -152,6 +169,14 @@ ventoy_get_os_type() {
             echo 'debian'; return
         elif $GREP -q 'Solus' /etc/os-release; then
             echo 'rhel7'; return
+        elif $GREP -q 'openEuler' /etc/os-release; then
+            echo 'openEuler'; return
+        elif $GREP -q 'fuyu' /etc/os-release; then
+            echo 'openEuler'; return
+        elif $GREP -q 'deepin' /etc/os-release; then
+            echo 'deepin'; return
+        elif $GREP -q 'chinauos' /etc/os-release; then
+            echo 'deepin'; return
         fi
     fi
     
@@ -209,12 +234,12 @@ ventoy_get_os_type() {
         echo 'android'; return
     fi 
     
-    if $GREP -q 'adelielinux' /proc/version; then
-        echo 'adelie'; return
+    if $GREP -q 'android.google' /proc/version; then
+        echo 'android'; return
     fi
     
-    if $GREP -q 'pmagic' /proc/version; then
-        echo 'pmagic'; return
+    if $GREP -q 'adelielinux' /proc/version; then
+        echo 'adelie'; return
     fi
     
     if $GREP -q 'CDlinux' /proc/cmdline; then
@@ -305,6 +330,68 @@ ventoy_get_os_type() {
         echo 'blackPanther'; return
     fi
     
+    if $GREP -q 'primeos' /proc/version; then
+        echo 'primeos'; return
+    fi
+    
+    if $GREP -q 'austrumi' /proc/version; then
+        echo 'austrumi'; return
+    fi
+    
+    if [ -f /DISTRO_SPECS ]; then
+        if $GREP -q '[Pp]uppy' /DISTRO_SPECS; then
+            echo 'debian'; return
+        elif $GREP -q 'veket' /DISTRO_SPECS; then
+            echo 'debian'; return
+        fi
+    fi
+    
+    if [ -f /etc/openEuler-release ]; then
+        echo "openEuler"; return
+    fi
+    
+    
+    #special arch based iso file check
+    if [ -f /init ]; then
+        if $GREP -q 'mount_handler' /init; then
+            if [ -d /hooks ]; then
+                if $BUSYBOX_PATH/ls -1 /hooks/ | $GREP -q '.*iso$'; then
+                    echo "arch"; return
+                fi
+            elif [ -d /hook ]; then
+                if $BUSYBOX_PATH/ls -1 /hook/ | $GREP -q '.*iso$'; then
+                    echo "arch"; return
+                fi
+            fi
+        fi
+    fi
+    
+    
+    #Kylin V10 Server
+    if [ -f /usr/sbin/dhclient ]; then
+        if $BUSYBOX_PATH/strings /usr/sbin/dhclient | $GREP -i -q -m1 openeuler; then
+            echo 'openEuler'; return
+        fi
+    fi
+    
+    if $GREP -q 'chimera' /proc/version; then
+        echo 'chimera'; return
+    fi
+
+    
+    if $GREP -q '4.19.' /proc/version; then
+        if [ -d /lib/dracut/hooks ]; then
+            echo 'openEuler'; return
+        fi
+    fi
+    
+    if [ -f /etc/tinyramfs/config ]; then
+        if $GREP -q 'EWE_ISO' /etc/tinyramfs/config; then
+            echo "ewe"; return
+        fi
+    fi
+    
+    
     echo "default"
 }
 
@@ -315,9 +402,36 @@ if [ -e "$VTOY_PATH/hook/$VTOS/ventoy-hook.sh" ]; then
 fi
 
 
+
+if $GREP -q -i Untangle /proc/version; then
+    for vtPara in $($CAT /proc/cmdline); do
+        vtItemkey=$(echo $vtPara | $AWK -F= '{print $1}')
+        vtItemVal=$(echo $vtPara | $AWK -F= '{print $2}')
+        if $GREP -q -m1 "^$vtItemkey\$" $VTOY_PATH/hook/default/export.list; then
+            vtEnvExport="$vtEnvExport $vtItemkey=$vtItemVal"
+        fi
+    done
+    
+    echo "================ env export ================" >> $VTLOG
+    echo $vtEnvExport >> $VTLOG
+    echo "============================================" >> $VTLOG
+fi
+
+
+
+####################################################################
+#                                                                  #
+# Step 3 : Run LiveInjection Hook                                  #
+#                                                                  #
+####################################################################
+if [ -f "/live_injection_7ed136ec_7a61_4b54_adc3_ae494d5106ea/hook.sh" ]; then
+    $BUSYBOX_PATH/sh "/live_injection_7ed136ec_7a61_4b54_adc3_ae494d5106ea/hook.sh" $VTOS
+fi
+
+
 ####################################################################
 #                                                                  #
-# Step 3 : Check for debug break                                   #
+# Step 4 : Check for debug break                                   #
 #                                                                  #
 ####################################################################
 if [ "$VTOY_BREAK_LEVEL" = "03" ] || [ "$VTOY_BREAK_LEVEL" = "13" ]; then
@@ -334,7 +448,7 @@ fi
 
 ####################################################################
 #                                                                  #
-# Step 4 : Hand over to real init                                  #
+# Step 5 : Hand over to real init                                  #
 #                                                                  #
 ####################################################################
 $BUSYBOX_PATH/umount /proc
@@ -349,7 +463,7 @@ fi
 
 cd /
 
-unset VTLOG FIND GREP EGREP CAT AWK SED SLEEP HEAD
+unset VTLOG FIND GREP EGREP CAT AWK SED SLEEP HEAD vtcmdline
 
 for vtinit in $user_rdinit /init /sbin/init /linuxrc; do
     if [ -d /ventoy_rdroot ]; then
@@ -363,7 +477,12 @@ for vtinit in $user_rdinit /init /sbin/init /linuxrc; do
             if [ -f "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh" ]; then
                 $BUSYBOX_PATH/sh "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh"
             fi
-            exec "$vtinit"
+            
+            if [ -z "$vtEnvExport" ]; then
+                exec "$vtinit"
+            else
+                exec env $vtEnvExport "$vtinit"
+            fi            
         fi
     fi
 done