<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!--Copyright C 2009-2011 Alain Reguera Delgado
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled GNU Free
Documentation License.
-->
<!-- Created on March, 1 2011 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>
-->
<head>
<title>CentOS Artwork Repository: 2.50 The trunk/Scripts/Bash Directory</title>
<meta name="description" content="CentOS Artwork Repository: 2.50 The trunk/Scripts/Bash Directory">
<meta name="keywords" content="CentOS Artwork Repository: 2.50 The trunk/Scripts/Bash Directory">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
@import "/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/common.css";
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="repository_51.html#SEC266" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC268" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="repository_2.html#SEC2" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="repository_2.html#SEC2" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_66.html#SEC355" 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.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="repository_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="repository_66.html#SEC355" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="repository_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Filesystem-trunk-Scripts-Bash"></a>
<a name="SEC267"></a>
<h2 class="section"> 2.50 The <tt>`trunk/Scripts/Bash'</tt> Directory </h2>
<a name="SEC268"></a>
<h3 class="subsection"> 2.50.1 Goals </h3>
<p>The <tt>`trunk/Scripts/Bash'</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 frequent tasks inside your
working copy of CentOS Artwork Repository.
</p>
<a name="SEC269"></a>
<h3 class="subsection"> 2.50.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 arg1 --arg2=val2 --arg3=val3
</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/Bash/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_getActions | . .
. . +---v--------------v---+ . .
. . . | action 1 | . . .
. . . | action 2 | . . .
. . . | action n | . . .
. . . +--------------+ . . .
. . ........................ . .
. ................................ .
. +------------------------------+ .
. | function2 | .
. +---v----------------------v---+ .
. . | function2_getActions | . .
. . +---v--------------v---+ . .
. . . | action 1 | . . .
. . . | action 2 | . . .
. . . | action n | . . .
. . . +--------------+ . . .
. . ........................ . .
. ................................ .
. +------------------------------+ .
. | function3 | .
. +---v----------------------v---+ .
. . | function3_getActions | . .
. . +---v--------------v---+ . .
. . . | action 1 | . . .
. . . | action 2 | . . .
. . . | action n | . . .
. . . +--------------+ . . .
. . ........................ . .
. ................................ .
........................................
</pre>
</div><p><strong>Figure 2.2: The actions initialization environment.
</strong>
</p>
<a name="SEC270"></a>
<h3 class="subsection"> 2.50.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>
<a name="SEC271"></a>
<h3 class="subsection"> 2.50.4 See also </h3>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="repository_51.html#SEC262">2.49 The <tt>`trunk/Scripts'</tt> Directory</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC270" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="repository_53.html#SEC272" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="repository_2.html#SEC2" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC267" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_66.html#SEC355" title="Next chapter"> >> </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated on <i>March, 1 2011</i> using <a class="www" href="http://texi2html.cvshome.org/"><i>texi2html 1.76</i></a>.
</font>
<br>
</p>
</body>
</html>