|
|
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 |
|
|
|
ee2081 |
local -a DIRS
|
|
|
ee2081 |
local DIR=''
|
|
|
f259c7 |
local COUNT=0
|
|
|
f259c7 |
local NEXT_DIR=''
|
|
|
f259c7 |
|
|
|
ee2081 |
# Define patterns to know what organization to create inside
|
|
|
ee2081 |
# artistic motifs. Use the design model specified by
|
|
|
ee2081 |
# FLAG_THEME_MODEL as reference. 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.
|
|
|
ee2081 |
local PATTERN=$(cli_getFilesList \
|
|
|
f259c7 |
$(cli_getRepoTLDir)/Identity/Models/Themes/${FLAG_THEME_MODEL}/ \
|
|
|
ee2081 |
--type="d" | egrep -v '\.svn' | sed -r '/^[[:space:]]*$/d' | sed -r \
|
|
|
7d1ac0 |
"s!^.*/${FLAG_THEME_MODEL}/!!" | tr "\n" '|' \
|
|
|
7d1ac0 |
| sed -e 's!^|!!' -e 's!|$!!')
|
|
|
7d1ac0 |
|
|
|
ee2081 |
# Define list of renderable directory structures inside the
|
|
|
ee2081 |
# artistic motif. As reference, to build this list, use the theme
|
|
|
ee2081 |
# design model directory structure. Later, reverse the list and
|
|
|
ee2081 |
# filter it using the action value as reference to control what
|
|
|
ee2081 |
# renderable directory structure to produce.
|
|
|
ee2081 |
local RENDERABLE_DIRS=$(\
|
|
|
ee2081 |
cli_getFilesList $(cli_getRepoTLDir)/Identity/Images/Themes \
|
|
|
ee2081 |
--pattern=".+/($PATTERN)$" --type="d" | sort -r \
|
|
|
ee2081 |
| grep "$ACTIONVAL")
|
|
|
ee2081 |
|
|
|
ee2081 |
# Rebuild the list of renderable directory structures using an
|
|
|
ee2081 |
# array variable. This let us to predict what directory is one
|
|
|
ee2081 |
# step forward or backward from the current directory structure.
|
|
|
ee2081 |
for DIR in $RENDERABLE_DIRS;do
|
|
|
ee2081 |
DIRS[((++${#DIRS[*]}))]=${DIR}
|
|
|
f259c7 |
done
|
|
|
f259c7 |
|
|
|
ee2081 |
# Redefine counter using the greater value to perform an inverted
|
|
|
de17b6 |
# interpretation of the values and so, to process them using the
|
|
|
de17b6 |
# same order.
|
|
|
ee2081 |
if [[ ${#DIRS[*]} -gt 0 ]];then
|
|
|
ee2081 |
COUNT=${#DIRS[*]}
|
|
|
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.
|
|
|
ee2081 |
ACTIONVAL=${DIRS[$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.
|
|
|
ee2081 |
if [[ $COUNT -gt 0 ]];then
|
|
|
ee2081 |
NEXT_DIR=$(dirname ${DIRS[(($COUNT - 1))]})
|
|
|
f259c7 |
else
|
|
|
ee2081 |
NEXT_DIR=''
|
|
|
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 |
}
|