Blame Scripts/Functions/Render/render_getDirOutput.sh

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