mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-11-30 17:36:19 +01:00
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.
20 lines
501 B
Bash
20 lines
501 B
Bash
#!/ventoy/busybox/sh
|
|
|
|
. /ventoy/hook/ventoy-hook-lib.sh
|
|
|
|
PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
|
|
|
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/arch/ventoy-uauto-exec.sh" -i /init
|
|
elif [ -d $VT_DRACUT_HOOKS/pre-pivot ]; then
|
|
vtlog "dracut distro"
|
|
ventoy_dracut_pivot_udev_rule
|
|
fi
|
|
}
|
|
|
|
vtoy_udev_auto_hook
|