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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user