dev.md: updated and improved documentation

This commit is contained in:
levasseur
2021-10-18 18:50:40 +02:00
parent 71f7ec5936
commit 09bc763d14

View File

@@ -133,11 +133,24 @@ possible values:
The second parameter is the message to display. The second parameter is the message to display.
As this function is widely used almost everywhere in the code at runtime,
consider it as being a base dependency of all libraries and modules.
Consequently that function can only contain code that cannot trigger errors or
fail as it's also used to display errors. Thus it only contains echoes and some
variables manipulation.
#### 3.1.2. dsleep \<miliseconds\> [char] #### 3.1.2. dsleep \<miliseconds\> [char]
That function is an equivalent to *sleep* bash command but will display a
countdown every second until it reaches zero. Optionnally a character (or a
string) can be given as a second parameter to replace the countdown by that
character. For exemple, you can use a dot to display a dot every second until
the wait is over.
The function returns nothing useful.
#### 3.1.3. dump_key_buffer #### 3.1.3. dump_key_buffer
That function dumps keyboard's buffer. It's used to clear eventual key press That function dumps keyboard's buffer. It's used to clear eventual key press
before a ny critical keyboard action. before any critical keyboard action.
That function takes no parameter and returns no useful value. That function takes no parameter and returns no useful value.
@@ -286,10 +299,19 @@ That script relies on the *INIT_COM* variable, defining the program to use to
manipulate services. It is defined in configuration file automatically called manipulate services. It is defined in configuration file automatically called
depending on your distribution. Nevertheless, even if it's system dependent, depending on your distribution. Nevertheless, even if it's system dependent,
some distributions offers you to choose between different services call (and some distributions offers you to choose between different services call (and
init system). Tested init systems are SystemV init, SystemD and UpStart. Thus, init system). If you're not using the standard init system of your distribution,
you'll need to overload the *INIT_COM* variable in your configuration files.
It have been tested with SystemV, SystemD and UpStart init systems. Thus,
the originally UpStart "service" program tend to be available on many systems the originally UpStart "service" program tend to be available on many systems
and is privileged. and is privileged.
With the tested init systems, and considering %srv% the service name and %com%
the command to execute, the *INIT_COM* variable can be:
* **"$RC_SCRIPTS_PATH/%srv% %com%"** with *$RC_SCRIPTS_PATH* being "/etc/init.d" on Debian like systems when using SystemV init
* **"systemctl %com% %srv%"** for systems using SystemD
* **"service %srv% %com%"** for upstart like scripts (but widely available)
### 6.2. Functions ### 6.2. Functions
#### 6.2.1. exec_serv \<service\> \<command\> #### 6.2.1. exec_serv \<service\> \<command\>
That function execute the given action to the given service. The service have That function execute the given action to the given service. The service have
@@ -339,7 +361,8 @@ available modules to display a table with their respecting versions.
If user is not root an additionnal warning will be displayed to warn the fact If user is not root an additionnal warning will be displayed to warn the fact
the script requires root privileges to work properly. the script requires root privileges to work properly.
As it's using colors to display results, it depends on color code declaration. As it's using colors to display results, it depends on color code declaration in
the *display.sh* file.
#### 7.1.3. get_mod_name \<module_file\> #### 7.1.3. get_mod_name \<module_file\>
That function return the name of the module file given in parameter. It takes That function return the name of the module file given in parameter. It takes
@@ -361,7 +384,7 @@ standard POSIX variables. No usefull result will be returned.
That function takes no parameters and will return three values in order: That function takes no parameters and will return three values in order:
1. Distribution ID, in lowcase, usually equivalent to the distribution name. 1. Distribution ID, in lowcase, usually equivalent to the distribution name.
2. Distribution version, if available, elsewhere kernel version with it's major. 2. Distribution version, if available, elsewhere kernel version with it's major.
3. Distribution codename (eg. buster for Debian 10) in lowercase if available. 3. Distribution codename (eg. buster for Debian 10) in lowercase if available. If not, the generic "null" value is returned instead.
The function mainly relies on the "*/etc/os-release*" new standard file. If your The function mainly relies on the "*/etc/os-release*" new standard file. If your
distribution do not provide that file it is required you generate it yourself distribution do not provide that file it is required you generate it yourself