2020-04-04 12:07:50 -04:00
|
|
|
#!/ventoy/busybox/sh
|
|
|
|
#************************************************************************************
|
|
|
|
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation; either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#************************************************************************************
|
|
|
|
|
|
|
|
####################################################################
|
|
|
|
# #
|
|
|
|
# Step 1 : Parse kernel parameter #
|
|
|
|
# #
|
|
|
|
####################################################################
|
|
|
|
if ! [ -e /proc ]; then
|
|
|
|
$BUSYBOX_PATH/mkdir /proc
|
|
|
|
rmproc='Y'
|
|
|
|
fi
|
|
|
|
$BUSYBOX_PATH/mount -t proc proc /proc
|
|
|
|
|
|
|
|
# vtinit=xxx to replace rdinit=xxx
|
|
|
|
vtcmdline=$($CAT /proc/cmdline)
|
|
|
|
for i in $vtcmdline; do
|
|
|
|
if echo $i | $GREP -q vtinit; then
|
|
|
|
user_rdinit=${i#vtinit=}
|
|
|
|
echo "user set user_rdinit=${user_rdinit}" >>$VTLOG
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
####################################################################
|
|
|
|
# #
|
|
|
|
# Step 2 : Do OS specific hook #
|
|
|
|
# #
|
|
|
|
####################################################################
|
|
|
|
ventoy_get_os_type() {
|
|
|
|
echo "kernel version" >> $VTLOG
|
|
|
|
$CAT /proc/version >> $VTLOG
|
|
|
|
|
2020-08-14 10:16:27 -04:00
|
|
|
if [ -d /twres ]; then
|
|
|
|
if $GREP -q 'Phoenix' /init; then
|
|
|
|
echo 'phoenixos'; return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-03-06 08:04:36 -05:00
|
|
|
# PrimeOS :
|
|
|
|
if $GREP -q 'PrimeOS' /proc/version; then
|
|
|
|
echo 'primeos'; return
|
|
|
|
|
2021-10-09 21:51:13 -04:00
|
|
|
# Debian :
|
2022-03-06 08:04:36 -05:00
|
|
|
elif $GREP -q '[Dd]ebian' /proc/version; then
|
2021-10-09 21:51:13 -04:00
|
|
|
echo 'debian'; return
|
|
|
|
|
|
|
|
# Ubuntu : do the same process with debian
|
|
|
|
elif $GREP -q '[Uu]buntu' /proc/version; then
|
|
|
|
echo 'debian'; return
|
|
|
|
|
2023-05-28 12:11:21 -04:00
|
|
|
# Deepin :
|
2021-10-09 21:51:13 -04:00
|
|
|
elif $GREP -q '[Dd]eepin' /proc/version; then
|
2023-05-28 12:11:21 -04:00
|
|
|
echo 'deepin'; return
|
2021-10-09 21:51:13 -04:00
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
# rhel5/CentOS5 and all other distributions based on them
|
2021-10-09 21:51:13 -04:00
|
|
|
elif $GREP -q 'el5' /proc/version; then
|
2020-04-04 12:07:50 -04:00
|
|
|
echo 'rhel5'; return
|
|
|
|
|
|
|
|
# rhel6/CentOS6 and all other distributions based on them
|
|
|
|
elif $GREP -q 'el6' /proc/version; then
|
2021-08-23 04:56:17 -04:00
|
|
|
if [ -f /sbin/detectcd ]; then
|
|
|
|
if $GREP -q -i 'LENOVO-EasyStartup' /sbin/detectcd; then
|
|
|
|
echo 'easystartup'; return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
echo 'rhel6'; return
|
|
|
|
|
|
|
|
# rhel7/CentOS7/rhel8/CentOS8 and all other distributions based on them
|
|
|
|
elif $GREP -q 'el[78]' /proc/version; then
|
|
|
|
echo 'rhel7'; return
|
|
|
|
|
|
|
|
# Maybe rhel9 rhel1x use the same way? Who knows!
|
|
|
|
elif $EGREP -q 'el9|el1[0-9]' /proc/version; then
|
|
|
|
echo 'rhel7'; return
|
|
|
|
|
|
|
|
# Fedora : do the same process with rhel7
|
|
|
|
elif $GREP -q '\.fc[0-9][0-9]\.' /proc/version; then
|
|
|
|
echo 'rhel7'; return
|
2022-04-28 10:18:02 -04:00
|
|
|
|
|
|
|
elif $GREP -q 'euleros' /proc/version; then
|
|
|
|
echo 'rhel7'; return
|
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
# SUSE
|
|
|
|
elif $GREP -q 'SUSE' /proc/version; then
|
|
|
|
echo 'suse'; return
|
|
|
|
|
|
|
|
# ArchLinux
|
|
|
|
elif $EGREP -q 'archlinux|ARCH' /proc/version; then
|
|
|
|
echo 'arch'; return
|
|
|
|
|
2020-06-14 13:41:33 -04:00
|
|
|
# kiosk
|
|
|
|
elif $EGREP -q 'kiosk' /proc/version; then
|
|
|
|
echo 'kiosk'; return
|
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
# gentoo
|
|
|
|
elif $EGREP -q '[Gg]entoo' /proc/version; then
|
2020-08-14 10:16:27 -04:00
|
|
|
if $GREP -q 'daphile' /proc/version; then
|
|
|
|
echo 'daphile'; return
|
|
|
|
fi
|
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
echo 'gentoo'; return
|
|
|
|
|
|
|
|
# TinyCore
|
|
|
|
elif $EGREP -q 'tinycore' /proc/version; then
|
|
|
|
echo 'tinycore'; return
|
|
|
|
|
|
|
|
# manjaro
|
|
|
|
elif $EGREP -q 'manjaro|MANJARO' /proc/version; then
|
|
|
|
echo 'manjaro'; return
|
|
|
|
|
|
|
|
# mageia
|
|
|
|
elif $EGREP -q 'mageia' /proc/version; then
|
|
|
|
echo 'mageia'; return
|
|
|
|
|
|
|
|
# pclinux OS
|
|
|
|
elif $GREP -i -q 'PCLinuxOS' /proc/version; then
|
|
|
|
echo 'pclos'; return
|
|
|
|
|
|
|
|
# KaOS
|
|
|
|
elif $GREP -i -q 'kaos' /proc/version; then
|
|
|
|
echo 'kaos'; return
|
|
|
|
|
|
|
|
# Alpine
|
|
|
|
elif $GREP -q 'Alpine' /proc/version; then
|
|
|
|
echo 'alpine'; return
|
|
|
|
|
2020-08-14 10:16:27 -04:00
|
|
|
elif $GREP -i -q 'PhoenixOS' /proc/version; then
|
|
|
|
echo 'phoenixos'; return
|
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
# NixOS
|
|
|
|
elif $GREP -i -q 'NixOS' /proc/version; then
|
|
|
|
echo 'nixos'; return
|
|
|
|
|
2020-08-14 10:16:27 -04:00
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e /lib/debian-installer ]; then
|
|
|
|
echo 'debian'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e /etc/os-release ]; then
|
|
|
|
if $GREP -q 'XenServer' /etc/os-release; then
|
|
|
|
echo 'xen'; return
|
|
|
|
elif $GREP -q 'SUSE ' /etc/os-release; then
|
2020-07-18 10:06:59 -04:00
|
|
|
echo 'suse'; return
|
|
|
|
elif $GREP -q 'uruk' /etc/os-release; then
|
|
|
|
echo 'debian'; return
|
2020-08-07 10:23:27 -04:00
|
|
|
elif $GREP -q 'Solus' /etc/os-release; then
|
|
|
|
echo 'rhel7'; return
|
2021-03-13 05:55:05 -05:00
|
|
|
elif $GREP -q 'openEuler' /etc/os-release; then
|
|
|
|
echo 'openEuler'; return
|
2021-04-27 06:22:10 -04:00
|
|
|
elif $GREP -q 'fuyu' /etc/os-release; then
|
2021-09-24 23:22:55 -04:00
|
|
|
echo 'openEuler'; return
|
|
|
|
elif $GREP -q 'deepin' /etc/os-release; then
|
2023-05-28 12:11:21 -04:00
|
|
|
echo 'deepin'; return
|
2021-09-24 23:22:55 -04:00
|
|
|
elif $GREP -q 'chinauos' /etc/os-release; then
|
2023-05-28 12:11:21 -04:00
|
|
|
echo 'deepin'; return
|
2020-04-04 12:07:50 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $BUSYBOX_PATH/dmesg | $GREP -q -m1 "Xen:"; then
|
|
|
|
echo 'xen'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -e /etc/HOSTNAME ] && $GREP -i -q 'slackware' /etc/HOSTNAME; then
|
|
|
|
echo 'slackware'; return
|
|
|
|
fi
|
|
|
|
|
2020-04-14 10:24:19 -04:00
|
|
|
if [ -e /init ]; then
|
|
|
|
if $GREP -i -q zeroshell /init; then
|
|
|
|
echo 'zeroshell'; return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-04-18 10:14:10 -04:00
|
|
|
if $EGREP -q 'ALT ' /proc/version; then
|
|
|
|
echo 'alt'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $EGREP -q 'porteus' /proc/version; then
|
|
|
|
echo 'debian'; return
|
|
|
|
fi
|
2020-04-04 12:07:50 -04:00
|
|
|
|
2020-04-24 09:58:00 -04:00
|
|
|
if $GREP -q 'Clear Linux ' /proc/version; then
|
|
|
|
echo 'clear'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'artix' /proc/version; then
|
|
|
|
echo 'arch'; return
|
|
|
|
fi
|
|
|
|
|
2020-04-30 10:40:40 -04:00
|
|
|
if $GREP -q 'berry ' /proc/version; then
|
|
|
|
echo 'berry'; return
|
|
|
|
fi
|
|
|
|
|
2020-05-09 10:15:06 -04:00
|
|
|
if $GREP -q 'Gobo ' /proc/version; then
|
|
|
|
echo 'gobo'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'NuTyX' /proc/version; then
|
|
|
|
echo 'nutyx'; return
|
|
|
|
fi
|
2020-04-30 10:40:40 -04:00
|
|
|
|
2020-05-09 10:15:06 -04:00
|
|
|
if [ -d /gnu ]; then
|
|
|
|
vtLineNum=$($FIND /gnu/ -name guix | $BUSYBOX_PATH/wc -l)
|
|
|
|
if [ $vtLineNum -gt 0 ]; then
|
|
|
|
echo 'guix'; return
|
|
|
|
fi
|
|
|
|
fi
|
2020-04-30 10:40:40 -04:00
|
|
|
|
2020-05-30 08:13:04 -04:00
|
|
|
if $GREP -q 'android.x86' /proc/version; then
|
|
|
|
echo 'android'; return
|
|
|
|
fi
|
|
|
|
|
2023-04-02 21:18:13 -04:00
|
|
|
if $GREP -q 'android.google' /proc/version; then
|
|
|
|
echo 'android'; return
|
|
|
|
fi
|
|
|
|
|
2020-06-25 11:01:48 -04:00
|
|
|
if $GREP -q 'adelielinux' /proc/version; then
|
|
|
|
echo 'adelie'; return
|
|
|
|
fi
|
|
|
|
|
2020-07-09 07:26:10 -04:00
|
|
|
if $GREP -q 'pmagic' /proc/version; then
|
|
|
|
echo 'pmagic'; return
|
|
|
|
fi
|
|
|
|
|
2020-07-09 10:44:04 -04:00
|
|
|
if $GREP -q 'CDlinux' /proc/cmdline; then
|
|
|
|
echo 'cdlinux'; return
|
|
|
|
fi
|
|
|
|
|
2020-07-18 10:06:59 -04:00
|
|
|
if $GREP -q 'parabola' /proc/version; then
|
|
|
|
echo 'parabola'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'cucumber' /proc/version; then
|
|
|
|
echo 'cucumber'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'fatdog' /proc/version; then
|
|
|
|
echo 'fatdog'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'KWORT' /proc/version; then
|
|
|
|
echo 'kwort'; return
|
|
|
|
fi
|
|
|
|
|
2020-07-22 11:30:01 -04:00
|
|
|
if $GREP -q 'iwamoto' /proc/version; then
|
|
|
|
echo 'vine'; return
|
|
|
|
fi
|
2020-07-18 10:06:59 -04:00
|
|
|
|
2020-08-13 08:20:20 -04:00
|
|
|
if $GREP -q 'hyperbola' /proc/cmdline; then
|
|
|
|
echo 'hyperbola'; return
|
|
|
|
fi
|
|
|
|
|
2020-08-14 10:16:27 -04:00
|
|
|
if $GREP -q 'CRUX' /proc/version; then
|
|
|
|
echo 'crux'; return
|
|
|
|
fi
|
|
|
|
|
2020-08-29 01:12:36 -04:00
|
|
|
if [ -f /init ]; then
|
|
|
|
if $GREP -q 'AryaLinux' /init; then
|
|
|
|
echo 'aryalinux'; return
|
|
|
|
elif $GREP -q 'Dragora' /init; then
|
|
|
|
echo 'dragora'; return
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'slackware' /proc/version; then
|
|
|
|
echo 'slackware'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $BUSYBOX_PATH/hostname | $GREP -q 'smoothwall'; then
|
|
|
|
echo 'smoothwall'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'photon' /proc/version; then
|
|
|
|
echo 'photon'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'ploplinux' /proc/version; then
|
|
|
|
echo 'ploplinux'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'lunar' /proc/version; then
|
|
|
|
echo 'lunar'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'SMGL-' /proc/version; then
|
|
|
|
echo 'smgl'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'rancher' /proc/version; then
|
|
|
|
echo 'rancher'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -e /init ]; then
|
|
|
|
if $GREP -q -m1 'T2 SDE' /init; then
|
|
|
|
echo 't2'; return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'wifislax' /proc/version; then
|
|
|
|
echo 'wifislax'; return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $GREP -q 'pisilinux' /proc/version; then
|
|
|
|
echo 'pisilinux'; return
|
|
|
|
fi
|
|
|
|
|
2020-08-30 04:34:20 -04:00
|
|
|
if $GREP -q 'blackPanther' /proc/version; then
|
|
|
|
echo 'blackPanther'; return
|
|
|
|
fi
|
|
|
|
|
2020-12-11 18:56:52 -05:00
|
|
|
if $GREP -q 'primeos' /proc/version; then
|
|
|
|
echo 'primeos'; return
|
|
|
|
fi
|
|
|
|
|
2020-12-15 04:42:15 -05:00
|
|
|
if $GREP -q 'austrumi' /proc/version; then
|
|
|
|
echo 'austrumi'; return
|
|
|
|
fi
|
|
|
|
|
2021-01-15 01:09:59 -05:00
|
|
|
if [ -f /DISTRO_SPECS ]; then
|
|
|
|
if $GREP -q '[Pp]uppy' /DISTRO_SPECS; then
|
|
|
|
echo 'debian'; return
|
2021-03-08 03:18:22 -05:00
|
|
|
elif $GREP -q 'veket' /DISTRO_SPECS; then
|
|
|
|
echo 'debian'; return
|
2021-01-15 01:09:59 -05:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-03-13 05:55:05 -05:00
|
|
|
if [ -f /etc/openEuler-release ]; then
|
|
|
|
echo "openEuler"; return
|
|
|
|
fi
|
|
|
|
|
2022-03-22 07:14:51 -04:00
|
|
|
|
|
|
|
#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
|
2022-03-22 05:52:56 -04:00
|
|
|
fi
|
|
|
|
|
2022-03-22 07:14:51 -04:00
|
|
|
|
2022-07-26 11:08:40 -04:00
|
|
|
#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
|
|
|
|
|
2023-03-24 08:43:47 -04:00
|
|
|
if $GREP -q 'chimera' /proc/version; then
|
|
|
|
echo 'chimera'; return
|
|
|
|
fi
|
2023-07-30 00:58:29 -04:00
|
|
|
|
|
|
|
|
|
|
|
if $GREP -q '4.19.' /proc/version; then
|
|
|
|
if [ -d /lib/dracut/hooks ]; then
|
|
|
|
echo 'openEuler'; return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-03-22 07:14:51 -04:00
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
echo "default"
|
|
|
|
}
|
|
|
|
|
|
|
|
VTOS=$(ventoy_get_os_type)
|
|
|
|
echo "OS=###${VTOS}###" >>$VTLOG
|
|
|
|
if [ -e "$VTOY_PATH/hook/$VTOS/ventoy-hook.sh" ]; then
|
|
|
|
$BUSYBOX_PATH/sh "$VTOY_PATH/hook/$VTOS/ventoy-hook.sh"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2021-10-09 10:53:48 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
####################################################################
|
|
|
|
# #
|
2021-09-27 09:00:08 -04:00
|
|
|
# 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 4 : Check for debug break #
|
2020-04-04 12:07:50 -04:00
|
|
|
# #
|
|
|
|
####################################################################
|
|
|
|
if [ "$VTOY_BREAK_LEVEL" = "03" ] || [ "$VTOY_BREAK_LEVEL" = "13" ]; then
|
|
|
|
$SLEEP 5
|
|
|
|
echo -e "\n\n\033[32m ################################################# \033[0m"
|
|
|
|
echo -e "\033[32m ################ VENTOY DEBUG ################### \033[0m"
|
|
|
|
echo -e "\033[32m ################################################# \033[0m \n"
|
|
|
|
if [ "$VTOY_BREAK_LEVEL" = "13" ]; then
|
|
|
|
$CAT $VTOY_PATH/log
|
|
|
|
fi
|
|
|
|
exec $BUSYBOX_PATH/sh
|
|
|
|
fi
|
|
|
|
|
2020-07-22 11:30:01 -04:00
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
####################################################################
|
|
|
|
# #
|
2021-09-27 09:00:08 -04:00
|
|
|
# Step 5 : Hand over to real init #
|
2020-04-04 12:07:50 -04:00
|
|
|
# #
|
|
|
|
####################################################################
|
|
|
|
$BUSYBOX_PATH/umount /proc
|
|
|
|
if [ "$rmproc" = "Y" ]; then
|
|
|
|
$BUSYBOX_PATH/rm -rf /proc
|
|
|
|
fi
|
|
|
|
|
2020-05-23 09:19:26 -04:00
|
|
|
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
|
|
|
export PERSISTENT='YES'
|
|
|
|
export PERSISTENCE='true'
|
|
|
|
fi
|
|
|
|
|
2020-04-04 12:07:50 -04:00
|
|
|
cd /
|
2020-06-25 11:01:48 -04:00
|
|
|
|
2020-09-11 14:46:44 -04:00
|
|
|
unset VTLOG FIND GREP EGREP CAT AWK SED SLEEP HEAD vtcmdline
|
2020-04-04 12:07:50 -04:00
|
|
|
|
|
|
|
for vtinit in $user_rdinit /init /sbin/init /linuxrc; do
|
|
|
|
if [ -d /ventoy_rdroot ]; then
|
|
|
|
if [ -e "/ventoy_rdroot$vtinit" ]; then
|
|
|
|
# switch_root will check /init file, this is a cheat code
|
|
|
|
echo 'switch_root' > /init
|
|
|
|
exec $BUSYBOX_PATH/switch_root /ventoy_rdroot "$vtinit"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [ -e "$vtinit" ];then
|
2020-06-25 11:01:48 -04:00
|
|
|
if [ -f "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh" ]; then
|
|
|
|
$BUSYBOX_PATH/sh "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh"
|
|
|
|
fi
|
2021-10-09 10:53:48 -04:00
|
|
|
|
|
|
|
if [ -z "$vtEnvExport" ]; then
|
|
|
|
exec "$vtinit"
|
|
|
|
else
|
|
|
|
exec env $vtEnvExport "$vtinit"
|
|
|
|
fi
|
2020-04-04 12:07:50 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Should never reach here
|
|
|
|
echo -e "\n\n\033[31m ############ INIT NOT FOUND ############### \033[0m \n"
|
|
|
|
exec $BUSYBOX_PATH/sh
|