We are going to see how tu use git module to create your own modules.
Modules are a great way to works on your project on a Raspberry Pi.
You can save your project and make it available at the beginning of it and share all your scripts to automate tasks.
You can also use all availables modules on Piget , and works with anyone on it.
In this tutorial we are going to :
- Install git module
- Create an example module
- Save this module
Install git module
You can easily create and save module using git module.
To install git module type :
Git must know your username and email to identify you.
This information is not mandatory, but it is adviced to fill it.
To setup git type :
- Enter your username on github
- Enter your email on github
Create a module
We are going to create an example module.
- Create /do/example folder
- Create install script
- Make it executable (This also check compatibility)
A module always starts with a install script
The install script have all the commands needed to make the module works, When the module is installed, this command will be launch .
A good way to start a module is to copy all the commands from a tutorial inside this script, so you won’t need to go back back to it, and you can make and keep modifications.
Don’t forget to put a link to the tutorial, and his author name inside your script. This will help people to know where to find more information.
Since we have an install script, we can already upload it, so be can easily save it and get some help to make it.
Save your module
- Create a new repository
- Put inside Repository name, the name of your module
- Click on Create repository
In your terminal
- Inside the module folder /do/example
- Enter your email (github)
- Enter your password (github)
Your module is now available on github !
- No settings and password inside your module ! Use the folder /user/config/module_name instead !
- Only put scripts in the main folder, put code / settings / documentations in subfolders.
- Check out modules inside github.com/pigetnet (especially those who have a documentation)
- We see how to document your scripts in another tutorial.
- We see how to use system commands in another tutorial.