Blame Manuals/Repository/trunk/Scripts/Bash.texi

d18d63
@subsection Goals
d18d63
d18d63
The @file{trunk/Scripts/Bash} directory exists to organize the trunk
d18d63
development line of @file{centos-art.sh} automation script.  The
d18d63
@file{centos-art.sh} script standardizes frequent tasks inside your
d18d63
working copy of CentOS Artwork Repository.
d18d63
d18d63
@subsection Description
d18d63
d18d63
The best way to understand @file{centos-art.sh} automation script is
d18d63
studying its source code.  However, as start point, you may prefer to
d18d63
read an introductory resume before diving into the source code
d18d63
details.
d18d63
d18d63
The @file{centos-art.sh} script is written in Bash. Most tasks, inside
d18d63
@file{centos-art.sh} script, have been organized in many specific
d18d63
functionalities that you can invoke from the @command{centos-art}
d18d63
command-line interface.
d18d63
d18d63
When you type the @command{centos-art} command in your terminal, the
d18d63
operating system trys to execute that command. In order to execute the
d18d63
command, the operating system needs to know where it is, so the
d18d63
operating system uses the @var{PATH} environment variable to look for
d18d63
that command location. If your system was prepared to use CentOS
d18d63
Artwork Repository correctly (@pxref{trunk Scripts Bash Functions
d18d63
Verify}), you should have a symbolic link inside @file{~/bin/}
d18d63
directory that points to the @file{centos-art.sh} script file. As
d18d63
@file{~/bin/} directory is, by default, inside @var{PATH} environment
d18d63
variable, the execution of @command{centos-art} command runs the
d18d63
@file{centos-art.sh} script.
d18d63
d18d63
When @file{centos-art.sh} script is executed, the first it does is
d18d63
executing the @file{trunk/Scripts/Bash/initEnvironment.sh} script to
d18d63
initialize global variables (e.g., @command{gettext} variables) and
d18d63
global function scripts.  Global function scripts are located inside
d18d63
@file{trunk/Scripts/Bash/Functions} directory and their file names
d18d63
begin with @samp{cli}. Global function scripts provide common
d18d63
functionalities that can be used anywhere inside @file{centos-art.sh}
d18d63
script execution environment.
d18d63
d18d63
Once global variables and function scripts have been loaded,
d18d63
@file{centos-art.sh} script executes the @command{cli} global function
d18d63
from @file{cli.sh} function script to retrive command-line arguments
d18d63
and define some default values that may be used later by specific
d18d63
function scripts (@pxref{trunk Scripts Bash Functions}).
d18d63
d18d63
As convenction, the @file{centos-art.sh} command-line arguments have
d18d63
the following format:
d18d63
d18d63
@verbatim
d18d63
centos-art arg1 --arg2=val2 --arg3=val3
d18d63
@end verbatim
d18d63
d18d63
In the above example, @samp{centos-art} is the command you use to
d18d63
invoke @file{centos-art.sh} script. The @samp{arg1} is required and
d18d63
represents the functionality you want to perform (e.g.,
d18d63
@option{verify}, @option{render}, @option{locale}, @option{manual},
d18d63
etc.). The remaining arguments are modifiers to @option{arg1}. The
d18d63
@option{--arg2} definition is required and represets, specifically,
d18d63
the action inside the functionality you want to perform.  The
d18d63
@option{--arg3} and on, are optional.
d18d63
d18d63
Once command-line arguments have been retrived, the
d18d63
@file{centos-art.sh} script loads specific functionalities using the
d18d63
@file{cli_getFunctions.sh} function script. Only one specific
d18d63
functionality can be loaded at one script execution I.e., you run
d18d63
@command{centos-art.sh} script to run just one functionality.
d18d63
d18d63
@float Figure,fig:trunk/Scripts/Bash:Initialization
d18d63
@verbatim
d18d63
+----------------------------------------------------------------------+
d18d63
| [centos@host]$ centos-art function --action='value' --option='value' |
d18d63
+----------------------------------------------------------------------+
d18d63
| ~/bin/centos-art --> ~/artwork/trunk/Scripts/Bash/centos-art.sh      |
d18d63
+---v-----------------------------------------v------------------------+
d18d63
    | centos-art.sh                           |
