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

40baf3
<section id="scripts-bash-cli_checkFiles">
9fb7a6
9fb7a6
    <title>Standardizing File Verifications</title>
9fb7a6
    <indexterm type="common-function">
9fb7a6
        <primary>cli_checkFiles</primary>
9fb7a6
    </indexterm>
9fb7a6
9fb7a6
    <para>
40baf3
        The file verification tasks are implemented through
40baf3
        <function>cli_checkFiles</function> function inside the
40baf3
        <command>centos-art.sh</command> script.  The
40baf3
        <function>cli_checkFiles</function> function is exported to
40baf3
        <command>centos-art.sh</command> script environment in the
40baf3
        very beginning of its execution and will be available all
40baf3
        along its execution lifetime. You can use this function inside
40baf3
        common and specific functions whenever you need to verify
40baf3
        files inside the &TCAR;.
9fb7a6
    </para>
9fb7a6
9fb7a6
    <para>
40baf3
        The <function>cli_checkFiles</function> answers basic
9fb7a6
        questions like <quote>Does <replaceable>location</replaceable>
9fb7a6
        is a regular file?</quote> and <quote>Does
9fb7a6
        <replaceable>location</replaceable> is directory?</quote>.
9fb7a6
        When the answer to such questions is positive, the script
9fb7a6
        passes the test silently and continues its execution.  When
9fb7a6
        the answer is negative, the script finishes its execution
9fb7a6
        immediately with an error message.
9fb7a6
    </para>
9fb7a6
9fb7a6
    <para>
9fb7a6
        Use the <function>cli_checkFiles</function> function whenever
9fb7a6
        you need to verify the characteristics of different file types
9fb7a6
        (e.g., regular files, directories, links, etc.) inside &TCAR;.
9fb7a6
    </para>
9fb7a6
9fb7a6
    <simplesect id="scripts-bash-cli_checkFiles-syntax">
9fb7a6
    <title>Syntax</title>
9fb7a6
    <cmdsynopsis>
9fb7a6
        <command>cli_checkFiles</command> 
9fb7a6
        <arg choice="req">
9fb7a6
            <arg>-d</arg>
9fb7a6
            <arg>-e</arg>
9fb7a6
            <arg>-f</arg>
9fb7a6
            <arg>-h</arg>
9fb7a6
            <arg>-x</arg>
9fb7a6
        </arg>
9fb7a6
        <arg choice="req" rep="repeat"><replaceable>LOCATION</replaceable></arg>
9fb7a6
    </cmdsynopsis>
9fb7a6
    </simplesect>
9fb7a6
9fb7a6
    <simplesect id="scripts-bash-cli_checkFiles-options">
9fb7a6
    <title>Options</title>
9fb7a6
    <para>
9fb7a6
        The <function>cli_checkFiles</function> function accepts the
9fb7a6
        following options:
9fb7a6
    </para>
9fb7a6
    <variablelist>
9fb7a6
    <varlistentry>
9fb7a6
    <term><option>-d</option></term>
9fb7a6
    <listitem>
9fb7a6
    <para>
9fb7a6
        Verifies whether <replaceable>LOCATION</replaceable> exists
9fb7a6
        and is a directory. If it doesn't exists or isn't a directory,
9fb7a6
        an error message is printed and the script finishes its
9fb7a6
        execution.  Otherwise, if it exists and is a directory, the
9fb7a6
        script continues its execution normally.
9fb7a6
    </para>
9fb7a6
    </listitem>
9fb7a6
    </varlistentry>
9fb7a6
9fb7a6
    <varlistentry>
9fb7a6
    <term><option>-e</option></term>
9fb7a6
    <listitem>
9fb7a6
    <para>
9fb7a6
        Verifies whether <replaceable>LOCATION</replaceable> exists or
9fb7a6
        not. If it doesn't exist, an error message is printed and the
9fb7a6
        script finishes its execution.  Otherwise, if it does exists,
9fb7a6
        the script continues its execution normally.
9fb7a6
    </para>
9fb7a6
    </listitem>
9fb7a6
    </varlistentry>
9fb7a6
9fb7a6
    <varlistentry>
9fb7a6
    <term><option>-f</option></term>
9fb7a6
    <listitem>
9fb7a6
    <para>
9fb7a6
        Verifies whether <replaceable>LOCATION</replaceable> exists
9fb7a6
        and is a regular file. If it doesn't exists or isn't a regular
9fb7a6
        file, an error message is printed and the script finishes its
9fb7a6
        execution. Otherwise, if it exists and is a regular file, the
9fb7a6
        script continues its execution normally.
