Closed probonopd closed 3 years ago
Ventoy will only inject files into the initramfs envrioment not the final envrioment. Because different distros have different ways to switch from the initramfs enviroment to the final envrioment.
If you want to do that, you should learn about the initramfs structure of the distro and inject some scripts and files into the initramfs envrioment and make your scripts called by the main script by some mechanism (e.g. hooks). Then in your script you can copy your files to the final envrioment.
Take RHEL/CentOS for example, they use dracut in initramfs. Dracut provide some hook scripts.
You can first inject a copy_my_file.sh
to /lib/dracut/hooks/pre-pivot/
and the script will be auto called before switch to the final enviroment. Then do what you want in the script.
If you want to do that, you should learn about the initramfs structure of the distro and inject some scripts and files into the initramfs envrioment and make your scripts called by the main script by some mechanism (e.g. hooks). Then in your script you can copy your files to the final envrioment.
Thanks for your suggestion.
Actually, this is similar to what I have been doing in my project, https://github.com/probonopd/SystemImageKit. But it is a lot of work to figure this out for every Linux and BSD distribution manually, so I was hoping that Ventoy could give us a unified way to do this for all OSes, since it is already hooking into the boot process.
Is there any part of Ventoy (e.g., script, binary) that runs as part of every boot process? Maybe we could add a hook to call a custom script in there.
Currently NO.
But ventoy's init script will always be run as the PID 1 by the kernel. Ventoy will do some hook and then handover to the original init script in the initramfs. So may be we can define a fixed path of inject script, for examle, /custom_injection/init.sh
. If you inject such script, Ventoy will call it before handover to the original init. Then in the script you can do some hook to make your another script called some time later.
I also have a vested interest in being able to inject files into the root filesystem as this will mean I won't have to build an ISO in order to run my custom scripts inside it. It should be possible to have a set of files in the exfat partition, boot into the initramfs and mount the exfat partition and rootfs inside it, and then copy the files from the exfat partition to the rootfs. It would be nice if Ventoy had a built-in mechanism to achieve this.
@probonopd @Tank-Missile Try the 1.0.53 release about How to inject files to Linux Live OS
@ventoy That's exciting to hear! Would it be possible to specify a file or folder to inject instead of an archive? The end goal for me is to simply plop a bunch of files into a folder on the exfat partition and then point to that folder in ventoy.json. I like to keep my scripts in a git repository, and so needing to tar them every time would be cumbersome.
Thank you very much @ventoy. Will try soon. Any chance this can also be done for FreeBSD/GhostBSD/helloSystem?
@ventoy That's exciting to hear! Would it be possible to specify a file or folder to inject instead of an archive? The end goal for me is to simply plop a bunch of files into a folder on the exfat partition and then point to that folder in ventoy.json. I like to keep my scripts in a git repository, and so needing to tar them every time would be cumbersome.
No. You must tar the folder.
Thank you very much @ventoy. Will try soon. Any chance this can also be done for FreeBSD/GhostBSD/helloSystem?
NO. BSD is not supported.
With the Ventoy Injection Plugin, you can inject some files (e.g. drivers/scripts ...) into the runtime envrioment after boot. For Linux, that's the initramfs envrioment.
While this is very useful, I also need a way to inject some files into the main filesystem (the one one uses after then machine has fully booted), e.g., to add a file to
/etc
. What would be ideal is if one could specify one or more additional squashfs files that would be overlayed to/
.It would be ideal if one could specify overlays for all or for just some of the ISOs.
Is this possible?