d18d63
    +---v---------------------------------v---+
d18d63
    .   | initEnvironment.sh              |   .
d18d63
    .   +---------------------------------+   .
d18d63
    .   | cli $@                          |   .
d18d63
    .   +---v-------------------------v---+   .
d18d63
    .   .   | cli_getFunctions        |   .   .
d18d63
    .   .   +---v-----------------v---+   .   .
d18d63
    .   .   .   | function1       |   .   .   .
d18d63
    .   .   .   | function2       |   .   .   .
d18d63
    .   .   .   | function3       |   .   .   .
d18d63
    .   .   .   +-----------------+   .   .   .
d18d63
    .   .   ...........................   .   .
d18d63
    .   ...................................   .
d18d63
    ...........................................
d18d63
@end verbatim
d18d63
@caption{The functionalities initialization environment.}
d18d63
@end float
d18d63
d18d63
Functionalities are implemented by means of actions.  Once the
d18d63
functionality has been initiazalized, actions initialization take
d18d63
place for that functionality. Actions initialization model is very
d18d63
similar to functions initialization model. But with the difference,
d18d63
that actions are loaded inside function environment, and so, share
d18d63
variables and functions defined inside function environment.
d18d63
d18d63
@float Figure,fig:trunk/Scripts/Bash/Functions:Initialization
d18d63
@verbatim
d18d63
+--------------------------------------+
d18d63
| cli_getFunctions                     |
d18d63
+---v------------------------------v---+
d18d63
.   | function1                    |   .
d18d63
.   +---v----------------------v---+   .
d18d63
.   .   | function1_getActions |   .   .
d18d63
.   .   +---v--------------v---+   .   .
d18d63
.   .   .   | action 1     |   .   .   .
d18d63
.   .   .   | action 2     |   .   .   .
d18d63
.   .   .   | action n     |   .   .   .
d18d63
.   .   .   +--------------+   .   .   .
d18d63
.   .   ........................   .   .
d18d63
.   ................................   .
d18d63
.   +------------------------------+   .
d18d63
.   | function2                    |   .
d18d63
.   +---v----------------------v---+   .
d18d63
.   .   | function2_getActions |   .   .
d18d63
.   .   +---v--------------v---+   .   .
d18d63
.   .   .   | action 1     |   .   .   .
d18d63
.   .   .   | action 2     |   .   .   .
d18d63
.   .   .   | action n     |   .   .   .
d18d63
.   .   .   +--------------+   .   .   .
d18d63
.   .   ........................   .   .
d18d63
.   ................................   .
d18d63
.   +------------------------------+   .
d18d63
.   | function3                    |   .
d18d63
.   +---v----------------------v---+   .
d18d63
.   .   | function3_getActions |   .   .
d18d63
.   .   +---v--------------v---+   .   .
d18d63
.   .   .   | action 1     |   .   .   .
d18d63
.   .   .   | action 2     |   .   .   .
d18d63
.   .   .   | action n     |   .   .   .
d18d63
.   .   .   +--------------+   .   .   .
d18d63
.   .   ........................   .   .
d18d63
.   ................................   .
d18d63
........................................
d18d63
@end verbatim
d18d63
@caption{The actions initialization environment.}
d18d63
@end float
d18d63
d18d63
@subsection Usage
d18d63
d18d63
The @file{centos-art.sh} script usage information is described inside
d18d63
each specific function documentation (@pxref{trunk Scripts Bash
d18d63
Functions}).
d18d63
d18d63
@subsection See also
d18d63
d18d63
@menu
d18d63
* trunk Scripts::
d18d63
* trunk Scripts Bash Functions::
d18d63
* trunk Scripts Bash Locale::
d18d63
@end menu