Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!--This manual describes the filesystem of CentOS Artwork Repository.

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 February, 24 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: 3.36 trunk/Scripts/Bash</title>

<meta name="description" content="CentOS Artwork Repository: 3.36 trunk/Scripts/Bash">
<meta name="keywords" content="CentOS Artwork Repository: 3.36 trunk/Scripts/Bash">
<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_38.html#SEC201" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC203" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_3.html#SEC3" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_3.html#SEC3" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_64.html#SEC362" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </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_64.html#SEC362" 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="trunk-Scripts-Bash"></a>
<a name="SEC202"></a>
<h2 class="section"> 3.36 trunk/Scripts/Bash </h2>


<a name="SEC203"></a>
<h3 class="subsection"> 3.36.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="SEC204"></a>
<h3 class="subsection"> 3.36.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 (see section <a href="repository_49.html#SEC271">trunk/Scripts/Bash/Functions/Verify</a>), 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 (see section <a href="repository_40.html#SEC207">trunk/Scripts/Bash/Functions</a>).
</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 --&gt; ~/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 3.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 3.2: The actions initialization environment.
</strong>
</p>

<a name="SEC205"></a>
<h3 class="subsection"> 3.36.3 Usage </h3>

<p>The <tt>`centos-art.sh'</tt> script usage information is described inside
each specific function documentation (see section <a href="repository_40.html#SEC207">trunk/Scripts/Bash/Functions</a>).
</p>

<a name="SEC206"></a>
<h3 class="subsection"> 3.36.4 See also </h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="repository_38.html#SEC197">3.35 trunk/Scripts</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="repository_40.html#SEC207">3.37 trunk/Scripts/Bash/Functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="repository_50.html#SEC279">3.47 trunk/Scripts/Bash/Locale</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>


<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC205" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_40.html#SEC207" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_3.html#SEC3" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC202" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_64.html#SEC362" title="Next chapter"> &gt;&gt; </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated on <i>February, 24 2011</i> using <a class="www" href="http://texi2html.cvshome.org/"><i>texi2html 1.76</i></a>.
 </font>
 <br>

</p>
</body>
</html>