Optimize udev process

This commit is contained in:
longpanda
2026-10-05 23:28:56 +08:00
parent a2f6e4e31f
commit 2c4e686293
3 changed files with 1 additions and 97 deletions
@@ -1,52 +0,0 @@
#!/ventoy/busybox/sh
. /ventoy/hook/ventoy-hook-lib.sh
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
PATH=$VTPATH_OLD
exit 0
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
mkdir -p /ventoy/mnt/iso /ventoy/mnt/sfs
vtDM=$(dmsetup info ventoy | grep minor | sed 's/.*\([0-9][0-9]*\)/\1/')
vtlog "mount -o ro -t iso9660 /dev/dm-${vtDM} /ventoy/mnt/iso"
mount -o ro -t iso9660 /dev/dm-${vtDM} /ventoy/mnt/iso
mount /ventoy/mnt/iso/casper/minimal.standard.live.squashfs /ventoy/mnt/sfs
mount --bind /ventoy/mnt/sfs/usr/lib/modules /lib/modules
ventoy_load_iso_part_fs_ko
umount /lib/modules
umount /ventoy/mnt/sfs
umount /ventoy/mnt/iso
ventoy_remove_all_dm
if ventoy_mount_iso "${vtdiskname}"; then
vtlog "direcly mount iso partition SUCCESS"
else
vtlog "direcly mount iso partition FAILED, keep use DM"
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
fi
if [ -f /ventoy/autoinstall ]; then
sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall
fi
set_ventoy_hook_finish
@@ -1,35 +0,0 @@
#!/ventoy/busybox/sh
echo "Here before mountroot ..." >> $VTLOG
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/ubuntu-disk.sh" -i /init
$SED "/^mountroot$/i\\maybe_break bottom" -i /init
#workaround for issue #3718
if [ -f $VTOY_PATH/ventoy_persistent_map -a -f /scripts/casper-helpers ]; then
echo 'fix casper cow udev issue' >> $VTLOG
if $GREP -q '^find_cow_device\(\).*{' /scripts/casper-helpers; then
VTINS_LINE=$($GREP -n '^find_cow_device\(\).*{' /scripts/casper-helpers | $AWK -F':' '{print $1}')
$AWK "NR < $VTINS_LINE" /scripts/casper-helpers > /ventoy/casper-helpers-tmp
$CAT $VTOY_PATH/hook/debian/casper-perst-wa.sh >> /ventoy/casper-helpers-tmp
$AWK "NR > $VTINS_LINE" /scripts/casper-helpers >> /ventoy/casper-helpers-tmp
$CAT /ventoy/casper-helpers-tmp > /scripts/casper-helpers
fi
fi
if [ -f $VTOY_PATH/autoinstall ]; then
echo "Do auto install ..." >> $VTLOG
if $GREP -q '^autoinstall:' $VTOY_PATH/autoinstall; then
echo "cloud-init auto install ..." >> $VTLOG
if $GREP -q "maybe_break init" /init; then
$SED "/maybe_break init/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/ventoy-cloud-init.sh \$rootmnt" -i /init
fi
else
if $GREP -q "^mount /proc$" /init; then
$SED "/^mount \/proc/a export file=$VTOY_PATH/autoinstall; export auto='true'; export priority='critical'" -i /init
fi
fi
fi
+1 -10
View File
@@ -60,16 +60,7 @@ ventoy_get_debian_distro() {
fi fi
if $GREP -q 'NAME="Kylin"' /etc/os-release; then if $GREP -q 'NAME="Kylin"' /etc/os-release; then
echo 'kylin'; return echo 'kylin'; return
fi fi
if $GREP -q 'ID=ubuntu' /etc/os-release; then
if $GREP -q 'VERSION_ID=\"2[4-9]\.' /etc/os-release; then
echo 'ubuntu'; return
fi
if $GREP -q 'VERSION_ID=\"3[0-9]\.' /etc/os-release; then
echo 'ubuntu'; return
fi
fi
fi fi
if $GREP -q 'slax/' /proc/cmdline; then if $GREP -q 'slax/' /proc/cmdline; then