Use $() style command substitutions. Do not require the Bash shell. Use && || list control over -a -o test operators. Remove unused exists() function. Collect kernel command line once into a variable, and perform more robust parsing. Take advantage of losetup -f --show for assignment of variables for loop devices. Use ${mountopts:+$mountopts} expansion to nothing if mountopts is unset or empty in livesys-main. Use ${USERADDARGS:+$USERADDARGS} expansion to nothing if USERADDARGS is unset in livesys-main. Drop the unneeded -n (not zero-length) operator in test expressions, and use ! instead of -z (zero-length). This results in quicker-to-understand code as it more closely represents the variable object instead of the testing methodology and its double negatives. Clearly demark the run-on-first-boot-only code from the rest in livesys-main. Move, and comment to keep, the /.liveimg-configured flag file at the end of the livesys-main script, so that it is not set prematurely in a faulty script invocation. Replace touch with : > file syntax. Include a switch for rd.live.debug in livesys-main & livesys-late. Provide a filesystem check/repair function in functions and use it on a persistent home.img or home device filesystem. Also In functions: Update the strstr function to a simpler version from dracut. Drop the dependency on grep by using shell substring removal. Drop the Bash syntax $"..." for string translation for portability & security reasons. See https://www.gnu.org/software/gettext/manual/html_node/bash.html
This code has been tested with home.img in * Fedora Workstation 38 * Fedora SoaS spin 38
home.img
rebased onto b2f16e9a7073c6ef42fcbb22b00077896bce60c8
I don't have a problem with using Bash as the interpreter and I would rather keep the quality of life improvements that Bash enhancements offer. Is there a particularly compelling reason to downgrade from Bash to plain POSIX shell?
We don't really use any Bash features, and some live systems are intended for minimal and embedded systems that would prefer the size reduction and greater speed of Dash, for example.
A system with Bash is, of course, acceptable also.
Is there even a way to not have Bash on a system?
Yes, for special purpose and hobby systems, where LiveOS is quite good.
rebased onto 2b345529daa1ae5c69d603cc2669297731a91fb9
Well, this needs rebasing in order to merge...
I'm not sure how you can have a Fedora system without Bash, though if it's not too ugly, I'm willing to try POSIX shell compatibility...
rebased onto 3e74c9603ccabda082202c49db46e2348ff9f876
Here is a rebased and more complete version. Tested with Fedora-Workstation-Live-x86_64-38-20230224.n.0.iso
Isn't touch a program? what's up with changing this?
touch
Yes, touch is a 99344-byte program that is not needed in this very simple service.
We are also always going to have it, since it's part of the GNU Core Utilities. We're not wasting any space here.
Yes, storage won't change. RAM and the cycles to process it are what would be saved, which usually lead to time and energy savings as well.
I guess...
Pull-Request has been merged by ngompa
This code has been tested with
home.imgin* Fedora Workstation 38
* Fedora SoaS spin 38