Blame Scripts/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
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# 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
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
ab1d67
function render {
4c79b5
d538ed
    local ACTIONNAM=''
4d7186
    local ACTIONVAL=''
4d7186
61bb5b
    # Initialize `--releasever' option. The release version option
61bb5b
    # controls the release number used to produce release-specific
61bb5b
    # content.  By default no release number is used.
49237e
    local FLAG_RELEASEVER=''
15b1d2
61bb5b
    # Initialize `--basearch' option. The base architecture option
61bb5b
    # controls the architecture type used to produce
61bb5b
    # architecture-specific content. By default no architecture type
61bb5b
    # is used.
49237e
    local FLAG_BASEARCH=''
c9f7fa
61bb5b
    # Initialize `--theme-model' option. The theme model option
61bb5b
    # specifies the the theme model name used to produce theme
61bb5b
    # artistic motifs.
294842
    local FLAG_THEME_MODEL='Default'
294842
61bb5b
    # Initialize `--convert' option. The convert option controls
1badd6
    # whether to convert or not content produced as result of
61bb5b
    # base-rendition. By default there is no content convertion.
61bb5b
    local FLAG_CONVERT=''
b463d6
1badd6
    # Initialize `--comment' option. The comment option controls the
1badd6
    # the text message we annotate in base-rendition output. Notice
1badd6
    # that the comment will be annotated in those formats that permit
1badd6
    # such thing (e.g., PNG files).
1badd6
    local FLAG_COMMENT="`gettext "Created in CentOS Arwork Repository"` ($(cli_printUrl '--projects-artwork'))"
61bb5b
1badd6
    # Initialize `--sharpen' option. The shapen option adaptively
1badd6
    # sharpen pixels and increase effect near edges. It might use a
1badd6
    # Gaussian operator of the given radius and standard deviation
1badd6
    # (sigma).
1badd6
    local FLAG_SHARPEN=''
61bb5b
61bb5b
    # Initialize `--group-by' option. The grouped-by option specifies
1badd6
    # Initialize `--group-by' option. The grouped-by option specifies
61bb5b
    # whether grouping or not content produced by centos-art
61bb5b
    # base-rendition. By default there is no content grouping.
b463d6
    local FLAG_GROUPED_BY=''
b463d6
49237e
    # Interpret arguments and options passed through command-line.
5792d8
    render_getOptions
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
eb2554
    # Define action value. We use non-option arguments to define the
eb2554
    # action value (ACTIONVAL) variable.
49237e
    for ACTIONVAL in "$@";do
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
cff13a
        # Define action name using action value as reference.  
cff13a
        if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/Images/Themes" ]];then
cff13a
            ACTIONNAM="${FUNCNAME}_doThemeActions"
cff13a
        elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/Images" ]];then
cff13a
            ACTIONNAM="${FUNCNAME}_doBaseActions"
cff13a
        else
0ff158
            cli_printMessage "`gettext "The path provided do not support rendition."`" --as-error-line
cff13a
        fi
cff13a
d538ed
        # Execute action name.
d538ed
        if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then
d538ed
            eval $ACTIONNAM
d538ed
        else
0ff158
            cli_printMessage "`gettext "A valid action is required."`" --as-error-line
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
}