This retarded editor will delete spaces at the end of Markdown lines EVEN WHEN ASKED TO NEVER DO IT ! Two spaces to create a line-break in Markdown is PART OF THE SYNTAX ! So, I'm now switching to Code for Markdown. Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
3.2 KiB
Version: 1 Status: DRAFT
Status
While this tutorial will explain you how to start coding your own module, it won't be prepared for packaging...
TODO : Add a 'build' script example that make the whole thing ready for packaging.
Main design
Coding your own CLI module
- Create a directory where you'll put the CLI module code and
cdinto it.
Example :
mkdir -p ~/Documents/my_armbian_module
cd ~/Documents/my_armbian_module
- Create a file named
DESCand write a short description for this module.
echo "Best module ever" > DESC
- Add a
modulefile and ensure it is executable.
This file will be the one executed by the configurator when running your module.
echo '#!/bin/bash' > module
echo "echo 'I told you, best module ever \!'" >> module
chmod +x module
- Create the directory
/usr/share/armbian/configurator/modules/${module_name}/cli
Example, if your module is named 'my_module' :
module_name=my_module
sudo mkdir -p "/usr/share/armbian/configurator/modules/${module_name}"
- Link the
DESCfile to/usr/share/armbian/configurator/modules/${module_name}/DESC
module_name=my_module
sudo ln -s "${PWD}/DESC" "/usr/share/armbian/configurator/modules/${module_name}/DESC"
- Link the directory itself to
/usr/share/armbian/configurator/modules/${module_name}/cli
module_name=my_module
sudo ln -s "${PWD}" "/usr/share/armbian/configurator/modules/${module_name}/cli"
Now, the module is recognized by the configurator.
Launch the configurator without arguments to see your module in the list.
Launch the configurator with the name of your module to launch it :
module_name=my_module
configurator ${module_name}
I told you, best module ever !
Adding a GUI (X11/Wayland) to your module
- Create a directory where you'll put the GUI executable of your module.
- Make sure your GUI executable name is named
module - Link it to
/usr/share/armbian/configurator/modules/${module_name}/gui
You're done
Adding a translation to the short description
To add a translation for a module description, add a DESC.{locale} file
to /usr/share/armbian/configurator/modules/${module_name}/
Precise locales are sampled before global ones, however avoid using precise locales names when you can.
Example
Let's say you want to add a French translation for a module description.
French locales start with fr.
French locale for people living in France specifically is : fr_FR.
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 :
DESC.fr_FRfor people using thefr_FRlocale.DESC.frfor people usingfr_CAlocale.
If you only add DESC.fr, the system will use :
DESC.frfor people using thefr_FRlocale.DESC.frfor people usingfr_CAlocale.
if you only add DESC.fr_FR, the system will use :
DESC.fr_FRfor people using thefr_FRlocale.DESC(default english version) for people using thefr_CAlocale.
Prepare for packaging
In order to prepare the module for packaging, see PACKAGING.md.