mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-11-02 19:31:59 +00:00
Make the ISO partition mountable for CloneZilla. (#3274)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Ventoy CloneZilla Device Cheat
|
||||
After=systemd-udevd.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=mv /dev/VTISOPART /dev/bk_VTISOPART
|
||||
ExecStart=cp -a /dev/DMXXX /dev/VTISOPART
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
||||
@@ -20,17 +20,29 @@ subiquity_curtin_workaround() {
|
||||
}
|
||||
|
||||
|
||||
if [ -d /root/etc/systemd/system -a -d /root/etc/udev/rules.d ]; then
|
||||
vtlog "systemd udev check OK"
|
||||
|
||||
vroot=$(ventoy_new_root_dir)
|
||||
if [ -z "$vroot" ]; then
|
||||
vtlog "new sysroot not found"
|
||||
else
|
||||
ventoy_copy_udev_auto_rules
|
||||
|
||||
if ls /root/etc/udev/rules.d | grep -q 'snap.*desktop'; then
|
||||
if ls $vroot/etc/udev/rules.d | grep -q 'snap.*desktop'; then
|
||||
subiquity_curtin_workaround
|
||||
else
|
||||
vtlog "no snap desktop detected"
|
||||
fi
|
||||
else
|
||||
vtlog "systemd or udev not exist"
|
||||
fi
|
||||
|
||||
if [ -d $vroot/usr/share/clonezilla ]; then
|
||||
vtlog "add cheat service for clonezilla"
|
||||
|
||||
vtDM=$($VTOY_PATH/tool/dmsetup info VentoyPart | grep Major | sed "s/.*[^0-9]\([0-9][0-9]*\)$/\1/")
|
||||
vtRAWDISKNAME=$(head -n1 $VTOY_PATH/ventoy_raw_table | awk '{print $4}')
|
||||
|
||||
cp -a /ventoy/hook/debian/ventoy-clonezilla-cheat.service /ventoy/udevtmp.service
|
||||
sed "s/DMXXX/dm-${vtDM}/g" -i /ventoy/udevtmp.service
|
||||
sed "s/VTISOPART/${vtRAWDISKNAME#/dev/}/g" -i /ventoy/udevtmp.service
|
||||
|
||||
ventoy_copy_file /ventoy/udevtmp.service $vroot/etc/systemd/system/ventoy-clonezilla-cheat.service 0644
|
||||
echo 'enable ventoy-clonezilla-cheat.service' > $vroot/etc/systemd/system-preset/90-ventoy-clonezilla.preset
|
||||
ln -sf /etc/systemd/system/ventoy-clonezilla-cheat.service $vroot/etc/systemd/system/sysinit.target.wants/ventoy-clonezilla-cheat.service
|
||||
fi
|
||||
|
||||
@@ -18,10 +18,18 @@ vtoy_udev_auto_hook() {
|
||||
fi
|
||||
|
||||
|
||||
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
|
||||
vtlog "mountroot distro"
|
||||
sed "/^mountroot$/a\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/ventoy-uauto-exec.sh" -i /init
|
||||
return
|
||||
if [ -e /init ]; then
|
||||
if $GREP -q '^mountroot$' /init; then
|
||||
vtlog "mountroot distro"
|
||||
sed "/^mountroot$/a\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/ventoy-uauto-exec.sh" -i /init
|
||||
return
|
||||
fi
|
||||
|
||||
if $GREP -q '^ *exec.*switch_root' /init; then
|
||||
vtlog "switch_root distro"
|
||||
sed "/^ *exec.*switch_root/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/ventoy-uauto-exec.sh" -i /init
|
||||
return
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user