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