Skip to content

How to add a new module

Raffaello Bonghi edited this page Apr 3, 2018 · 3 revisions

If you want write a new module you can only add a new folder in modules following this rule:

  1. same name folder same script name inside

example: foo/foo.sh

The required variables inside the module are:

  • MODULE_NAME - The short name of the module, it will be shown in the configuration menu.
  • MODULE_DESCRIPTION - A long description about the functionality of the module
  • MODULE_DEFAULT - Status of the module
    • -1 = Module unloaded
    • 0 = Module loaded, but not required by default
    • 1 = Module loaded and used by default

The optional functions are:

  • script_run
  • script_save
  • script_info
  • script_load_default

The code in foo/foo.sh will be with look:

#!/bin/bash
MODULE_NAME="Foo module"
MODULE_DESCRIPTION="Lorem ipsum dolor sit amet, consectetur adipiscing elit. 

Nulla leo dui, egestas finibus purus sit amet, ullamcorper eleifend massa. 
Sed semper, ligula in condimentum condimentum, nunc nisl dapibus massa, a malesuada augue tellus id neque. 
In blandit interdum arcu, eget mattis tellus rhoncus et. 
In faucibus, leo eget pellentesque placerat, tortor nisl viverra nisi, ut semper nisl justo at risus."
MODULE_DEFAULT=0

script_run()
{
    echo "Script run..."
}

script_save()
{
    echo "FOO=1" >> $1
    echo "Saving variables..."
}

script_info()
{
    echo "Foo is: $FOO"
}

script_load_default()
{
    FOO=1
}

Special options

If inside your module you set

MODULES_REQUIRE_REBOOT=1
```
after install the `biddibi_boddibi_boo.sh` script will be reboot the board