Blame Automation/Modules/Locale/locale_getFilesList.sh

Alain Reguera Delgado 2eb4e7
#!/bin/bash
Alain Reguera Delgado 2eb4e7
######################################################################
Alain Reguera Delgado 2eb4e7
#
Alain Reguera Delgado 2eb4e7
#   locale_getFilesList.sh -- This function prints to standard output
Alain Reguera Delgado 2eb4e7
#   the list of files that locale module will use for processing. The
Alain Reguera Delgado 2eb4e7
#   list of files is conditioned by the LOCALE_FLAG_TYPE variable to
Alain Reguera Delgado 2eb4e7
#   determine whether the processing is applied to one file, all files
Alain Reguera Delgado 2eb4e7
#   in a directory only or all files in a directory recursively. By
Alain Reguera Delgado 2eb4e7
#   default one file processing is performed.
Alain Reguera Delgado 2eb4e7
#
Alain Reguera Delgado 2eb4e7
#   Written by:
Alain Reguera Delgado 2eb4e7
#   * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
Alain Reguera Delgado 2eb4e7
#
Alain Reguera Delgado 2eb4e7
# Copyright (C) 2009-2013 The CentOS Artwork SIG
Alain Reguera Delgado 2eb4e7
#
Alain Reguera Delgado 2eb4e7
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 2eb4e7
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 2eb4e7
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 2eb4e7
# your option) any later version.
Alain Reguera Delgado 2eb4e7
#
Alain Reguera Delgado 2eb4e7
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 2eb4e7
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 2eb4e7
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 2eb4e7
# General Public License for more details.
Alain Reguera Delgado 2eb4e7
#
Alain Reguera Delgado 2eb4e7
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 2eb4e7
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 2eb4e7
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 2eb4e7
#
Alain Reguera Delgado 2eb4e7
######################################################################
Alain Reguera Delgado 2eb4e7
Alain Reguera Delgado 2eb4e7
function locale_getFilesList {
Alain Reguera Delgado 2eb4e7
Alain Reguera Delgado 03cba4
    if [[ ${LOCALE_FLAG_SIBLINGS} == 'true' ]];then
Alain Reguera Delgado 03cba4
Alain Reguera Delgado 03cba4
        # Process all files in the current location only.
Alain Reguera Delgado 03cba4
        tcar_getFilesList ${DIRECTORY} --maxdepth=1 --mindepth=1 \
Alain Reguera Delgado 03cba4
            --type="f" --pattern="^.+/.+\.${FILE_EXTENSION}$"
Alain Reguera Delgado 03cba4
Alain Reguera Delgado 03cba4
    elif [[ ${LOCALE_FLAG_ALL} == 'true' ]];then
Alain Reguera Delgado 03cba4
Alain Reguera Delgado 03cba4
        # Process all files in the current location recursively.
Alain Reguera Delgado 03cba4
        tcar_getFilesList ${DIRECTORY} --type="f" --pattern="^.+/.+\.${FILE_EXTENSION}$"
Alain Reguera Delgado 03cba4
Alain Reguera Delgado 03cba4
Alain Reguera Delgado 03cba4
    else
Alain Reguera Delgado 03cba4
Alain Reguera Delgado 03cba4
        # Process the file provided only.
Alain Reguera Delgado 03cba4
        tcar_getFilesList ${DIRECTORY} --maxdepth=1 --mindepth=1 \
Alain Reguera Delgado 03cba4
            --type="f" --pattern="^.+/${FILE_NAME}$"
Alain Reguera Delgado 03cba4
Alain Reguera Delgado 03cba4
    fi
Alain Reguera Delgado 2eb4e7
Alain Reguera Delgado 2eb4e7
}