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

4c79b5
#!/bin/bash
4c79b5
#
4c79b5
# render_getActionsIdentity.sh -- This function initializes rendering
4c79b5
# configuration functions and executes them to perform the rendering
4c79b5
# action specified in the variable `$ACTIONS[0]'. Function
4c79b5
# initialization and execution is based on the absolute path
4c79b5
# convenction defined by ARTCONF variable.
4c79b5
#
4c79b5
# Copyright (C) 2009-2010 Alain Reguera Delgado
4c79b5
# 
4c79b5
# This program is free software; you can redistribute it and/or modify
4c79b5
# it under the terms of the GNU General Public License as published by
4c79b5
# the Free Software Foundation; either version 2 of the License, or
4c79b5
# (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# 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
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
4c79b5
# $Id: render_getActionsIdentity.sh 98 2010-09-19 16:01:53Z al $
4c79b5
# ----------------------------------------------------------------------
4c79b5
4c79b5
function render_getActionsIdentity {
4c79b5
4c79b5
    # Define variables as local to avoid conflicts outside.
4c79b5
    local ARTCOMP=''
4c79b5
4c79b5
    # Define default theme model to use.  
4c79b5
    local THEMEMODEL='Default'
4c79b5
4c79b5
    # Define default artworks matching list. The artworks matching
4c79b5
    # list lets you customize how translation files are applied to
4c79b5
    # design templates. When matching list is empty (the default
4c79b5
    # value), translation files are applied to design templates
4c79b5
    # sharing the same name (without the extension). This produces one
4c79b5
    # translated design for each translation file available.
4c79b5
    # Matching list definitions where translation files need to be
4c79b5
    # applied to specific design templates are be defined inside
4c79b5
    # artwork-specific pre-rendering configuration scripts.
4c79b5
    local MATCHINGLIST=''
4c79b5
4c79b5
    # Check current scripts path value. If scripts path points to a
4c79b5
    # directory which currently doesn't exist there is nothing to do
4c79b5
    # here, so leave a message quit script execution.
4c79b5
    if [[ ! -d $ARTCONF ]];then
4c79b5
        cli_printMessage "`gettext "The path provided can't be processed."`"
1f1b3c
        cli_printMessage "$(caller)" "AsToKnowMoreLine"
4c79b5
    fi
4c79b5
4c79b5
    for FILE in $(find $ARTCONF -name 'render.conf.sh');do
4c79b5
4c79b5
        # Output action message.
4c79b5
        cli_printMessage "`gettext "Reading configuration file:"` $FILE"
4c79b5
f3bce7
        # Define artwork-specific action arrays. We need to do this
4c79b5
        # here because ACTIONS variable is unset after
4c79b5
        # render_doIdentityImages execution.
4c79b5
        local -a ACTIONS
f3bce7
        local -a BASEACTIONS
f3bce7
        local -a POSTACTIONS
f3bce7
        local -a LASTACTIONS
4c79b5
  
4c79b5
        # Initialize artwork-specific pre-rendering configuration
4c79b5
        # (function) scripts.
4c79b5
        . $FILE
4c79b5
4c79b5
        # Execute artwork-specific pre-rendering configuration
4c79b5
        # (function) scripts to re-define artwork-specific ACTIONS and
4c79b5
        # MATCHINGLIST variables. 
4c79b5
        render_loadConfig
4c79b5
4c79b5
        # Check variables passed from artwork-specific pre-rendering
4c79b5
        # configuration scripts and make required transformations.
4c79b5
        render_checkConfig
4c79b5
4c79b5
        # Re-define option value (OPTIONVAL) based on pre-rendering
4c79b5
        # configuration script path value. Otherwise massive rendering
4c79b5
        # may fail. Functions like renderImage need to know the exact
4c79b5
        # artwork path (that is, where images will be stored).
841480
        OPTIONVAL=$(dirname $(echo $FILE | sed -r \
841480
            -e 's!Scripts/Bash/Functions/Render/Config/Identity/!Identity/!' \
841480
            -e "s!Themes/!Themes/Motifs/$(cli_getThemeName)/!"))
4c79b5
4c79b5
        # Re-define artwork identification.
4c79b5
        ARTCOMP=$(echo $OPTIONVAL | cut -d/ -f6-)
4c79b5
4c79b5
        # Remove motif name from artwork identification in order to reuse
4c79b5
        # motif artwork identification. There is not need to create one
4c79b5
        # artwork identification for each motif directory structure.
4c79b5
        if [[ $ARTCOMP =~ "Themes/Motifs/$(cli_getThemeName)/" ]];then
4c79b5
            ARTCOMP=$(echo $ARTCOMP | sed -r "s!Themes/Motifs/$(cli_getThemeName)/!Themes/!")
4c79b5
        fi
4c79b5
4c79b5
        # Start rendering as defined in artwork-specific pre-rendering
4c79b5
        # configuration file.
4c79b5
        render_doIdentity
4c79b5
4c79b5
        # Unset artwork-specific actions so they can be re-defined by
4c79b5
        # artwork-specific pre-rendering configuration scripts. This
4c79b5
        # is required in massive rendering. For example, if you say
4c79b5
        # centos-art.sh to render the whole Distro directory it first
4c79b5
        # renders Prompt entry, which defines the renderSyslinux
4c79b5
        # post-rendering action, and later Progress entry which does
4c79b5
        # not defines post-rendering actions. If we do not unset the
4c79b5
        # ACTIONS variable, post-rendering actions defined in Prompt
4c79b5
        # entry remain for Progress entry and that is not desired. We
4c79b5
        # want ACTIONS to do what we exactly tell it to do inside each
4c79b5
        # artwork-specific pre-rendering configuration script.
4c79b5
        unset ACTIONS
f3bce7
        unset BASEACTIONS
f3bce7
        unset POSTACTIONS
f3bce7
        unset LASTACTIONS
4c79b5
4c79b5
    done
4c79b5
4c79b5
}