Blame Automation/Modules/Prepare/Scripts/prepare_setConfiguration.sh

Alain Reguera Delgado ff1822
#!/bin/bash
Alain Reguera Delgado ff1822
######################################################################
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
#   prepare_setConfiguration.sh -- This function builds a list of
Alain Reguera Delgado ff1822
#   configuration files and calls the render module for processing it.
Alain Reguera Delgado ff1822
#   The list of configuration files is built using the first argument
Alain Reguera Delgado ff1822
#   provided to this function as reference.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
#   Written by: 
Alain Reguera Delgado ff1822
#   * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
Alain Reguera Delgado ff1822
#     Key fingerprint = D67D 0F82 4CBD 90BC 6421  DF28 7CCE 757C 17CA 3951
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado ff1822
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado ff1822
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado ff1822
# your option) any later version.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado ff1822
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado ff1822
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado ff1822
# General Public License for more details.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado ff1822
# along with this program; if not, write to the Free Software
Alain Reguera Delgado ff1822
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
######################################################################
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
function prepare_setConfiguration {
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    local FILENAME=${1}
Alain Reguera Delgado ff1822
    
Alain Reguera Delgado ff1822
    # Verify the file  name passed to this function. Just to avoid
Alain Reguera Delgado ff1822
    # trickery when building the list of configuration files.
Alain Reguera Delgado d0f373
    tcar_checkFiles "${FILENAME}" --match="^(images|links|manual)$"
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    # Build list of configuration files to be produced.
Alain Reguera Delgado d0f373
    local CONFIGURATION_FILES=$(tcar_getFilesList \
Alain Reguera Delgado ff1822
        ${TCAR_BASEDIR} --type="f" --pattern=".+/${FILENAME}\.conf")
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    # Verify list of configuration files.
Alain Reguera Delgado ff1822
    if [[ -z ${CONFIGURATION_FILES} ]];then
Alain Reguera Delgado ff1822
        return
Alain Reguera Delgado ff1822
    fi
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    # CAUTION: The order in which configuration files are processed is
Alain Reguera Delgado ff1822
    # relevant to final production result. For example, in order for
Alain Reguera Delgado ff1822
    # theme images to hold the branding information the
Alain Reguera Delgado ff1822
    # `Artworks/Brands' directory must be rendered before the
Alain Reguera Delgado ff1822
    # `Artworks/Themes' directory.  The reason of this is that brand
Alain Reguera Delgado ff1822
    # images are not drawn inside theme design models themselves, but
Alain Reguera Delgado ff1822
    # combined with theme images using the ImageMagick tool suite once
Alain Reguera Delgado ff1822
    # they both have been rendered as PNG files.
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    # Rebuild the list of configuration files to grant brand correct
Alain Reguera Delgado ff1822
    # production order when they are included in the list of files to
Alain Reguera Delgado ff1822
    # produce.
Alain Reguera Delgado ff1822
    echo "${CONFIGURATION_FILES}" | grep "${TCAR_BASEDIR}/Artworks/Brands" > /dev/null
Alain Reguera Delgado ff1822
    if [[ $? -eq 0 ]];then
Alain Reguera Delgado ff1822
        CONFIGURATION_FILES="${TCAR_BASEDIR}/Artworks/Brands
Alain Reguera Delgado ff1822
            $(echo "${CONFIGURATION_FILES}" | grep -v "${TCAR_BASEDIR}/Artworks/Brands")"
Alain Reguera Delgado ff1822
    fi
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    # Process configuration files using render module.
Alain Reguera Delgado f81134
    tcar_setFnEnvironment render ${CONFIGURATION_FILES}
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
}