Skip to content

Doc Plugins

heeplr edited this page May 12, 2021 · 3 revisions

Run ./bootstrap.sh -p for a list of plugins or visit the plugin overview list.

Plugins reside in RPI_PLUGINDIR (and optionally in RPI_USER_PLUGINDIR). They all provide a set of functions prefixed by rpi_ and their name (bold ones are mandatory):

function description
rpi_*_prerun() runs before anything is done (before download etc.) Will halt execution when failing.
rpi_*_run() execute main plugin task. Will also halt execution when failing.
rpi_*_postrun() runs after all plugins are done (cleaning up etc.)
rpi_*_description() print a general short description of the plugin
rpi_*_help_vars() will call "help_for_vars" function passing an array of "name|helptext|default_value" strings to describe each variable specific to this plugin.
rpi_*_help_distfiles() call "help_for_distfiles" passing an array of "name|helptext" strings to describe each file used by this plugin.

Plugins are run sequentially. Execution order matters, so plugins that provide a disk image always need to run first. If you want to run the "raspbian" plugin to download the image and the "wifi" plugin to configure wireless networking for example, you would set: RPI_BOOTSTRAP_PLUGINS=( "raspbian" "wifi" )

All plugins can read/write all variables and share one context. Thus plugins can use other plugins to maximize code reuse.

plugin config variables

All plugins should read/write variables starting with RPI_ followed by the capitalized plugin name. So a plugin named "foo" would use RPI_FOO_* and thus could use a variable like "RPI_FOO_SOME_VAR=123".

plugin dist files

A plugin can access files in the dist dir. Possible candidates are listed using the -p argument.

dist dir

The dist dir resembles a root directory tree for plugins to copy files to the image while preserving the path. Default ''RPI_DISTDIR'' is "./bootstrap_dist)

e.g. the file "./bootstrap_dist/etc/wpa_supplicant/wpa_supplicant.conf" would be detected by the wifi plugin and end up in "/etc/wpa_supplicant/" on the image.

For an overview of all plugins, run ./bootstrap.sh -p or visit the plugin overview list.

Clone this wiki locally