diff --git a/IMG/cpio/ventoy/hook/arch/ventoy-uauto-hook.sh b/IMG/cpio/ventoy/hook/arch/ventoy-uauto-hook.sh index 8f6aeee3..267bd539 100644 --- a/IMG/cpio/ventoy/hook/arch/ventoy-uauto-hook.sh +++ b/IMG/cpio/ventoy/hook/arch/ventoy-uauto-hook.sh @@ -9,7 +9,7 @@ vtlog "####### $0 $* ########" vtoy_udev_auto_hook() { if grep -q 'break.*=.*postmount' /init; then vtlog "udev auto before postmount" - sed "/break.*=.*postmount/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/manjaro/ventoy-uauto-exec.sh" -i /init + sed "/break.*=.*postmount/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ventoy-uauto-exec.sh" -i /init elif [ -d $VT_DRACUT_HOOKS/pre-pivot ]; then vtlog "dracut distro" ventoy_dracut_pivot_udev_rule diff --git a/IMG/cpio/ventoy/hook/debian/ventoy-clonezilla-cheat.service b/IMG/cpio/ventoy/hook/debian/ventoy-clonezilla-cheat.service index f1e89874..def9e113 100644 --- a/IMG/cpio/ventoy/hook/debian/ventoy-clonezilla-cheat.service +++ b/IMG/cpio/ventoy/hook/debian/ventoy-clonezilla-cheat.service @@ -6,6 +6,10 @@ After=systemd-udevd.service Type=oneshot ExecStart=mv /dev/VTISOPART /dev/bk_VTISOPART ExecStart=cp -a /dev/DMXXX /dev/VTISOPART +ExecStartPost=-/bin/sh -c '\ + rm -f /etc/systemd/system/ventoy-clonezilla-cheat.service;\ + rm -f /etc/systemd/system-preset/90-ventoy-clonezilla.preset;\ + rm -f /etc/systemd/system/sysinit.target.wants/ventoy-clonezilla-cheat.service;\ +' -[Install] WantedBy=sysinit.target diff --git a/IMG/cpio/ventoy/hook/debian/ventoy-curtin-wa.service b/IMG/cpio/ventoy/hook/debian/ventoy-curtin-wa.service index 66874491..e56c6ced 100644 --- a/IMG/cpio/ventoy/hook/debian/ventoy-curtin-wa.service +++ b/IMG/cpio/ventoy/hook/debian/ventoy-curtin-wa.service @@ -3,6 +3,12 @@ Description=Ventoy subiquity curtin Workaround [Service] Type=oneshot -ExecStart=/etc/ventoy/ventoy-curtin-wa.sh +ExecStart=-/bin/sh /etc/ventoy_curtin/ventoy-curtin-wa.sh +ExecStartPost=-/bin/sh -c '\ + rm -f /etc/systemd/system/ventoy-curtin-wa.service;\ + rm -f /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d/10-ventoy-curtin-wa.conf;\ + rm -rf /etc/ventoy_curtin;\ +' + PrivateMounts=no ProtectSystem=no diff --git a/IMG/cpio/ventoy/hook/debian/ventoy-uauto-exec.sh b/IMG/cpio/ventoy/hook/debian/ventoy-uauto-exec.sh index 4e6cde13..969dc322 100644 --- a/IMG/cpio/ventoy/hook/debian/ventoy-uauto-exec.sh +++ b/IMG/cpio/ventoy/hook/debian/ventoy-uauto-exec.sh @@ -7,16 +7,16 @@ PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH vtlog "####### $0 $* ########" subiquity_curtin_workaround() { - mkdir -p /root/etc/ventoy - ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.sh /root/etc/ventoy/ventoy-curtin-wa.sh 0755 - ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.conf /root/etc/ventoy/ventoy-curtin-wa.conf 0644 - ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.service /root/etc/ventoy/ventoy-curtin-wa.service 0644 + mkdir -p /root/etc/ventoy_curtin + ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.sh /root/etc/ventoy_curtin/ventoy-curtin-wa.sh 0755 + ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.conf /root/etc/ventoy_curtin/ventoy-curtin-wa.conf 0644 + ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.service /root/etc/ventoy_curtin/ventoy-curtin-wa.service 0644 - ln -sf /etc/ventoy/ventoy-curtin-wa.service /root/etc/systemd/system/ventoy-curtin-wa.service + ln -sf /etc/ventoy_curtin/ventoy-curtin-wa.service /root/etc/systemd/system/ventoy-curtin-wa.service vtDepDir=/root/etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d mkdir -p $vtDepDir - ln -sf /etc/ventoy/ventoy-curtin-wa.conf $vtDepDir/10-ventoy-curtin-wa.conf + ln -sf /etc/ventoy_curtin/ventoy-curtin-wa.conf $vtDepDir/10-ventoy-curtin-wa.conf } diff --git a/IMG/cpio/ventoy/hook/default/90-ventoy-auto.rules b/IMG/cpio/ventoy/hook/default/90-ventoy-auto.rules index cf9bf8cf..ae5d4036 100644 --- a/IMG/cpio/ventoy/hook/default/90-ventoy-auto.rules +++ b/IMG/cpio/ventoy/hook/default/90-ventoy-auto.rules @@ -6,7 +6,9 @@ ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="DMXXX", \ ENV{UDISKS_SYSTEM}="0", \ ENV{UDISKS_REMOVABLE}="1", \ ENV{UDISKS_AUTO}="1", \ + ENV{UDISKS_IGNORE}="0", \ ENV{UDISKS_AUTOMOUNTABLE}="1" KERNEL=="yyy", SUBSYSTEM=="block", ENV{UDISKS_IGNORE}="1" + diff --git a/IMG/cpio/ventoy/hook/default/systemd/ventoy-udev-cleanup.sh b/IMG/cpio/ventoy/hook/default/systemd/ventoy-udev-cleanup.sh new file mode 100644 index 00000000..755a4834 --- /dev/null +++ b/IMG/cpio/ventoy/hook/default/systemd/ventoy-udev-cleanup.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +rm -f /etc/systemd/system-preset/80-ventoy-udev.preset +rm -f /etc/systemd/system/sysinit.target.wants/ventoy-udev*.service +rm -f /etc/systemd/system/ventoy-udev*.service + +if [ -f /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d/10-ventoy-curtin-wa.conf ]; then + if [ -e /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service ]; then + : + else + rm -f /etc/systemd/system/ventoy-curtin-wa.service + rm -f /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d/10-ventoy-curtin-wa.conf + rm -rf /etc/ventoy_curtin + fi +fi + + + +mkdir -p /run/udev/rules.d +mv /etc/udev/rules.d/*ventoy* /run/udev/rules.d/ + +rm -f $0 diff --git a/IMG/cpio/ventoy/hook/default/ventoy-udev-trigger.service b/IMG/cpio/ventoy/hook/default/systemd/ventoy-udev-trigger.service similarity index 55% rename from IMG/cpio/ventoy/hook/default/ventoy-udev-trigger.service rename to IMG/cpio/ventoy/hook/default/systemd/ventoy-udev-trigger.service index 13b8f048..99ceaa17 100644 --- a/IMG/cpio/ventoy/hook/default/ventoy-udev-trigger.service +++ b/IMG/cpio/ventoy/hook/default/systemd/ventoy-udev-trigger.service @@ -4,8 +4,12 @@ After=systemd-udevd.service [Service] Type=oneshot +ExecStart=-udevadm trigger --subsystem-match=block --sysname-match=yyy ExecStart=-udevadm trigger --subsystem-match=block --sysname-match=DMXXX -ExecStart=udevadm settle +ExecStart=-udevadm settle +ExecStartPost=-/bin/sh /etc/ventoy-udev-cleanup.sh + +RemainAfterExit=no [Install] WantedBy=sysinit.target diff --git a/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-cleanup.sh b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-cleanup.sh new file mode 100644 index 00000000..812b50ee --- /dev/null +++ b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-cleanup.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +set +e + +rm -f /etc/boot.d/S01-ventoy-udev-trigger* +rm -f /etc/runlevels/sysinit/ventoy-udev-trigger* +rm -f /etc/runlevels/default/ventoy-udev-trigger* +rm -f /etc/dinit.d/boot.d/ventoy-udev-trigger* +rm -f /etc/dinit.d/default/ventoy-udev-trigger* +rm -f /etc/runit/runsvdir/sysinit/ventoy-udev-trigger* +rm -f /etc/runit/runsvdir/default/ventoy-udev-trigger* +rm -f /etc/s6/adminsv/sysinit/contents.d/ventoy-udev-trigger* + +rm -f /etc/init.d/ventoy-udev-trigger* +rm -f /etc/dinit.d/ventoy-udev-trigger* +rm -rf /etc/runit/sv/ventoy-udev-trigger* +rm -rf /etc/s6/sv/ventoy-udev-trigger* + + +if ls -l /etc/udev/rules.d/ | grep -q ventoy; then + mkdir -p /run/udev/rules.d + mv /etc/udev/rules.d/*ventoy* /run/udev/rules.d/ +fi + + +if [ -f /etc/rc.local ]; then + if grep -q ventoy /etc/rc.local; then + sed -i '/ventoy/d' /etc/rc.local + fi +fi + + +if [ -f /etc/s6/rc.local ]; then + if grep -q ventoy /etc/s6/rc.local; then + sed -i '/ventoy/d' /etc/s6/rc.local + fi +fi + + +setsid sh -c ' + count=0 + while [ $count -lt 60 ]; do + if pidof udisksd >/dev/null 2>&1; then + udevadm trigger --action=change --subsystem-match=block --sysname-match=yyy + udevadm trigger --action=change --subsystem-match=block --sysname-match=DMXXX + sleep 1 + break + fi + count=$((count + 1)) + sleep 2 + done +' & + + +rm -f $0 + + diff --git a/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.dinit b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.dinit new file mode 100644 index 00000000..baee249c --- /dev/null +++ b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.dinit @@ -0,0 +1,4 @@ +type = scripted +command = /etc/ventoy-udev-cleanup.sh +after = local.target + diff --git a/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.openrc b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.openrc new file mode 100644 index 00000000..2240d1a9 --- /dev/null +++ b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.openrc @@ -0,0 +1,16 @@ +#!/usr/bin/openrc-run + +depend() { + after local +} + +start() { + ebegin "" + /bin/sh /etc/ventoy-udev-cleanup.sh + eend 0 +} + +stop() { + ebegin "" + eend 0 +} \ No newline at end of file diff --git a/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.runit b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.runit new file mode 100644 index 00000000..4b09a6f1 --- /dev/null +++ b/IMG/cpio/ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.runit @@ -0,0 +1,2 @@ +#!/bin/sh +exec /etc/ventoy-udev-cleanup.sh diff --git a/IMG/cpio/ventoy/hook/default/ventoy-udev-trigger.rc b/IMG/cpio/ventoy/hook/default/ventoy-udev-trigger.rc deleted file mode 100644 index c2485a7d..00000000 --- a/IMG/cpio/ventoy/hook/default/ventoy-udev-trigger.rc +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -for i in 0 1 2 3 4 5 6 7 8 9; do - [ -b /dev/DMXXX ] && break - sleep 1 -done - -udevadm trigger --subsystem-match=block --sysname-match=DMXXX -udevadm settle diff --git a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh index ee2e90f7..ccbced83 100644 --- a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh +++ b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh @@ -1026,7 +1026,7 @@ ventoy_new_root_dir() { done echo '' } - + ventoy_copy_udev_auto_rules() { if ! [ -e $VTOY_PATH/ventoy_raw_dm_done ]; then vtlog "ventoy_raw_dm_done not exist, no need for udev auto rule" @@ -1042,40 +1042,84 @@ ventoy_copy_udev_auto_rules() { vtlog "new root is $vroot" fi - - cp -a /ventoy/hook/default/90-ventoy-auto.rules /ventoy/udevtmp.rules + # Resolve device mapping info vtDM=$($VTOY_PATH/tool/dmsetup info VentoyPart | $GREP Major | $SED "s/.*[^0-9]\([0-9][0-9]*\)$/\1/") - $SED "s/DMXXX/dm-${vtDM}/g" -i /ventoy/udevtmp.rules - vtRAWDISKNAME=$($HEAD -n1 $VTOY_PATH/ventoy_raw_table | $AWK '{print $4}') - $SED "s/yyy/${vtRAWDISKNAME#/dev/}/g" -i /ventoy/udevtmp.rules - + vtRAWDISK_SYSNAME="${vtRAWDISKNAME#/dev/}" vtlog "VentoyPart is /dev/dm-${vtDM} map to $vtRAWDISKNAME NewRoot is $vroot" + + mkdir -p $vroot/etc/udev/rules.d - ventoy_copy_file /ventoy/udevtmp.rules $vroot/etc/udev/rules.d/90-ventoy-auto.rules 0644 + cp -a /ventoy/hook/default/90-ventoy-auto.rules /ventoy/udevtmp.rules + $SED "s/DMXXX/dm-${vtDM}/g" -i /ventoy/udevtmp.rules + $SED "s/yyy/${vtRAWDISK_SYSNAME}/g" -i /ventoy/udevtmp.rules + ventoy_copy_file /ventoy/udevtmp.rules $vroot/etc/udev/rules.d/9999-ventoy-auto.rules 0644 ventoy_copy_file /ventoy/udevtmp.rules $vroot/etc/udev/rules.d/11-ventoy-auto.rules 0644 + + if $GREP -q 'init=/lib/sysvinit' /proc/cmdline; then + SYSVINIT=1 + else + SYSVINIT=0 + fi - if $GREP -q 'init=.*sysvinit' /proc/cmdline; then - vtlog "copy sysvinit udev trigger script" - cp -a /ventoy/hook/default/ventoy-udev-trigger.rc /ventoy/udevtmp.rc - $SED "s/DMXXX/dm-${vtDM}/g" -i /ventoy/udevtmp.rc + if [ -d $vroot/etc/systemd/system -a "$SYSVINIT" = "0" ]; then + vtlog "systemd inject hook" + ventoy_copy_file /ventoy/hook/default/systemd/ventoy-udev-cleanup.sh $vroot/etc/ventoy-udev-cleanup.sh 0755 + else + vtlog "sysvinit inject hook" + ventoy_copy_file /ventoy/hook/default/sysvinit/ventoy-udev-cleanup.sh $vroot/etc/ventoy-udev-cleanup.sh 0755 + fi + + $SED "s/DMXXX/dm-${vtDM}/g" -i $vroot/etc/ventoy-udev-cleanup.sh + $SED "s/yyy/${vtRAWDISK_SYSNAME}/g" -i $vroot/etc/ventoy-udev-cleanup.sh - mkdir -p $vroot/etc/boot.d - ventoy_copy_file /ventoy/udevtmp.rc $vroot/etc/boot.d/S01-ventoy-udev-trigger 0755 + if [ "$SYSVINIT" = "1" ]; then + vtlog "copy sysvinit udev trigger script" + echo "/etc/ventoy-udev-cleanup.sh" >> $vroot/etc/rc.local elif [ -d $vroot/etc/systemd/system ]; then vtlog "copy systemd udev trigger service" - mkdir -p $vroot/etc/systemd/system/sysinit.target.wants - cp -a /ventoy/hook/default/ventoy-udev-trigger.service /ventoy/udevtmp.service - $SED "s/DMXXX/dm-${vtDM}/g" -i /ventoy/udevtmp.service - ventoy_copy_file /ventoy/udevtmp.service $vroot/etc/systemd/system/ventoy-udev-trigger.service 0644 + if [ -d $vroot/etc/systemd/system/sysinit.target.wants ]; then + vtlog "$vroot/etc/systemd/system/sysinit.target.wants exist ok" + else + mkdir -p $vroot/etc/systemd/system/sysinit.target.wants + fi - mkdir -p $vroot/etc/systemd/system-preset + cp -a /ventoy/hook/default/systemd/ventoy-udev-trigger.service /ventoy/udevtmp.service + $SED "s/DMXXX/dm-${vtDM}/g" -i /ventoy/udevtmp.service + $SED "s/yyy/${vtRAWDISK_SYSNAME}/g" -i /ventoy/udevtmp.service + + ventoy_copy_file /ventoy/udevtmp.service $vroot/etc/systemd/system/ventoy-udev-trigger.service 0644 + + if [ -d $vroot/etc/systemd/system-preset ]; then + vtlog "$vroot/etc/systemd/system-preset exist ok" + else + mkdir -p $vroot/etc/systemd/system-preset + fi echo 'enable ventoy-udev-trigger.service' > $vroot/etc/systemd/system-preset/80-ventoy-udev.preset $BUSYBOX_PATH/ln -sf /etc/systemd/system/ventoy-udev-trigger.service $vroot/etc/systemd/system/sysinit.target.wants/ventoy-udev-trigger.service + elif [ -d $vroot/etc/init.d ] && [ -d $vroot/etc/runlevels/default ]; then + vtlog "copy sysvinit openrc udev trigger script" + ventoy_copy_file /ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.openrc $vroot/etc/init.d/ventoy-udev-trigger-cleanup 0755 + $BUSYBOX_PATH/ln -sf /etc/init.d/ventoy-udev-trigger-cleanup $vroot/etc/runlevels/default/ventoy-udev-trigger-cleanup + elif [ -d $vroot/etc/dinit.d/boot.d ]; then + vtlog "copy sysvinit dinit udev trigger script" + ventoy_copy_file /ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.dinit $vroot/etc/dinit.d/ventoy-udev-trigger-cleanup 0644 + $BUSYBOX_PATH/ln -sf /etc/dinit.d/ventoy-udev-trigger-cleanup $vroot/etc/dinit.d/boot.d/ventoy-udev-trigger-cleanup + elif [ -d $vroot/etc/runit/sv ] && [ -d $vroot/etc/runit/runsvdir/default ]; then + vtlog "copy sysvinit runit udev trigger script" + mkdir -p $vroot/etc/runit/sv/ventoy-udev-trigger-cleanup + ventoy_copy_file /ventoy/hook/default/sysvinit/ventoy-udev-trigger-cleanup.runit $vroot/etc/runit/sv/ventoy-udev-trigger-cleanup/run 0755 + $BUSYBOX_PATH/ln -sf /etc/runit/sv/ventoy-udev-trigger-cleanup $vroot/etc/runit/runsvdir/default/ventoy-udev-trigger-cleanup + elif [ -d $vroot/etc/s6/sv ]; then + vtlog "copy sysvinit s6 udev trigger script" + echo "/etc/ventoy-udev-cleanup.sh" >> $vroot/etc/s6/rc.local + elif [ -f $vroot/etc/rc.local ]; then + vtlog "copy sysvinit udev trigger script" + echo "/etc/ventoy-udev-cleanup.sh" >> $vroot/etc/rc.local else - vtlog "sysinit wants dir not exist" + vtlog "unsupported init system" fi } diff --git a/IMG/cpio/ventoy/ventoy_chain.sh b/IMG/cpio/ventoy/ventoy_chain.sh index 3c3550c4..c977420e 100644 --- a/IMG/cpio/ventoy/ventoy_chain.sh +++ b/IMG/cpio/ventoy/ventoy_chain.sh @@ -409,6 +409,13 @@ ventoy_get_os_type() { if [ -f /scripts/casper ]; then echo "debian"; return fi + + + if [ -e /etc/os-release ]; then + if $GREP -qi 'ID=arch' /etc/os-release; then + echo 'arch'; return + fi + fi echo "default" } diff --git a/IMG/cpio/ventoy/ventoy_loop.sh b/IMG/cpio/ventoy/ventoy_loop.sh index 62527cbc..c3088f37 100644 --- a/IMG/cpio/ventoy/ventoy_loop.sh +++ b/IMG/cpio/ventoy/ventoy_loop.sh @@ -106,12 +106,34 @@ ventoy_get_os_type() { 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 @@ -125,18 +147,13 @@ 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 + if [ -d /usr/Euler/project/init ]; then + echo 'euleros'; return + else + echo 'rhel7'; return + fi # SUSE elif $GREP -q 'SUSE' /proc/version; then @@ -210,8 +227,12 @@ ventoy_get_os_type() { elif $GREP -q 'fuyu' /etc/os-release; then echo 'openEuler'; return elif $GREP -q 'deepin' /etc/os-release; then - echo 'debian'; return + echo 'deepin'; return elif $GREP -q 'chinauos' /etc/os-release; then + echo 'deepin'; return + elif $GREP -qi 'aerynos' /etc/os-release; then + echo 'rhel7'; return + elif $GREP -qi 'ID_LIKE=debian' /etc/os-release; then echo 'debian'; return fi fi @@ -270,6 +291,10 @@ ventoy_get_os_type() { echo 'android'; return fi + if $GREP -q 'android.google' /proc/version; then + echo 'android'; return + fi + if $GREP -q 'adelielinux' /proc/version; then echo 'adelie'; return fi @@ -382,6 +407,65 @@ ventoy_get_os_type() { 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 [ -f /etc/kylin-release ]; then + if $GREP -i -q -m1 'Kylin.*Server.* V1[1-9] ' /etc/kylin-release; 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 + + if [ -f /scripts/casper ]; then + echo "debian"; return + fi + + + if [ -e /etc/os-release ]; then + if $GREP -qi 'ID=arch' /etc/os-release; then + echo 'arch'; return + fi + fi + echo "default" } @@ -392,6 +476,23 @@ if [ -e "$VTOY_PATH/loop/$VTOS/ventoy-hook.sh" ]; then elif [ -e "$VTOY_PATH/hook/$VTOS/ventoy-hook.sh" ]; then $BUSYBOX_PATH/sh "$VTOY_PATH/hook/$VTOS/ventoy-hook.sh" fi +if [ -e "$VTOY_PATH/hook/$VTOS/ventoy-uauto-hook.sh" ]; then + $BUSYBOX_PATH/sh "$VTOY_PATH/hook/$VTOS/ventoy-uauto-hook.sh" +fi + + +#################################################################### +# # +# Step 4 : Run LiveInjection Hook # +# # +#################################################################### +if [ -f "/live_injection_7ed136ec_7a61_4b54_adc3_ae494d5106ea/hook.sh" ]; then + echo "==== Begin Call live injection hook.sh $VTOS" >> $VTLOG + $BUSYBOX_PATH/sh "/live_injection_7ed136ec_7a61_4b54_adc3_ae494d5106ea/hook.sh" $VTOS >>$VTLOG 2>&1 + echo "==== Finish Call live injection hook.sh $VTOS" >> $VTLOG +else + echo "No live injection" >> $VTLOG +fi ####################################################################