Blame Scripts/Bash/Functions/Render/render_getDirOutput.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# render_getDirOutput.sh -- This function defines the final
878a2b
# absolute path the centos-art.sh script uses to store identity
878a2b
# contents produced at rendition time.
878a2b
#
03486a
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
878a2b
#
878a2b
# This program is free software; you can redistribute it and/or modify
878a2b
# it under the terms of the GNU General Public License as published by
878a2b
# the Free Software Foundation; either version 2 of the License, or (at
878a2b
# your option) any later version.
878a2b
#
878a2b
# This program is distributed in the hope that it will be useful, but
878a2b
# WITHOUT ANY WARRANTY; without even the implied warranty of
878a2b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
878a2b
# General Public License for more details.
878a2b
#
878a2b
# You should have received a copy of the GNU General Public License
878a2b
# along with this program; if not, write to the Free Software
878a2b
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
878a2b
#
878a2b
# ----------------------------------------------------------------------
878a2b
# $Id$
878a2b
# ----------------------------------------------------------------------
878a2b
878a2b
function render_getDirOutput {
878a2b
878a2b
    # Define base output directory using design model path as
878a2b
    # reference.
878a2b
    OUTPUT=$(dirname $FILE | sed -r \
1a5a18
        -e "s!Identity/Models/Themes/${FLAG_THEME_MODEL}!Identity/Images/Themes/$(cli_getPathComponent $ACTIONVAL --motif)!" \
1a5a18
        -e "s!Documentation/Models!Documentation/Manuals!" \
878a2b
        -e "s!/Tpl!!")
878a2b
878a2b
    # By default rendered identity content is stored immediatly under
878a2b
    # identity entry structure,  but if `Img/' directory exists use it
878a2b
    # instead.
878a2b
    if [[ -d "${OUTPUT}/Img" ]];then
878a2b
        OUTPUT=${OUTPUT}/Img
878a2b
    fi
878a2b
878a2b
    # Redefine base output directory to introduce specific information
878a2b
    # like release number and architecture. This information is
878a2b
    # require by directories (e.g., the `Media' directory inside
b665d9
    # themes and the `trunk/Documentation/Manuals/Docbook/Distro'
b665d9
    # directory ) whose need this information to be passed explicitly
b665d9
    # at the command-line through the `--releasever' and `--basearch'
b665d9
    # options.  Other directories take such information from the path
b665d9
    # they are stored in (e.g., the `Distro/5/Anaconda' directory
b665d9
    # inside themes.). So, we need to differentiate the way
b665d9
    # information like release numbers and architectures are retrived
b665d9
    # in order to build the output path correctly at rendition time.
878a2b
    if [[ $OUTPUT =~ "^${MOTIF_DIR}/Media$" ]];then
878a2b
        OUTPUT=${OUTPUT}/${FLAG_RELEASEVER}/${FLAG_BASEARCH}
b665d9
    elif [[ $OUTPUT =~ 'trunk/Documentation/Manuals/Docbook/Distro$' ]];then
878a2b
        OUTPUT=${OUTPUT}/${FLAG_RELEASEVER}
878a2b
    else
878a2b
        OUTPUT=${OUTPUT}
878a2b
    fi
878a2b
878a2b
    # Define whether to use or not locale-specific directory to store
878a2b
    # content, using current locale information as reference. As
878a2b
    # convenction, when we produce content, only specific locations
878a2b
    # use locale-specific directories to organize language-specific
878a2b
    # content (e.g., Manuals, Anaconda, Installation media, etc.). All
878a2b
    # other locations do not use locale-specific directories to
878a2b
    # organize content. This convenction is important in order for
878a2b
    # the `prepare' functionality of centos-art.sh script to produce
878a2b
    # content in the correct location. Otherwise, we might end up
878a2b
    # duplicating content (e.g., icons, brands, etc.) which doesn't
878a2b
    # have any translation, nor any need to be translated.
878a2b
    if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then
878a2b
        if [[ $(cli_isLocalized $TEMPLATE) == 'true' ]];then
878a2b
            OUTPUT=${OUTPUT}/$(cli_getCurrentLocale)
878a2b
        fi
878a2b
    fi
878a2b
878a2b
    # Create final output directory, if it doesn't exist yet.
878a2b
    if [[ ! -d ${OUTPUT} ]];then
878a2b
        mkdir -p ${OUTPUT}
878a2b
    fi
878a2b
878a2b
}