From 5fd16fbd695efad053ddb27e0a23316d546b51c8 Mon Sep 17 00:00:00 2001 From: levasseur Date: Fri, 15 Oct 2021 18:38:52 +0200 Subject: [PATCH] dev.md: updated documentation --- doc/dev.md | 52 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/doc/dev.md b/doc/dev.md index 5eb43f4..66f37e5 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -11,14 +11,17 @@ - [2.2. Other functionalities](#22-other-functionalities) - [3. The display.sh file](#3-the-displaysh-file) - [3.1. Functions](#31-functions) - - [3.1.1. prnt [I|W|E|m] \](#311-prnt-iwem-message) - - [3.1.2. dump_key_buffer](#312-dump_key_buffer) + - [3.1.1. prnt [-n] [I|W|E|m] \](#311-prnt--n-iwem-message) + - [3.1.2. dsleep \ [char]](#312-dsleep-miliseconds-char) + - [3.1.3. dump_key_buffer](#313-dump_key_buffer) - [3.2. Other functionalities](#32-other-functionalities) - [4. The filefct.sh file](#4-the-filefctsh-file) - [4.1. Functions](#41-functions) - [4.1.1. stdtime](#411-stdtime) - [4.1.2. backupdist \](#412-backupdist-list_of_files_or_dirs) - [4.1.3. installfile \ \](#413-installfile-sources-destination) + - [4.1.4. appendfile \ \](#414-appendfile-source-destination) + - [4.1.5. isdirempty \](#415-isdirempty-directory) - [4.2. Other functionnalities](#42-other-functionnalities) - [5. The pkgman.sh file](#5-the-pkgmansh-file) - [5.1. Global dependencies](#51-global-dependencies) @@ -55,6 +58,12 @@ reference for all internal functions, so you can easily build your own modules. This supposes you already read the [README file](../README.md). Creating modules will also require some good knowledge of Bash programming. +Writing conventions are the classical ones: + * \: writen like this, the parameter is mandatory + * [param]: that parameter is optionnal + * [ab|cd]: optionnal parmeter have to be "ab" or "cd" + * [0..15,20]: acceptable values start at 0 and goes up to 15 or be 20. + ## 2. The aaa_error.sh file ### 2.1. Functions #### 2.1.1. check_root @@ -106,11 +115,16 @@ through the use of a *kill* command. The script will exit after cleanup. ## 3. The display.sh file ### 3.1. Functions -#### 3.1.1. prnt [I|W|E|m] \ -Print a message with timestamp and header. The header depends on first parameter -will be colored and have a fixed length, so the messages will always be aligned. +#### 3.1.1. prnt [-n] [I|W|E|m] \ +Print a message with timestamp and header. The header depends on a single +character parameter, will be colored and have a fixed length, so the messages +will always be aligned. -The first parameter is the header type, having those possible values: +If the first parameter is *-n*, we won't go to a new line after displaying the +message. + +The first parameter (if *-n* is not provided) is the header type, having those +possible values: - **I**: Display an informative message in green - **W**: Display a warning in yellow - **E**: Display an error in red @@ -119,7 +133,9 @@ The first parameter is the header type, having those possible values: The second parameter is the message to display. -#### 3.1.2. dump_key_buffer +#### 3.1.2. dsleep \ [char] + +#### 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. @@ -178,13 +194,29 @@ entire infrastructure. Yet again provide a relative path to access it. - **Any path**: You can give fully qualified path names to access resources from other locations. -The priorities apply on file existance. Wildcards are not allowed in file names, -so an error will occurs if you try to use any. It's also not yet possible to -give an entire directory as a source. +The priorities applies on file existance. Wildcards are not allowed in file +names, so an error will occurs if you try to use any. It's also not yet possible +to give an entire directory as a source. The last parameter is always the destination. If the path do not exists, it will be created automatically. +#### 4.1.4. appendfile \ \ +That function add the content of source file to destination file. The source +file can have defferent origins, following the same path priority as the +*installfile* function. + +The destination file must exist and be on the root filesystem. Only two +parameters are accepted, the source and destination files. + +#### 4.1.5. isdirempty \ +That function take only one parameter, a path name and return 0 if the given +path don't exists or is empty. It will return one if there's at least one file +in the given directory. + +If the given parametter is a file (or a symlink to a file), it will terminate +with an error. + ### 4.2. Other functionnalities That file don't profide any other things that the previously listed functions.