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