Blame Scripts/Bash/Cli/Functions/Render/render.sh

4c79b5
#!/bin/bash
4c79b5
#
ab1d67
# render.sh -- This function initializes rendition variables and
294842
# actions to centos-art.sh script.
4c79b5
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
4c79b5
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# 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
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
ab1d67
function render {
4c79b5
d538ed
    local ACTIONNAM=''
4d7186
    local ACTIONVAL=''
4d7186
49237e
    # Define release number flag. The relesase number flag
49237e
    # (--releasever) specifies the release number identity images are
49237e
    # rendered for.  By default no release number is used.
49237e
    local FLAG_RELEASEVER=''
15b1d2
49237e
    # Define architecture flag. The architecture flag (--basearch)
c9f7fa
    # specifies the architecture type identity images are rendered
c9f7fa
    # for.  By default no architecture type is used.
49237e
    local FLAG_BASEARCH=''
c9f7fa
294842
    # Define theme model flag. The theme model flag (--theme-model)
294842
    # specifies the theme model used when no one is specified.
294842
    local FLAG_THEME_MODEL='Default'
294842
b463d6
    # Define convert-to flag. The convert-to flag (--convert-to)
b463d6
    # specifies the post-rendition image convertion action to perform
b463d6
    # upon PNG images.  By default there is no image convertion.
b463d6
    local FLAG_CONVERT_TO=''
b463d6
b463d6
    # Define grouped-by flag. The grouped-by flag (--grouped-by)
b463d6
    # specifies the post-rendition image grouping action to perform
b463d6
    # upon images produced. By default there is no grouping action.
b463d6
    local FLAG_GROUPED_BY=''
b463d6
49237e
    # Interpret arguments and options passed through command-line.
d3dc02
    render_getArguments
4c79b5
49237e
    # Redefine positional parameters using ARGUMENTS. At this point,
49237e
    # option arguments have been removed from ARGUMENTS variable and
49237e
    # only non-option arguments remain in it. 
49237e
    eval set -- "$ARGUMENTS"
49237e
d538ed
    # Define action name. No matter what option be passed to
d538ed
    # centos-art, there is only one action to perform (i.e., the
d538ed
    # base-rendition flow).
d538ed
    ACTIONNAM="${FUNCNAME}_doBaseActions"
d538ed
eb2554
    # Define action value. We use non-option arguments to define the
eb2554
    # action value (ACTIONVAL) variable.
49237e
    for ACTIONVAL in "$@";do
49237e
        
49237e
        if [[ $ACTIONVAL == '--' ]];then
49237e
            continue
49237e
        fi
49237e
49237e
        # Check action value. Be sure the action value matches the
49237e
        # convenctions defined for source locations inside the working
49237e
        # copy.
49237e
        cli_checkRepoDirSource
49237e
49237e
        # Syncronize changes between repository and working copy. At
49237e
        # this point, changes in the repository are merged in the
49237e
        # working copy and changes in the working copy committed up to
49237e
        # repository.
49237e
        cli_syncroRepoChanges
49237e
d538ed
        # Execute action name.
d538ed
        if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then
d538ed
            eval $ACTIONNAM
d538ed
        else
d538ed
            cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine'
d538ed
            cli_printMessage "$(caller)" 'AsToKnowMoreLine'
d538ed
        fi
49237e
49237e
        # Commit changes from working copy to central repository only.
49237e
        # At this point, changes in the repository are not merged in
49237e
        # the working copy, but chages in the working copy do are
49237e
        # committed up to repository.
49237e
        cli_commitRepoChanges
49237e
49237e
    done
49237e
4c79b5
}