diff options
author | Simon Rettberg | 2021-11-09 09:49:17 +0100 |
---|---|---|
committer | Simon Rettberg | 2021-11-09 09:49:17 +0100 |
commit | 075c0e173fbf9c8713dc125952b402d6789b7110 (patch) | |
tree | 5128ec025d1aa3210c4c34e11d6dc63750e81b70 /core/bin | |
parent | [swtpm] Prefix all installation paths (diff) | |
download | mltk-075c0e173fbf9c8713dc125952b402d6789b7110.tar.gz mltk-075c0e173fbf9c8713dc125952b402d6789b7110.tar.xz mltk-075c0e173fbf9c8713dc125952b402d6789b7110.zip |
setup_target: Honor dependency ordering when running module_init
Diffstat (limited to 'core/bin')
-rwxr-xr-x | core/bin/setup_target | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/core/bin/setup_target b/core/bin/setup_target index 4ea9b824..cee93e93 100755 --- a/core/bin/setup_target +++ b/core/bin/setup_target @@ -426,10 +426,11 @@ generate_target_real() { done # Run load hook + # This will run before installing any packages, which might be required in + # some cases + declare -A mod_init_done=() for item in $MODULES; do - . "${CORE_DIR}/includes/clean_module_funcs.inc" # Clean all hooks, in case the module doesn't define them all - . "${MODULE_PATHS["$item"]}/module.build" - module_init + process_module_init "$item" done install_all_packages @@ -449,6 +450,22 @@ generate_target_real() { TOOL_STR="" } +process_module_init() { + local item="$1" + local dep + mod_init_done["$item"]=1 + unset_required_vars + . "${MODULE_PATHS["$item"]}/module.conf" + for dep in $REQUIRED_MODULES; do + [ -n "${MODULE_PATHS["$dep"]}" ] || perror "Module $dep, dependency of $item, not found in target" + [ -z "${mod_init_done["$dep"]}" ] && process_module_init "$dep" + done + . "${CORE_DIR}/includes/clean_module_funcs.inc" # Clean all hooks, in case the module doesn't define them all + . "${MODULE_PATHS["$item"]}/module.build" + # TODO? We only source the general .conf, not the .conf.distro one... needed for module_init? + module_init +} + process_module() { # Parse arguments [ "$#" -lt "1" ] && perror "process_module: want >= 1 param." |