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