Blob Blame History Raw
<sect1 id="scripts-bash-environment">

    <title>Execution Environment Reference</title>

    <para>
        The execution environment of <command>centos-art.sh</command>
        script can be defined as the virtual boundery of memory in
        which the script does what it was conceived to do once
        executed by a command-line interpreter (e.g., Bash). When you
        execute the <command>centos-art.sh</command> script in your
        terminal, the interpreter behind it creates a new execution
        environment for it which inherits all the variables and
        functions set in the shell execution environment and those
        exported to it through the
        <filename>~/.bash_profile</filename> file, as well.
    </para>

    <para>
        The <command>centos-art.sh</command> script uses the
        <filename>~/.bash_profile</filename> file to implement
        per-user customizations.  For example, you can use this file
        to set the location of your working copy through the
        <envar>TCAR_WORKDIR</envar> enviroment variable. By default
        this variable is set to <filename
        class="directory">${HOME}/artwork</filename>, but you can
        reset to something different to fit your needs. See <xref
        linkend="repo-ws-config-ChangeWorkingCopy" />.
    </para>

    <para>
        Once the <command>centos-art.sh</command> script has been
        executed, it creates different levels of execution
        environments inside the one created by the script itself on
        the shell.  This different levels can be seen as a tree of
        execution environments which inherit one another, as
        illustrated in <xref linkend="scripts-bash-environments-1" />.
        These different levels of execution evironments are where the
        <command>centos-art.sh</command> script is developed in.
    </para>

    <example id="scripts-bash-environments-1">
    <title>Execution environments</title>
    <screenshot>
    <screeninfo>Execution environments</screeninfo>
    <mediaobject>
    <textobject>
<programlisting>
---------------------------------------------------------------
Shell execution environment
----|-------------------|-----------------|--------------------
.   |-- TCAR_WORKDIR    |-- TCAR_BRAND    |-- EDITOR          .
.   |-- LANG            |-- HOME          |-- PATH            .
.   `-- centos-art.sh   `-- ...           `-- ...             .
.       ----|------------------------------------------------ .
.       centos-art.sh script execution environment            .
.       ----|--------------------|--------------------------- .
.       .   |-- CLI_NAME         `-- cli()                  . .
.       .   |-- CLI_VERSION          |-- render()           . .
.       .   |-- CLI_BASEDIR          |   |-- svg()          . .
.       .   |-- CLI_FUNCDIR          |   `-- docbook()      . .
.       .   |-- TMPDIR               |-- help()             . .
.       .   `-- ...                  |   |-- docbook()      . .
.       .                            |   `-- texinfo()      . .
.       .                            |-- locale()           . .
.       .                            |-- cli_printMessage() . .
.       .                            |-- cli_getFilesList() . .
.       .                            `-- ...                . .
.       ..................................................... .
...............................................................
</programlisting>
    </textobject>
    </mediaobject>
    </screenshot>
    </example>

    <para>
        The first file <command>centos-art.sh</command> script calls
        is the
        <filename>trunk/Scripts/Bash/Functions/Common/cli.sh</filename>
        file. This file initializes variables and functions used along
        the script execution environment.  Such variables are for
        internal use inside the <command>centos-art.sh</command>
        script only and users shouldn't modify them to customize the
        script in a per-user level.  Instead, to customize the script
        behaviour in a per-user level, users need to make use of
        environment variables set in
        <filename>~/.bash_profile</filename> file.
    </para>

    <para>
        The functions initialized by
        <filename>trunk/Scripts/Bash/Functions/Common/cli.sh</filename>
        can be either common or specific. Common functionalities are
        always loaded in each execution of centos-art.sh script.
        Common functionalities are stored in the <filename
        class="directory">trunk/Scripts/Bash/Functions/Commons/</filename>
        directory and are made available for all specific
        functionalities loaded later. Specific functionalities, on the
        other hand, are loaded based in the first argument passed to
        <command>centos-art.sh</command> script and are not available
        for common functionalities. Specific functionalities are
        stored in the <filename
        class="directory">trunk/Scripts/Bash/Functions/${CLI_FUNCDIRNAM}/${CLI_FUNCNAME}.sh</filename>
        file where <varname>CLI_FUNCDIRNAM</varname> is the function
        name with the first letter in upper case and
        <varname>CLI_FUNCNAME</varname> is the function name with all
        letters in lower case.
    </para>

    <para>
        In <xref linkend="scripts-bash-environments-1" />,
        <function>render</function>, <function>help</function> and
        <function>locale</function> are all specific functions while
        <function>cli_printMessage</function> and
        <function>cli_getFilesList</function> are common
        functionalities.
    </para>

</sect1>