9fb7a6
    </para>
9fb7a6
    </listitem>
9fb7a6
    </varlistentry>
9fb7a6
9fb7a6
    <varlistentry>
9fb7a6
    <term><option>-h</option></term>
9fb7a6
    <listitem>
9fb7a6
    <para>
9fb7a6
        Verifies whether <replaceable>LOCATION</replaceable> exists
9fb7a6
        and is a symbolic link. If it doesn't exists or isn't a
9fb7a6
        symbolic link, an error message is printed and the script
9fb7a6
        finishes its execution immediately.  Otherwise, if it does
9fb7a6
        exist and is a symbolic link, the script continue its
9fb7a6
        execution normally.
9fb7a6
    </para>
9fb7a6
    </listitem>
9fb7a6
    </varlistentry>
9fb7a6
9fb7a6
    <varlistentry>
9fb7a6
    <term><option>-x</option></term>
9fb7a6
    <listitem>
9fb7a6
    <para>
9fb7a6
        Verifies whether <replaceable>LOCATION</replaceable> exists
9fb7a6
        and execution permission is granted. If it doesn't exist or
9fb7a6
        hasn't execution permission, the script finishes its execution
9fb7a6
        immediately. Otherwise, if it exists and has execution
9fb7a6
        permissions, the script continues its execution normally.
9fb7a6
    </para>
9fb7a6
    </listitem>
9fb7a6
    </varlistentry>
9fb7a6
    </variablelist>
9fb7a6
9fb7a6
    <para>
9fb7a6
        The value of the <replaceable>LOCATION</replaceable> argument
9fb7a6
        must be an absolute path to the file you want to verify. If
9fb7a6
        such file doens't exists in any supported form, the script
9fb7a6
        finishes its execution with an error message.
9fb7a6
    </para>
9fb7a6
    </simplesect>
9fb7a6
9fb7a6
    <simplesect id="scripts-bash-cli_checkFiles-description">
9fb7a6
    <title>Description</title>
9fb7a6
    <para>
9fb7a6
        The <function>cli_checkFiles</function> function is available
9fb7a6
        inside the centos-art.sh script only as part of its execution
9fb7a6
        environment. This function is exported to centos-art.sh script
9fb7a6
        just after executing the script from the command-line and will
9fb7a6
        be available all along the script lifetime. So, you can use
9fb7a6
        this function both in common and specific functionalities of
9fb7a6
        centos-art.sh script.
9fb7a6
    </para>
9fb7a6
9fb7a6
    <para>
9fb7a6
        The <function>cli_checkFiles</function> function doesn't
9fb7a6
        create subsequent execution environments.
9fb7a6
    </para>
9fb7a6
    
9fb7a6
    </simplesect>
9fb7a6
9fb7a6
    <simplesect id="scripts-bash-cli_checkFiles-authors">
9fb7a6
    <title>Authors</title>
9fb7a6
    <itemizedlist>
9fb7a6
    <listitem>
9fb7a6
    <para>
9fb7a6
        Alain Reguera Delgado <email>alain.reguera@gmail.com</email>, =COPYRIGHT_YEAR_LIST=
9fb7a6
    </para>
9fb7a6
    </listitem>
9fb7a6
    </itemizedlist>
9fb7a6
    </simplesect>
9fb7a6
9fb7a6
    <simplesect id="scripts-bash-cli_checkFiles-licence">
9fb7a6
    <title>License</title>
9fb7a6
9fb7a6
    <para>
9fb7a6
        Copyright © =COPYRIGHT_YEAR_LIST= The CentOS Project
9fb7a6
    </para>
9fb7a6
 
9fb7a6
    <para>
9fb7a6
        This program is free software; you can redistribute it and/or
9fb7a6
        modify it under the terms of the GNU General Public License as
9fb7a6
        published by the Free Software Foundation; either version 2 of
9fb7a6
        the License, or (at your option) any later version.
9fb7a6
    </para>
9fb7a6
 
9fb7a6
    <para>
9fb7a6
        This program is distributed in the hope that it will be
9fb7a6
        useful, but WITHOUT ANY WARRANTY; without even the implied
9fb7a6
        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9fb7a6
        PURPOSE.  See the GNU General Public License for more details.
9fb7a6
    </para>
9fb7a6
 
9fb7a6
    <para>
9fb7a6
        You should have received a copy of the GNU General Public
9fb7a6
        License along with this program; if not, write to the Free
9fb7a6
        Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
9fb7a6
        USA.
9fb7a6
    </para>
9fb7a6
    </simplesect>
9fb7a6
40baf3
</section>