2022-05-21 19:07:16 +02:00
|
|
|
Version: 1
|
|
|
|
|
Status: DRAFT
|
|
|
|
|
|
2022-08-07 16:35:30 +02:00
|
|
|
# Status
|
2022-08-06 23:11:55 +02:00
|
|
|
|
2022-08-07 16:35:30 +02:00
|
|
|
While this tutorial will explain you how to start coding your own
|
|
|
|
|
module, it won't be prepared for packaging...
|
2022-08-06 23:11:55 +02:00
|
|
|
|
2022-08-07 16:35:30 +02:00
|
|
|
TODO : Add a 'build' script example that make the whole thing ready
|
|
|
|
|
for packaging.
|
2022-05-21 19:07:16 +02:00
|
|
|
|
2022-08-07 16:35:30 +02:00
|
|
|
# Main design
|
2022-08-06 23:11:55 +02:00
|
|
|
|
2022-08-07 16:35:30 +02:00
|
|
|
## Coding your own CLI module
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
1. Create a directory where you'll put the CLI module code and `cd` into it.
|
|
|
|
|
Example :
|
2022-08-07 16:35:30 +02:00
|
|
|
```bash
|
|
|
|
|
mkdir -p ~/Documents/my_armbian_module
|
|
|
|
|
cd ~/Documents/my_armbian_module
|
|
|
|
|
```
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
2. Create a file named `DESC` and write a short description for this module.
|
2022-08-07 16:35:30 +02:00
|
|
|
```bash
|
|
|
|
|
echo "Best module ever" > DESC
|
|
|
|
|
```
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
3. Add a `module` file and ensure it is executable.
|
|
|
|
|
This file will be the one executed by the configurator when running
|
|
|
|
|
your module.
|
2022-08-07 16:35:30 +02:00
|
|
|
```bash
|
|
|
|
|
echo '#!/bin/bash' > module
|
|
|
|
|
echo "echo 'I told you, best module ever \!'" >> module
|
|
|
|
|
chmod +x module
|
|
|
|
|
```
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
4. Create the directory `/usr/share/armbian/configurator/modules/${module_name}/cli`
|
|
|
|
|
Example, if your module is named 'my_module' :
|
2022-08-07 16:35:30 +02:00
|
|
|
```bash
|
|
|
|
|
module_name=my_module
|
|
|
|
|
sudo mkdir -p "/usr/share/armbian/configurator/modules/${module_name}"
|
|
|
|
|
```
|
2022-08-07 16:44:24 +02:00
|
|
|
5. Link the `DESC` file to `/usr/share/armbian/configurator/modules/${module_name}/DESC`
|
2022-08-07 16:35:30 +02:00
|
|
|
```bash
|
|
|
|
|
module_name=my_module
|
|
|
|
|
sudo ln -s "${PWD}/DESC" "/usr/share/armbian/configurator/modules/${module_name}/DESC"
|
|
|
|
|
```
|
2022-08-07 16:44:24 +02:00
|
|
|
6. Link the directory itself to `/usr/share/armbian/configurator/modules/${module_name}/cli`
|
2022-08-07 16:35:30 +02:00
|
|
|
```bash
|
|
|
|
|
module_name=my_module
|
|
|
|
|
sudo ln -s "${PWD}" "/usr/share/armbian/configurator/modules/${module_name}/cli"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Now, the module is recognized by the configurator.
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
Launch the configurator without arguments to see your module in the list.
|
2022-08-07 16:35:30 +02:00
|
|
|
Launch the configurator with the name of your module to launch it :
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
module_name=my_module
|
|
|
|
|
configurator ${module_name}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
I told you, best module ever !
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Adding a GUI (X11/Wayland) to your module
|
|
|
|
|
|
|
|
|
|
1. Create a directory where you'll put the GUI executable of your module.
|
|
|
|
|
2. Make sure your GUI executable name is named `module`
|
|
|
|
|
3. Link it to `/usr/share/armbian/configurator/modules/${module_name}/gui`
|
|
|
|
|
|
|
|
|
|
You're done
|
2022-08-06 23:11:55 +02:00
|
|
|
|
|
|
|
|
## Adding a translation to the short description
|
2022-05-21 19:07:16 +02:00
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
To add a translation for a module description, add a `DESC.{locale}` file
|
|
|
|
|
to `/usr/share/armbian/configurator/modules/${module_name}/`
|
2022-05-21 19:07:16 +02:00
|
|
|
|
|
|
|
|
Precise locales are sampled before global ones, however
|
|
|
|
|
avoid using precise locales names when you can.
|
|
|
|
|
|
|
|
|
|
### Example
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
Let's say you want to add a French translation for a module description.
|
2022-05-21 19:07:16 +02:00
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
French locales start with `fr`.
|
|
|
|
|
French locale for people living in France specifically is : `fr_FR`.
|
2022-05-21 19:07:16 +02:00
|
|
|
French locale for people living in Canada specifically is : `fr_CA`.
|
|
|
|
|
|
|
|
|
|
So, if you want to add a french translation, add either a
|
|
|
|
|
`DESC.fr` or `DESC.fr_FR` file.
|
|
|
|
|
|
|
|
|
|
If you add both `DESC.fr_FR` and `DESC.fr`, the system will use :
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
* `DESC.fr_FR` for people using the `fr_FR` locale.
|
2022-05-21 19:07:16 +02:00
|
|
|
* `DESC.fr` for people using `fr_CA` locale.
|
|
|
|
|
|
|
|
|
|
If you only add `DESC.fr`, the system will use :
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
* `DESC.fr` for people using the `fr_FR` locale.
|
2022-05-21 19:07:16 +02:00
|
|
|
* `DESC.fr` for people using `fr_CA` locale.
|
|
|
|
|
|
|
|
|
|
if you only add `DESC.fr_FR`, the system will use :
|
|
|
|
|
|
2022-08-07 16:44:24 +02:00
|
|
|
* `DESC.fr_FR` for people using the `fr_FR` locale.
|
2022-05-21 19:07:16 +02:00
|
|
|
* `DESC` (default english version) for people using the `fr_CA` locale.
|
|
|
|
|
|
2022-08-06 23:11:55 +02:00
|
|
|
## Prepare for packaging
|
|
|
|
|
|
|
|
|
|
In order to prepare the module for packaging, see **PACKAGING.md**.
|