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

4c79b5
#!/bin/bash
4c79b5
#
4c79b5
# render_doIdentityTexts.sh -- This function provides text rendering
4c79b5
# feature to centos-art.sh script.
4c79b5
#
4c79b5
# Copyright (C) 2009-2010 Alain Reguera Delgado
4c79b5
# 
4c79b5
# This program is free software; you can redistribute it and/or
4c79b5
# modify it under the terms of the GNU General Public License as
4c79b5
# published by the Free Software Foundation; either version 2 of the
4c79b5
# License, or (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_doIdentityTexts.sh 83 2010-09-18 08:48:10Z al $
4c79b5
# ----------------------------------------------------------------------
4c79b5
4c79b5
function render_doIdentityTexts {
4c79b5
4c79b5
    # Start processing the base rendering list of FILES. Fun part
4c79b5
    # approching :-).
4c79b5
    for FILE in $FILES; do
4c79b5
4c79b5
        # Call identity shared variable definitions.
4c79b5
        render_getIdentityDefs
4c79b5
4c79b5
        # Render text file.
4c79b5
        cli_printMessage "`gettext "Saved as"`: $FILE"
4c79b5
        cat $INSTANCE > $FILE
4c79b5
4c79b5
        # Remove template instance.
4c79b5
        if [[ -a $INSTANCE ]];then
4c79b5
            rm $INSTANCE
4c79b5
        fi
4c79b5
4c79b5
        # Check post-rendering actions. Do we have any? If we don't,
4c79b5
        # then continue with the next file in the loop.
4c79b5
        if [[ ${#ACTIONS[@]} -lt 1 ]];then
4c79b5
            continue
4c79b5
        fi
4c79b5
4c79b5
        # Execute post-rendering actions.
4c79b5
        for ACTION in "${ACTIONS[@]}"; do
4c79b5
4c79b5
            if [[ "$ACTION" == '' ]];then
4c79b5
                continue
4c79b5
            fi
4c79b5
4c79b5
            case "$ACTION" in
4c79b5
4c79b5
                formatText:* )
4c79b5
                    render_doIdentityTextFormats "$FILE" "$ACTION"
4c79b5
                    ;;
4c79b5
4c79b5
             esac
4c79b5
4c79b5
        done
4c79b5
4c79b5
        echo '----------------------------------------------------------------------'
4c79b5
4c79b5
    done \
4c79b5
        | awk 'BEGIN {FS=": "} \
4c79b5
            { if ( $0 ~ /^-+$/ ) print $0; else \
4c79b5
                printf "%s: \t%s\n", $1, $2 }'
4c79b5
4c79b5
}