Blame Automation/centos-art.sh-mods/Render/render_getDirOutput.sh

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