diff --git a/Scripts/Bash/Functions/Identity/identity_renderBase.sh b/Scripts/Bash/Functions/Identity/identity_renderBase.sh index 0023925..53ad274 100755 --- a/Scripts/Bash/Functions/Identity/identity_renderBase.sh +++ b/Scripts/Bash/Functions/Identity/identity_renderBase.sh @@ -40,7 +40,7 @@ function identity_renderBase { local -a COMMONDIRS # Redefine parent directory for current workplace. - PARENTDIR=$(basename "$ACTIONVAL") + PARENTDIR=$(basename "${ACTIONVAL}") # Define base location of template files. identity_renderDirTemplate @@ -60,6 +60,9 @@ function identity_renderBase { COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) done + # Reset common directory counter. + COMMONDIRCOUNT=0 + # Define export id used inside design templates. This value # defines the design area we want to export. EXPORTID='CENTOSARTWORK' @@ -183,42 +186,21 @@ function identity_renderBase { fi # Execute post-rendition actions. - for ACTION in "${POSTACTIONS[@]}"; do - - case "$ACTION" in - - renderSyslinux* ) - identity_renderSyslinux "${FILE}" "$ACTION" - ;; - - renderGrub* ) - identity_renderGrub "${FILE}" "$ACTION" - ;; - - renderFormats:* ) - identity_renderFormats "${FILE}" "$ACTION" - ;; - - groupByType:* ) - identity_renderGroupByType "${FILE}" "$ACTION" - ;; - - esac - - done + identity_renderPostActions # Output separator line. cli_printMessage '-' 'AsSeparatorLine' - # Apply last-rendition actions. As convenction, last-rendition + # Verify position of file being produced in the list of files + # been currently processed. As convenction, last-rendition # actions are applied after all images inside the same - # directory structure have been produced. Notice that, in + # directory structure have being produced. Notice that, in # order to apply last-rendition actions correctly, # centos-art.sh needs to "predict" what the last file in the # same directory structure would be. There is no magic here, # so we need to previously define which are the common - # directory structures centos-art.sh could produce content - # for inside an array variable. Later, using the index of that + # directory structures centos-art.sh could produce content for + # inside an array variable. Later, using the index of that # array variable we could check the next item in the array # against the file being currently produced. If they match, we # haven't reached the end of the same directory structure, but @@ -231,34 +213,15 @@ function identity_renderBase { # At this point centos-art.sh should be producing the last # file from the same unique directory structure, so, # before producing images for the next directory structure - # lets evaluate last-rendition actions for the current + # lets execute last-rendition actions for the current # directory structure. - for ACTION in "${LASTACTIONS[@]}"; do - - case "$ACTION" in - - renderKSplash ) - identity_renderKsplash - ;; - - renderDm:* ) - identity_renderDm "$ACTION" - ;; + identity_renderLastActions - groupByType:* ) - identity_renderGroupByType "$ACTION" - ;; - - renderBrands ) - identity_renderBrands "${FILE}" "$ACTION" - ;; - - esac - done fi # Increment common directory counter. COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1)) done + } diff --git a/Scripts/Bash/Functions/Identity/identity_renderDm.sh b/Scripts/Bash/Functions/Identity/identity_renderDm.sh index 6af2231..6d182d7 100755 --- a/Scripts/Bash/Functions/Identity/identity_renderDm.sh +++ b/Scripts/Bash/Functions/Identity/identity_renderDm.sh @@ -58,7 +58,7 @@ function identity_renderDm { # Get display manager passed from render.conf.sh pre-rendition # configuration script. - DM=$(identity_renderConfigOption "$1" '2') + DM=$(identity_renderConfigOption "${ACTION}" '2') # Sanitate display manager passed from render.conf.sh # pre-rendition configuration script. Whatever value be retrived @@ -69,7 +69,7 @@ function identity_renderDm { # Get screen resolutions passed from render.conf.sh pre-rendition # configuration script. - RESOLUTIONS=$(identity_renderConfigOption "$1" '3') + RESOLUTIONS=$(identity_renderConfigOption "${ACTION}" '3') # Check screen resolutions passed from render.conf.sh # pre-rendition configuration script. diff --git a/Scripts/Bash/Functions/Identity/identity_renderFormats.sh b/Scripts/Bash/Functions/Identity/identity_renderFormats.sh index b731691..616a42c 100644 --- a/Scripts/Bash/Functions/Identity/identity_renderFormats.sh +++ b/Scripts/Bash/Functions/Identity/identity_renderFormats.sh @@ -29,9 +29,6 @@ function identity_renderFormats { - # Get absolute path of PNG image file. - local FILE="$1" - # Get image formats. local FORMATS=$(identity_renderConfigOption "$2" '2-') diff --git a/Scripts/Bash/Functions/Identity/identity_renderGrub.sh b/Scripts/Bash/Functions/Identity/identity_renderGrub.sh index 6f2f0b2..90d3a34 100644 --- a/Scripts/Bash/Functions/Identity/identity_renderGrub.sh +++ b/Scripts/Bash/Functions/Identity/identity_renderGrub.sh @@ -26,10 +26,6 @@ function identity_renderGrub { - local FILE="$1" - local ACTION="$2" - local OPTIONS='' - # Define 16 colors images default file name prefix. local PREFIX='-14c' @@ -37,7 +33,7 @@ function identity_renderGrub { # configuration script. These options are applied to pnmremap when # doing color reduction, so any option available for pnmremap # command can be passed to renderSyslinux functionality. - OPTIONS=$(identity_renderConfigOption "$ACTION" '2-') + local OPTIONS=$(identity_renderConfigOption "$ACTION" '2-') # Re-define 16 colors images default file name prefix using # options as reference. This is useful to differenciate final diff --git a/Scripts/Bash/Functions/Identity/identity_renderLastActions.sh b/Scripts/Bash/Functions/Identity/identity_renderLastActions.sh new file mode 100755 index 0000000..0311b5d --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderLastActions.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# identity_renderLastActions.sh -- This function executes +# last-rendition actions. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderLastActions { + + local ACTION='' + + for ACTION in "${LASTACTIONS[@]}"; do + + case "${ACTION}" in + + renderKSplash ) + identity_renderKsplash + ;; + + renderDm:* ) + identity_renderDm + ;; + + groupByType:* ) + identity_renderGroupByType + ;; + esac + + done + +} diff --git a/Scripts/Bash/Functions/Identity/identity_renderPostActions.sh b/Scripts/Bash/Functions/Identity/identity_renderPostActions.sh new file mode 100755 index 0000000..4cde273 --- /dev/null +++ b/Scripts/Bash/Functions/Identity/identity_renderPostActions.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# identity_renderPostActions.sh -- This function executes +# post-rendition actions. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function identity_renderPostActions { + + local ACTION='' + + for ACTION in "${POSTACTIONS[@]}"; do + + case "${ACTION}" in + + renderSyslinux* ) + identity_renderSyslinux + ;; + + renderGrub* ) + identity_renderGrub + ;; + + renderFormats:* ) + identity_renderFormats + ;; + + groupByType:* ) + identity_renderGroupByType + ;; + + renderBrands ) + identity_renderBrands + ;; + + esac + + done + +} diff --git a/Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh b/Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh index a88e406..97b24de 100755 --- a/Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh +++ b/Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh @@ -26,10 +26,6 @@ function identity_renderSyslinux { - local FILE="$1" - local ACTION="$2" - local OPTIONS='' - # Define 16 colors images default file name prefix. local PREFIX='-16c' @@ -37,7 +33,7 @@ function identity_renderSyslinux { # configuration script. These options are applied to pnmremap when # doing color reduction, so any option available for pnmremap # command can be passed to renderSyslinux functionality. - OPTIONS=$(identity_renderConfigOption "$ACTION" '2-') + local OPTIONS=$(identity_renderConfigOption "$ACTION" '2-') # Check options passed to action. This is required in order to # aviod using options used already in this script. For example