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

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