|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# render_doThemeActions.sh -- This function performs theme-specific
|
|
|
878a2b |
# rendition.
|
|
|
878a2b |
#
|
|
|
03486a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function render_doThemeActions {
|
|
|
878a2b |
|
|
|
878a2b |
local -a DIRS
|
|
|
878a2b |
local COUNT=0
|
|
|
878a2b |
local NEXT_DIR=''
|
|
|
878a2b |
local MOTIF_NAME=''
|
|
|
878a2b |
local MOTIF_DIR=''
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
a728cf |
local MOTIF_BASEDIR="${TCAR_WORKDIR}/trunk/Identity/Images/Themes"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
a728cf |
local MODEL_BASEDIR="${TCAR_WORKDIR}/trunk/Identity/Models/Themes"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local MODEL_DIR=''
|
|
|
878a2b |
local MODEL_DIRS="$(cli_getFilesList ${MODEL_BASEDIR}/${FLAG_THEME_MODEL} \
|
|
|
e26dcb |
--pattern="^.+$" --type="d" \
|
|
|
e26dcb |
| egrep -v '\.svn' \
|
|
|
e26dcb |
| sed -e '/^[[:space:]]*$/d' \
|
|
|
e26dcb |
-e "s!^.*/${FLAG_THEME_MODEL}/!!" \
|
|
|
e26dcb |
-e '/^[[:space:]]*$/d')"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local MODEL_PATTERN=$(echo "$MODEL_DIRS" | tr "\n" '|' \
|
|
|
878a2b |
| sed -e 's!^|!!' -e 's!|$!!')
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local MOTIF_RENDERABLE_DIR=''
|
|
|
878a2b |
local MOTIF_RENDERABLE_DIRS=$(cli_getFilesList ${MOTIF_BASEDIR} \
|
|
|
878a2b |
--pattern=".+/($MODEL_PATTERN)" --type="d" | grep "$ACTIONVAL")
|
|
|
878a2b |
|
|
|
878a2b |
# Rebuild list of renderable directory structures using an array
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
for MOTIF_RENDERABLE_DIR in $MOTIF_RENDERABLE_DIRS;do
|
|
|
878a2b |
DIRS[((++${#DIRS[*]}))]=${MOTIF_RENDERABLE_DIR}
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local DIRS_TOTAL=$((${
|
|
|
878a2b |
|
|
|
878a2b |
while [[ $COUNT -le ${DIRS_TOTAL} ]];do
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
ACTIONVAL=${DIRS[$COUNT]}
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
MOTIF_NAME=$(cli_getPathComponent $ACTIONVAL --motif)
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# must be present in order for theme rendition to happen.
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
if [[ $MOTIF_NAME == '' ]] || [[ $MOTIF_NAME =~ "^$MODEL_PATTERN" ]];then
|
|
|
878a2b |
COUNT=$(($COUNT + 1))
|
|
|
878a2b |
continue
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
MOTIF_DIR="${MOTIF_BASEDIR}/${MOTIF_NAME}"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
if [[ $COUNT -lt ${DIRS_TOTAL} ]];then
|
|
|
878a2b |
NEXT_DIR=$(dirname ${DIRS[(($COUNT + 1))]})
|
|
|
878a2b |
else
|
|
|
878a2b |
NEXT_DIR=''
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# render `path/to/dir/A' when `path/to/dir/A/B' does exist,
|
|
|
878a2b |
|
|
|
878a2b |
if [[ $ACTIONVAL =~ '[[:digit:]]$' ]] || [[ $ACTIONVAL == $NEXT_DIR ]];then
|
|
|
878a2b |
COUNT=$(($COUNT + 1))
|
|
|
878a2b |
continue
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
render_doBaseActions
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
COUNT=$(($COUNT + 1))
|
|
|
878a2b |
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
}
|