Closed comio closed 7 years ago
Hi Luigi, thanks for the appreciation. :)
Currently the script should be distro-agnostic, you should be able to take the script itself (/debian_package/sbin/folder2ram), place it in /sbin, chmod +x it and from there it is able to generate its default configs, its initscripts and its own systemd service files.
The debian package is just a wrapper to install/remove that easily on Debian/OpenMediaVault with the right dependencies and do some cleaning if needed.
Still, I never tested it outside of Debian and derivatives or OpenSUSE, so I might be doing something that Gentoo does not like. If you explain what you need I can modify it.
I will probably need to add some checks on start to make sure all tools it needs are installed (like say rsync), for true standalone usage.
I'm reading the code.
Why the systemd services code is inside the script? I suggest you to spun off systemd service code out from the script (avoiding to generate). And add only enable/start/disable/stop shortcuts for systemd inside the script. This will made the code more readable and portable.
Does f2r support a timer in order to store the snapshot every X seconds? a service like folder2ram@ENTRY.timer should be fine. Also a folder2ram@ENTRY.service can be useful in order to mount or umount a ENTRY.
Of coruse, these are my 2EuroCents. (And your software just works fine(TM))
ciao
luigi
Why the systemd services code is inside the script?
To make it self-contained, and to allow the user to regenerate everything without having to rely on a distro's packaging system.
This will made the code more readable and portable.
For the readable part heh, I compensate with Kwrite/Kate or also Emacs that can shrink functions, loops and so on.
For the portable, I thought embedding the service files (and initscripts) in the script would have made it more portable because of above reason (no real need to package it for distros to have it fully functional, and no need to ask people to copy files from a tar.gz manually around)
Does f2r support a timer in order to store the snapshot every X seconds?
No, for that you must set yourself a chron job or similar that calls a folder2ram -syncall which does the sync of all tmpfs to disk with rsync.
a service like folder2ram@ENTRY.timer should be fine. Also a folder2ram@ENTRY.service can be useful in order to mount or umount a ENTRY.
Yes I know. :-) Consider that the main goal of this script was to let me/others use OpenMediaVault safely from a USB flash drive or from a SD card, mostly for embedded devices (like the raspi/bananapi they support unofficially or my zyxel nas supported by Debian). Until then, the only thing that did a similar effect was fs2ram, which is a horrible, unsafe hack (if you uninstall it you lose all files in the tmpfs for example).
And for that it's already sufficient.
Therefore adding features is very low priority for now, but I accept pull requests if you want to add such functionality.
Any other questions regarding this? If not please close this issue.
Ok. Thanks.
I produced an ebuild for my gentoo distro.
See comio/comio-overlay.
Hi Alberto,
your folder2ram is really interesting. I already used in the past under a openmediavault installation (that is at almost a customized debian). Your package is debian friendly and I'm suggesting you to make it agnostic w.r.t. the distro. For example I think that systemd script should be pushed in external directories because we needn't to generate the service script, while we need only to enable it.
My gentoo will like this effort.
Best regards,
luigi