|
|
7d1ac0 |
#!/bin/bash
|
|
|
7d1ac0 |
#
|
|
|
7d1ac0 |
# render_doThemeActions.sh -- This function performs theme-specific
|
|
|
7d1ac0 |
# rendition.
|
|
|
7d1ac0 |
#
|
|
|
7d1ac0 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
7d1ac0 |
#
|
|
|
7d1ac0 |
# This program is free software; you can redistribute it and/or modify
|
|
|
7d1ac0 |
# it under the terms of the GNU General Public License as published by
|
|
|
7d1ac0 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
7d1ac0 |
# your option) any later version.
|
|
|
7d1ac0 |
#
|
|
|
7d1ac0 |
# This program is distributed in the hope that it will be useful, but
|
|
|
7d1ac0 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7d1ac0 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
7d1ac0 |
# General Public License for more details.
|
|
|
7d1ac0 |
#
|
|
|
7d1ac0 |
# You should have received a copy of the GNU General Public License
|
|
|
7d1ac0 |
# along with this program; if not, write to the Free Software
|
|
|
7d1ac0 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7d1ac0 |
#
|
|
|
7d1ac0 |
# ----------------------------------------------------------------------
|
|
|
7d1ac0 |
# $Id$
|
|
|
7d1ac0 |
# ----------------------------------------------------------------------
|
|
|
7d1ac0 |
|
|
|
7d1ac0 |
function render_doThemeActions {
|
|
|
7d1ac0 |
|
|
|
f259c7 |
local -a MOTIFS
|
|
|
f259c7 |
local MOTIF=''
|
|
|
f259c7 |
local COUNT=0
|
|
|
f259c7 |
local NEXT_DIR=''
|
|
|
f259c7 |
|
|
|
7d1ac0 |
# Define patterns using the design model specified by
|
|
|
7d1ac0 |
# FLAG_THEME_MODEL as reference to know what organization to
|
|
|
7d1ac0 |
# create inside artistic motifs. When rendering, this condition
|
|
|
7d1ac0 |
# let the artistic motif to be produced using the same
|
|
|
7d1ac0 |
# organization of its design model. The intersting thing of this
|
|
|
7d1ac0 |
# configuration is that you can have more than one design models
|
|
|
7d1ac0 |
# and each one can has its own unique organization.
|
|
|
7d1ac0 |
local MODELS_PATTERN=$(find \
|
|
|
f259c7 |
$(cli_getRepoTLDir)/Identity/Models/Themes/${FLAG_THEME_MODEL}/ \
|
|
|
7d1ac0 |
-type d | egrep -v '\.svn' | sed -r '/^$/d' | sed -r \
|
|
|
7d1ac0 |
"s!^.*/${FLAG_THEME_MODEL}/!!" | tr "\n" '|' \
|
|
|
7d1ac0 |
| sed -e 's!^|!!' -e 's!|$!!')
|
|
|
7d1ac0 |
|
|
|
7d1ac0 |
# Define list of available artistic motifs include their names and
|
|
|
7d1ac0 |
# versions directory levels. To build this list use the theme
|
|
|
f259c7 |
# design model directory structure as renference. Also, build the
|
|
|
f259c7 |
# list using the most specific renderable directories (e.g., those
|
|
|
f259c7 |
# whose have a longer path) to avoid unnecessary rendition loops.
|
|
|
f259c7 |
for MOTIF in $(find $(cli_getRepoTLDir)/Identity/Images/Themes \
|
|
|
f259c7 |
-regextype posix-egrep -type d -regex ".+/(${MODELS_PATTERN})$" \
|
|
|
de17b6 |
| sort -r | grep "$ACTIONVAL");do
|
|
|
de17b6 |
if [[ $MOTIF != '' ]];then
|
|
|
de17b6 |
MOTIFS[((++${#MOTIFS[*]}))]=${MOTIF}
|
|
|
de17b6 |
fi
|
|
|
f259c7 |
done
|
|
|
f259c7 |
|
|
|
f259c7 |
# Redefine counter using the grater value to perform an inverted
|
|
|
de17b6 |
# interpretation of the values and so, to process them using the
|
|
|
de17b6 |
# same order.
|
|
|
de17b6 |
if [[ ${#MOTIFS[*]} -gt 0 ]];then
|
|
|
de17b6 |
COUNT=${#MOTIFS[*]}
|
|
|
de17b6 |
else
|
|
|
de17b6 |
COUNT=0
|
|
|
de17b6 |
fi
|
|
|
f259c7 |
|
|
|
f259c7 |
until [[ $COUNT -eq 0 ]];do
|
|
|
f259c7 |
|
|
|
de17b6 |
# Decrement counter to match the correct count value.
|
|
|
de17b6 |
COUNT=$(($COUNT - 1))
|
|
|
de17b6 |
|
|
|
f259c7 |
# Redefine action value to refer theme specific renderable
|
|
|
f259c7 |
# directory.
|
|
|
f259c7 |
ACTIONVAL=${MOTIFS[$COUNT]}
|
|
|
f259c7 |
|
|
|
f259c7 |
# Define what is the next directory in the list, so we could
|
|
|
f259c7 |
# verify whether to render or not the current theme specific
|
|
|
f259c7 |
# renderable directory.
|
|
|
f259c7 |
if [[ $COUNT -eq 0 ]];then
|
|
|
f259c7 |
NEXT_DIR=''
|
|
|
f259c7 |
else
|
|
|
f259c7 |
NEXT_DIR=$(dirname ${MOTIFS[(($COUNT - 1))]})
|
|
|
f259c7 |
fi
|
|
|
f259c7 |
|
|
|
f259c7 |
# Verify whether to render or not the current theme renderable
|
|
|
f259c7 |
# directory. This verificatin is required in order to avoid
|
|
|
f259c7 |
# unncessary rendition loops. For example, don't render
|
|
|
f259c7 |
# `path/to/dir/A' when `path/to/dir/A/B' does exist, that
|
|
|
f259c7 |
# configuration would produce `/path/to/dir/A/B twice.
|
|
|
f259c7 |
if [[ $ACTIONVAL =~ '[[:digit:]]$' ]] \
|
|
|
f259c7 |
|| [[ $ACTIONVAL == $NEXT_DIR ]];then
|
|
|
f259c7 |
continue
|
|
|
f259c7 |
fi
|
|
|
f259c7 |
|
|
|
f259c7 |
# Execute direct rendition on theme specific renderable
|
|
|
f259c7 |
# directory as specified by action value.
|
|
|
7d1ac0 |
render_doBaseActions
|
|
|
f259c7 |
|
|
|
7d1ac0 |
done
|
|
|
7d1ac0 |
|
|
|
7d1ac0 |
}
|