mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-11-30 17:36:19 +01:00
Add a cleanup service for Ventoy udev rules files
When we boot an ISO file to the live system through Ventoy. The ISO partition (e.g. /dev/sda1) is hold by the device-mapper which will block it to be mounted. So Ventoy will create a mirror device-mapper /dev/mapper/VentoyPart for /dev/sda1. Most live systems with GUI environment will auto mount Ventoy ISO partition by udisk. So in 1.1.18 Venoty will inject an udev rule in the Live system in order to: 1. Block the original ISO partition (e.g. /dev/sda1) to be auto-mounted. 2. Force /dev/mapper/VentoyPart to be auto-mounted. But the udev rule file was injected to /etc directory of the Live system, this will make the rule mistakenly inherited into the final installed system. Originally, the /run directory would have been the most suitable location, but in some Live systems /run is not a static directory but an overlayfs which is created dynamically during boot which make it a little bit complex. So we add a cleanup systemd/sysvinit service.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
+5
-1
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
type = scripted
|
||||
command = /etc/ventoy-udev-cleanup.sh
|
||||
after = local.target
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec /etc/ventoy-udev-cleanup.sh
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
ventoy_copy_file /ventoy/udevtmp.rules $vroot/etc/udev/rules.d/90-ventoy-auto.rules 0644
|
||||
mkdir -p $vroot/etc/udev/rules.d
|
||||
|
||||
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=.*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 $GREP -q 'init=/lib/sysvinit' /proc/cmdline; then
|
||||
SYSVINIT=1
|
||||
else
|
||||
SYSVINIT=0
|
||||
fi
|
||||
|
||||
mkdir -p $vroot/etc/boot.d
|
||||
ventoy_copy_file /ventoy/udevtmp.rc $vroot/etc/boot.d/S01-ventoy-udev-trigger 0755
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
mkdir -p $vroot/etc/systemd/system-preset
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -410,6 +410,13 @@ ventoy_get_os_type() {
|
||||
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"
|
||||
}
|
||||
|
||||
|
||||
+114
-13
@@ -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
|
||||
@@ -126,17 +148,12 @@ ventoy_get_os_type() {
|
||||
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
|
||||
|
||||
|
||||
####################################################################
|
||||
|
||||
Reference in New Issue
Block a user