<?xml version="1.0"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CentOS Artwork Repository: 2.60 The trunk/Scripts Directory</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="description" content="CentOS Artwork Repository: 2.60 The trunk/Scripts Directory" />
<meta name="keywords" content="CentOS Artwork Repository: 2.60 The trunk/Scripts Directory" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="generator" content="texi2html 1.76" />
<meta name="copyright" content="2009-2011 Alain Reguera Delgado" />
<link href="/home/centos/artwork/trunk/Identity/Manual/repository.css" rel="stylesheet" type="text/css" media="screen projection" />
</head>
<body>
<a name="top" />
<div id="wrap">
<div id="page-body">
<div id="content">
<!-- Created on March, 30 2011 by texi2html 1.76 -->
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="repository_66.xhtml#SEC328" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC330" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="repository.xhtml#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="repository_toc.xhtml#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="repository_abt.xhtml#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Directories-trunk-Scripts"></a>
<a name="SEC329"></a>
<h2 class="section"> 2.60 The <tt>`trunk/Scripts'</tt> Directory </h2>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC330"></a>
<h3 class="subsection"> 2.60.1 Goals </h3>
<p>The <tt>`trunk/Scripts'</tt> directory exists to organize the trunk
development line of <tt>`centos-art.sh'</tt> automation script. The
<tt>`centos-art.sh'</tt> script standardizes tasks you need to do
frequently inside CentOS Artwork Repository.
</p>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC331"></a>
<h3 class="subsection"> 2.60.2 Description </h3>
<p>The best way to understand <tt>`centos-art.sh'</tt> automation script is
studying its source code. However, as start point, you may prefer to
read an introductory resume before diving into the source code
details.
</p>
<p>The <tt>`centos-art.sh'</tt> script is written in Bash. Most tasks, inside
<tt>`centos-art.sh'</tt> script, have been organized in many specific
functionalities that you can invoke from the <code>centos-art</code>
command-line interface.
</p>
<p>When you type the <code>centos-art</code> command in your terminal, the
operating system trys to execute that command. In order to execute the
command, the operating system needs to know where it is, so the
operating system uses the <var>PATH</var> environment variable to look for
that command location. If your system was prepared to use CentOS
Artwork Repository correctly (-- <strong>Removed</strong>(pxref:trunk Scripts Bash Functions
Verify) --), you should have a symbolic link inside <tt>`~/bin/'</tt>
directory that points to the <tt>`centos-art.sh'</tt> script file. As
<tt>`~/bin/'</tt> directory is, by default, inside <var>PATH</var> environment
variable, the execution of <code>centos-art</code> command runs the
<tt>`centos-art.sh'</tt> script.
</p>
<p>When <tt>`centos-art.sh'</tt> script is executed, the first it does is
executing the <tt>`trunk/Scripts/Bash/initEnvironment.sh'</tt> script to
initialize global variables (e.g., <code>gettext</code> variables) and
global function scripts. Global function scripts are located inside
<tt>`trunk/Scripts/Bash/Functions'</tt> directory and their file names
begin with <samp>`cli'</samp>. Global function scripts provide common
functionalities that can be used anywhere inside <tt>`centos-art.sh'</tt>
script execution environment.
</p>
<p>Once global variables and function scripts have been loaded,
<tt>`centos-art.sh'</tt> script executes the <code>cli</code> global function
from <tt>`cli.sh'</tt> function script to retrive command-line arguments
and define some default values that may be used later by specific
function scripts (-- <strong>Removed</strong>(pxref:trunk Scripts Bash Functions) --).
</p>
<p>As convenction, the <tt>`centos-art.sh'</tt> command-line arguments have
the following format:
</p>
<pre class="verbatim">centos-art function path/to/dir --options
</pre>
<p>In the above example, <samp>`centos-art'</samp> is the command you use to
invoke <tt>`centos-art.sh'</tt> script. The <samp>`arg1'</samp> is required and
represents the functionality you want to perform (e.g.,
<samp>`verify'</samp>, <samp>`render'</samp>, <samp>`locale'</samp>, <samp>`manual'</samp>,
etc.). The remaining arguments are modifiers to <samp>`arg1'</samp>. The
<samp>`--arg2'</samp> definition is required and represets, specifically,
the action inside the functionality you want to perform. The
<samp>`--arg3'</samp> and on, are optional.
</p>
<p>Once command-line arguments have been retrived, the
<tt>`centos-art.sh'</tt> script loads specific functionalities using the
<tt>`cli_getFunctions.sh'</tt> function script. Only one specific
functionality can be loaded at one script execution I.e., you run
<code>centos-art.sh</code> script to run just one functionality.
</p>
<div class="float"><a name="fig_003atrunk_002fScripts_002fBash_003aInitialization"></a>
<pre class="verbatim">+----------------------------------------------------------------------+
| [centos@host]$ centos-art function --action='value' --option='value' |
+----------------------------------------------------------------------+
| ~/bin/centos-art --> ~/artwork/trunk/Scripts/centos-art.sh |
+---v-----------------------------------------v------------------------+
| centos-art.sh |
+---v---------------------------------v---+
. | initEnvironment.sh | .
. +---------------------------------+ .
. | cli $@ | .
. +---v-------------------------v---+ .
. . | cli_getFunctions | . .
. . +---v-----------------v---+ . .
. . . | function1 | . . .
. . . | function2 | . . .
. . . | function3 | . . .
. . . +-----------------+ . . .
. . ........................... . .
. ................................... .
...........................................
</pre>
</div><p><strong>Figure 2.1: The functionalities initialization environment.
</strong>
</p>
<p>Functionalities are implemented by means of actions. Once the
functionality has been initiazalized, actions initialization take
place for that functionality. Actions initialization model is very
similar to functions initialization model. But with the difference,
that actions are loaded inside function environment, and so, share
variables and functions defined inside function environment.
</p>
<div class="float"><a name="fig_003atrunk_002fScripts_002fBash_002fFunctions_003aInitialization"></a>
<pre class="verbatim">+--------------------------------------+
| cli_getFunctions |
+---v------------------------------v---+
. | function1 | .
. +---v------------------------v-+ .
. . | function1_getArguments | . .
. . +---v--------------v-----+ . .
. . . | action 1 | . . .
. . . | action 2 | . . .
. . . | action n | . . .
. . . +--------------+ . . .
. . .......................... . .
. ................................ .
. +------------------------------+ .
. | function2 | .
. +---v------------------------v-+ .
. . | function2_getArguments | . .
. . +---v--------------v-----+ . .
. . . | action 1 | . . .
. . . | action 2 | . . .
. . . | action n | . . .
. . . +--------------+ . . .
. . .......................... . .
. ................................ .
. +------------------------------+ .
. | function3 | .
. +---v------------------------v-+ .
. . | function3_getArguments | . .
. . +---v--------------v-----+ . .
. . . | action 1 | . . .
. . . | action 2 | . . .
. . . | action n | . . .
. . . +--------------+ . . .
. . .......................... . .
. ................................ .
........................................
</pre>
</div><p><strong>Figure 2.2: The actions initialization environment.
</strong>
</p>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC332"></a>
<h3 class="subsection"> 2.60.3 Usage </h3>
<p>The <tt>`centos-art.sh'</tt> script usage information is described inside
each specific function documentation (-- <strong>Removed</strong>(pxref:trunk Scripts Bash
Functions) --).
</p>
<div class="page-line white"><hr style="display:none;" /></div>
<a name="SEC333"></a>
<h3 class="subsection"> 2.60.4 See also </h3>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC329">2.60 The <tt>`trunk/Scripts'</tt> Directory</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<div class="page-line white"><hr style="display:none;" /></div>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC332" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="repository_68.xhtml#SEC334" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC329" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Next chapter"> >> </a>]</td>
</tr></table>
<div class="page-line"><hr style="display:none;" /></div>
</div>
</div>
<div class="page-line white"><hr style="display:none;" /></div>
</div>
</body>
</html>