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