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

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