Reusing shell scripts is hard as packaging is often complicated by itself and therefore they live scattered all over our disks and when we need a specific one the search begins.
What happens when the repository is offline? Scripts won’t work. There are exceptions e.g., if the cache holds all required scripts, but in many cases the script just will not run.
Next we are taking a look at how to create a module Creating a module is easy. In general, modules are just plain shell scripts.
Requirements There are just two things to be aware of:
After downloading Module.sh it should be straight forward to use it.
At first it must be loaded, either by sourcing it:
. "$(dirname "$(readlink -f "$0")")/module.sh" Or by using the eval+curl chain:
The compiler can be use to turn scripts which use Module.sh into static scripts which contain all their dependecies and do not require Module.sh anymore. This is a great way to ensure a script will work even if the repository will be unavailable.
Module.sh has a view different use-cases. The simplest is just about using it ‘somehow’. Therefore, we documented the basic usage first. For some use cases is the usage of the compiler critical.