From 09bc763d142132d5044e3a5a177d6123dea2eac4 Mon Sep 17 00:00:00 2001 From: levasseur Date: Mon, 18 Oct 2021 18:50:40 +0200 Subject: [PATCH] dev.md: updated and improved documentation --- doc/dev.md | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/doc/dev.md b/doc/dev.md index 66f37e5..9fd8407 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -133,11 +133,24 @@ possible values: 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 \ [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 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. @@ -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 depending on your distribution. Nevertheless, even if it's system dependent, 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 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.1. exec_serv \ \ 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 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 \ 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: 1. Distribution ID, in lowcase, usually equivalent to the distribution name. 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 distribution do not provide that file it is required you generate it yourself