osi-tools/Documentation/module-interface.md

1.3 KiB

Module interface:

May call the functions:

  • load_module ${mod_filename} to depend on another module

May adjust the variables:

  • packages (array of depspecs) packages to download and install

  • cache_packages (array of depspecs) packages to download but not install

  • pre_install (array of uint:funcname pairs) functions to call after ${packages[@]} and ${cache_packages[@]} are downloaded, but before ${packages[@]} are installed. The listed functions are called in numeric order of the provided number. Each function is called with the image mountpoint as an argument.

    You are encouraged to prefix your function names with modulename: to avoid naming conflicts. Typical use looks like:

    pre_install+=(99:mymodule:last_thing)
    mymodule:last_thing() {
        local arg_mountpoint=$2
        # function body here
    }
    
  • post_install (array of uint:funcname pairs) like pre_install, functions to call but called after ${packages[@]} are installed.

All built-in hooks are in the ranges:

  • 10-19
  • 45-54
  • 80-89

Which means that if you rely on running before or after them, your safe ranges are:

  • 00-09 # 10
  • 20-44 # 25
  • 55-79 # 25
  • 90-99 # 10