* feat: add support for nested modules
* chore: test out module nesting
* fix: made build function
* revert: move back to old recipe.yml configuration
* fix: formatting in recipe.yml
* style: add newline between modules
this change makes sense for when in the future it's possible to
build other OS's with this same system
it was done now, because i'm bundling a bunch of breaking changes
into a single update
Every individual RUN, COPY and ADD action creates an extra container layer, so there was plenty of room for improvement in our Containerfile.
This optimization gets rid of 4 useless layers from our final container image, and shrinks the final OCI download size as follows:
- Removing the "mkdir /tmp/scripts" layer. It's not necessary to manually create the target directory for the container copy action.
- Removing the manual "chmod +x" for the scripts, and putting that step inside "build.sh" instead.
- Removing the manual copying of "build.sh", by instead placing it at "scripts/build.sh" so that it's automatically copied together with all the other scripts in one layer instead.
- Removing the separate "chmod +x build.sh && run build script" step by merging it with the "cleanup temp files and then finalize the container" step, so that we don't create a pointless extra filesystem layer just for the build.sh script execution.
These changes also reduce the size of the final image, because we're cleaning up the image in the exact same step that we run the "build.sh". If we didn't combine these steps, we'd still be keeping a useless extra layer with all the /tmp/ and /var/ junk files that were left over after the build.
Most seriously, the "/var/cache" folder contained copies of ALL RPM FILES that build.sh installed via "rpm-ostree install". This meant that we were generating a very big layer with a lot of junk data that shipped in the final image.
Our build now only generates 7 layers (instead of 11), and users will have a much smaller OCI download since we aren't shipping the cached RPM "build leftovers" or temp files via useless extra layers anymore.
This implements the new "yafti" launcher and ties everything together:
- The "/etc/profile.d" script is now a symlink to an immutable location, instead of an actual plaintext file, to prevent risk of user systems breaking due to ostree thinking that the script had been modified. We can now be certain that systems always work properly when switching between distros or uBlue flavors.
- Yafti is only installed if the "yafti" flag is enabled.
- If the user disables the "yafti" flag, we completely wipe out the entire yafti.yml configuration, all of our new "yafti autostart" components, and the "profile.d" symlink, so that nothing remains on the system image. If an upstream image installed yafti itself in `/usr/bin`, then we leave that component alone though (because "pip uninstall" and the potential errors it might throw seems like a pointless hassle just for a tiny, unused binary).
This new functionality now makes it possible to execute scripts at the start or end of the build process, while also being super simple to expand to add further script stages in the future.
It also supports effortless reuse of scripts for multiple stages, since the scripts are now executed with the "current stage" as their 1st argument, to allow them to easily determine which stage they're running in.
This fixes the issue where someone specifies `fedora-version: latest`, which won't be known until build-time.
I also added a small "welcome" banner to the build log. It's really just there to retain a somewhat contrived use-case example for how to use `get_yaml_string()`, for other programmers who want to extend this in the future.
You can now define your custom repos with the `%FEDORA_VERSION%` variable, to automatically use the correct repo version, so that you never have to maintain their custom URLs again in the future.
You can now easily remove RPMs from your custom image, without having to edit the build.sh script.
This also changes the old "rpms" config key, to "rpm-install", for consistency with the new setting.
Thanks to leveraging Bash arrays, we are now able to use parameter expansion to perform every package installation as one rpm-ostree operation instead of individual ones. This will give us a huge build speedup.
Bash properly expands every array element as safely quoted arguments, complete with support for spaces and special characters.
This new technique is way easier to use, more maintainable, and safely handles special characters and spaces in the YAML data. It will also enable other features, such as the rpm-ostree improvement coming in the next commit.
The function name is `get_yaml_array()` because it literally reads it into a Bash array, by the way. Don't change the function name in the future. We may need other functions to read values into strings, etc.
Lowercase, run-on sentences are a nightmare to expand later, because the lack of sentence structure means you can't just add more lines and have a nice flow anymore.
Let's add some punctuation and grammar.
* fix: prevent /etc/ merge issues
discussed at length in #28
also including tons of comments about the issue
* fix: change references of /etc/ to /usr/etc