Blame Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/environment.docbook

a01c20
<sect1 id="scripts-bash-environment">
a01c20
a94822
    <title>Execution Environment Reference</title>
f751d7
f751d7
    <para>
f751d7
        The execution environment of <command>centos-art.sh</command>
f751d7
        script can be defined as the virtual boundery of memory in
f751d7
        which the script does what it was conceived to do once
f751d7
        executed by a command-line interpreter (e.g., Bash). When you
f751d7
        execute the <command>centos-art.sh</command> script in your
f751d7
        terminal, the interpreter behind it creates a new execution
f751d7
        environment for it which inherits all the variables and
f751d7
        functions set in the shell execution environment and those
f751d7
        exported to it through the
f751d7
        <filename>~/.bash_profile</filename> file, as well.
f751d7
    </para>
f751d7
f751d7
    <para>
f751d7
        The <command>centos-art.sh</command> script uses the
f751d7
        <filename>~/.bash_profile</filename> file to implement
f751d7
        per-user customizations.  For example, you can use this file
f751d7
        to set the location of your working copy through the
f751d7
        <envar>TCAR_WORKDIR</envar> enviroment variable. By default
f751d7
        this variable is set to 
f751d7
        class="directory">${HOME}/artwork</filename>, but you can
f751d7
        reset to something different to fit your needs. See 
f751d7
        linkend="repo-ws-config-ChangeWorkingCopy" />.
f751d7
    </para>
f751d7
f751d7
    <para>
f751d7
        Once the <command>centos-art.sh</command> script has been
f751d7
        executed, it creates different levels of execution
f751d7
        environments inside the one created by the script itself on
f751d7
        the shell.  This different levels can be seen as a tree of
f751d7
        execution environments which inherit one another, as
f751d7
        illustrated in <xref linkend="scripts-bash-environments-1" />.
f751d7
        These different levels of execution evironments are where the
f751d7
        <command>centos-art.sh</command> script is developed in.
f751d7
    </para>
f751d7
f751d7
    <example id="scripts-bash-environments-1">
f751d7
    <title>Execution environments</title>
a01c20
    <screenshot>
f751d7
    <screeninfo>Execution environments</screeninfo>
a01c20
    <mediaobject>
a01c20
    <textobject>
a01c20
<programlisting>
f751d7
---------------------------------------------------------------
f751d7
Shell execution environment
a94822
----|-------------------|-----------------|--------------------
a94822
.   |-- TCAR_WORKDIR    |-- TCAR_BRAND    |-- EDITOR          .
a94822
.   |-- LANG            |-- HOME          |-- PATH            .
a94822
.   `-- centos-art.sh   `-- ...           `-- ...             .
f751d7
.       ----|------------------------------------------------ .
f751d7
.       centos-art.sh script execution environment            .
f751d7
.       ----|--------------------|--------------------------- .
f751d7
.       .   |-- CLI_NAME         `-- cli()                  . .
f751d7
.       .   |-- CLI_VERSION          |-- render()           . .
f751d7
.       .   |-- CLI_BASEDIR          |   |-- svg()          . .
f751d7
.       .   |-- CLI_FUNCDIR          |   `-- docbook()      . .
f751d7
.       .   |-- TMPDIR               |-- help()             . .
f751d7
.       .   `-- ...                  |   |-- docbook()      . .
f751d7
.       .                            |   `-- texinfo()      . .
f751d7
.       .                            |-- locale()           . .
f751d7
.       .                            |-- cli_printMessage() . .
f751d7
.       .                            |-- cli_getFilesList() . .
f751d7
.       .                            `-- ...                . .
f751d7
.       ..................................................... .
f751d7
...............................................................
a01c20
</programlisting>
a01c20
    </textobject>
a01c20
    </mediaobject>
a01c20
    </screenshot>
a01c20
    </example>
a01c20
a01c20
    <para>
f751d7
        The first file <command>centos-art.sh</command> script calls
f751d7
        is the
f751d7
        <filename>trunk/Scripts/Bash/Functions/Common/cli.sh</filename>
f751d7
        file. This file initializes variables and functions used along
f751d7
        the script execution environment.  Such variables are for
f751d7
        internal use inside the <command>centos-art.sh</command>
f751d7
        script only and users shouldn't modify them to customize the
f751d7
        script in a per-user level.  Instead, to customize the script
f751d7
        behaviour in a per-user level, users need to make use of
f751d7
        environment variables set in
f751d7
        <filename>~/.bash_profile</filename> file.
f751d7
    </para>
f751d7
f751d7
    <para>
f751d7
        The functions initialized by
f751d7
        <filename>trunk/Scripts/Bash/Functions/Common/cli.sh</filename>
f751d7
        can be either common or specific. Common functionalities are
f751d7
        always loaded in each execution of centos-art.sh script.
f751d7
        Common functionalities are stored in the 
f751d7
        class="directory">trunk/Scripts/Bash/Functions/Commons/</filename>
f751d7
        directory and are made available for all specific
f751d7
        functionalities loaded later. Specific functionalities, on the
f751d7
        other hand, are loaded based in the first argument passed to
f751d7
        <command>centos-art.sh</command> script and are not available
f751d7
        for common functionalities. Specific functionalities are
f751d7
        stored in the 
78a769
        class="directory">trunk/Scripts/Bash/Functions/${CLI_FUNCDIRNAM}/${CLI_FUNCNAME}.sh</filename>
78a769
        file where <varname>CLI_FUNCDIRNAM</varname> is the function
78a769
        name with the first letter in upper case and
78a769
        <varname>CLI_FUNCNAME</varname> is the function name with all
78a769
        letters in lower case.
f751d7
    </para>
a01c20
a01c20
    <para>
a94822
        In <xref linkend="scripts-bash-environments-1" />,
a94822
        <function>render</function>, <function>help</function> and
a94822
        <function>locale</function> are all specific functions while
a94822
        <function>cli_printMessage</function> and
a94822
        <function>cli_getFilesList</function> are common
78a769
        functionalities.
a01c20
    </para>
f751d7
a01c20
</sect1>